Bump T1 dependencies #1132
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Trigger Physical Design Workflow | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- ready_for_review | |
- labeled | |
- unlabeled | |
env: | |
USER: runner | |
# Cancel the current workflow when new commit pushed | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | |
cancel-in-progress: true | |
jobs: | |
generate-test-plan: | |
name: "Generate CI target for RTL elaborate" | |
runs-on: [self-hosted, linux, nixos] | |
outputs: | |
testplan: ${{ steps.get-testplan.outputs.testplan }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- id: "get-testplan" | |
run: | | |
testFile="./designs/org.chipsalliance.t1.elaborator.t1rocketv.T1RocketTile.toml" | |
jsonData=$(nix shell ".#dasel" -c dasel -r toml -f "$testFile" -w json) | |
echo "testplan=$(echo "$jsonData" | nix shell ".#jq" -c jq -c -r '{ "config": keys }')" \ | |
> $GITHUB_OUTPUT | |
test-emit: | |
name: "Test elaborate" | |
needs: [generate-test-plan] | |
runs-on: [self-hosted, linux, nixos] | |
strategy: | |
matrix: ${{ fromJSON(needs.generate-test-plan.outputs.testplan) }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: "Test elaborate" | |
run: | | |
testAttr="t1rocketv" | |
testConfig=${{ matrix.config }} | |
echo "Building .#t1.${testConfig}.${testAttr}.rtl" | |
nix build ".#t1.${testConfig}.${testAttr}.rtl" -L | |
physical-design-report: | |
timeout-minutes: 1440 | |
name: "Request physical design report" | |
if: ${{ success() && (contains(github.event.pull_request.labels.*.name, 'PD-Lane') || contains(github.event.pull_request.labels.*.name, 'PD-Lane-DBG'))}} | |
runs-on: [self-hosted, linux, nixos, BIGRAM] | |
needs: [test-emit] | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- blastoise | |
- rookidee | |
steps: | |
- name: "Request report" | |
env: | |
# Use env key can help us inspect the data | |
GH_TOKEN: ${{ secrets.T1_PR_PAT }} | |
JSON_CTX: ${{ toJson(github.event.pull_request.labels.*.name) }} | |
T1_BRANCH: ${{ github.head_ref || github.ref_name }} | |
T1_CONFIG: ${{ matrix.config }} | |
PD_URL: ${{ secrets.T1_INHOUSE_URL }} | |
run: | | |
set -e | |
# GitHub `toJson` will pretty print JSON and causing multiple line escape issue | |
# So we have to redirect it to file here | |
printf "$JSON_CTX" > _ctx.json | |
pdType=$(jq -r 'map(select(. | test("^PD-Lane.*"))) | .[0]' _ctx.json) | |
if [[ -z "$pdType" ]] || [[ "$pdType" == "null" ]]; then | |
echo "Unable to filter Physical Design type" | |
exit 1 | |
fi | |
# Use nix provided locked T1 rev to ensure this is commit the backend script is using | |
_T1_INPUT_URL="github:chipsalliance/t1/${T1_BRANCH}" | |
_BACKEND_FLAKE_URL="git+https://${GH_TOKEN}@${PD_URL}" | |
T1_COMMIT=$(nix flake metadata --json \ | |
--override-input t1 "${_T1_INPUT_URL}" \ | |
"${_BACKEND_FLAKE_URL}" \ | |
| jq -r .locks.nodes.t1.locked.rev) | |
_OUTPUT_DIR="fc_result" | |
nix build --impure --out-link ${_OUTPUT_DIR} \ | |
--override-input t1 "${_T1_INPUT_URL}" \ | |
"${_BACKEND_FLAKE_URL}#prometheus.${T1_CONFIG}.tsn28-run-fc-rm.T1RocketTile" | |
CAPTION=$(cat <<- EOF | |
T1RocketTile PD Reports | |
======================= | |
Generated at $(date) | |
Information | |
----------- | |
* commit: $T1_COMMIT | |
* branch: $T1_BRANCH | |
* config: $T1_CONFIG | |
* Artifacts path: $(realpath ${_OUTPUT_DIR}) | |
EOF | |
) | |
MEDIA=$(find "${_OUTPUT_DIR}/reports" -type f -name "*.rpt" -exec basename '{}' ';' \ | |
| jq -Rn '[inputs | { media: "attach://\(.)", type: "document" }]') | |
# An workaround for pretty print information of a group of files | |
MEDIA=$(echo "$MEDIA" | jq -r --arg caption "$CAPTION" '.[-1] += { caption: $caption }') | |
DOCUMENTS=( $(find "${_OUTPUT_DIR}/reports" -type f -name '*.rpt' -printf '-F\n%f=@%p\n') ) | |
BOT_TOKEN=$( echo "${{ secrets.T1_BACKEND_REPORT_ENDPOINT_DATA }}" | cut -d';' -f1 ) | |
CHAT_ID=$( echo "${{ secrets.T1_BACKEND_REPORT_ENDPOINT_DATA }}" | cut -d';' -f2 ) | |
TOPIC_ID=$( echo "${{ secrets.T1_BACKEND_REPORT_ENDPOINT_DATA }}" | cut -d';' -f3 ) | |
nix run nixpkgs#curl -- -s -X POST "https://api.telegram.org/bot$BOT_TOKEN/sendMediaGroup" \ | |
-F "chat_id=$CHAT_ID" \ | |
-F "message_thread_id=$TOPIC_ID" \ | |
${DOCUMENTS[@]} \ | |
-F "media=$MEDIA" >/dev/null |