Skip to content

[ci] make sure all config specify in designs dir elaboratable #704

[ci] make sure all config specify in designs dir elaboratable

[ci] make sure all config specify in designs dir elaboratable #704

Workflow file for this run

name: Trigger Physical Design Workflow
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
- labeled
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:
if: '! github.event.pull_request.draft'
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:
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: ubuntu-latest
needs: [test-emit]
steps:
- name: "Request report"
env:
# Use env key can help us inspect the data
JSON_CTX: ${{ toJson(github.event.pull_request.labels.*.name) }}
run: |
# 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
commitSha="${{ github.event.pull_request.head.sha }}"
prId="${{ github.event.pull_request.number }}"
jq -n \
--arg commit_sha "$commitSha" \
--arg pr_id "$prId" \
--arg pd_type "$pdType" \
'{"event_type":"ci_success","client_payload":{"commit_sha": $commit_sha,"pr_id": $pr_id, "pd_type": $pd_type }}' \
> payload.json
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.T1_INHOUSE_PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"${{ secrets.T1_INHOUSE_URL }}" \
-d '@payload.json'