T1Emu Verilator Daily Regression #123
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: T1Emu Verilator Daily Regression | |
on: | |
schedule: | |
# Run this job everyday at 6:30 AM UTC+8 | |
- cron: '30 22 * * *' | |
env: | |
EMU_TOP: t1emu | |
jobs: | |
gen-test-plan: | |
name: "Generate test plan" | |
runs-on: [self-hosted, linux, nixos] | |
outputs: | |
testplan: ${{ steps.get-all-configs.outputs.out }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- id: "get-all-configs" | |
run: echo "out=$(nix run .#ci-helper -- generateTestPlan --top ${{ env.EMU_TOP }})" > $GITHUB_OUTPUT | |
build-verilator-emulators: | |
name: "Build Verilator Emulators" | |
needs: [gen-test-plan] | |
runs-on: [self-hosted, linux, nixos, BIGRAM] | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.gen-test-plan.outputs.testplan) }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: "Build verilator emulator" | |
run: | | |
nix build '.#t1.${{ matrix.config }}.${{ env.EMU_TOP }}.verilator-emu' --impure -L --no-link --cores 64 | |
- name: "Build all testcases" | |
run: | | |
# Build testcases with vlen 1024 and vlen 4096 | |
nix build ".#t1.${{ matrix.config }}.${{ env.EMU_TOP }}.cases._all" --impure --max-jobs auto -L --no-link --cores 64 | |
# In the future, we may choose Verdi for trace, and left verilator trace only for performance evaluation | |
build-verilator-trace-emulators: | |
name: "Build verilator trace emulators" | |
needs: [gen-test-plan] | |
runs-on: [self-hosted, linux, nixos, BIGRAM] | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.gen-test-plan.outputs.testplan) }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: "Build verilator emulator with trace" | |
run: nix build '.#t1.${{ matrix.config }}.${{ env.EMU_TOP }}.verilator-emu-trace' --impure -L --no-link --cores 64 | |
gen-matrix: | |
name: "Prepare for running testcases" | |
needs: [build-verilator-emulators] | |
runs-on: [self-hosted, linux, nixos, BIGRAM] | |
env: | |
RUNNERS: 70 | |
outputs: | |
ci-tests: ${{ steps.gen-matrix.outputs.matrix }} | |
steps: | |
# actions/checkout will use the "event" commit to checkout repository, | |
# which will lead to an unexpected issue that the "event" commit doesn't belongs to the repository, | |
# and causing the derivation build output cannot be cache correctly. | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- id: gen-matrix | |
name: "Generate test matrix" | |
run: | | |
echo -n matrix= >> "$GITHUB_OUTPUT" | |
nix run ".#ci-helper" -- generateCiMatrix --top ${{ env.EMU_TOP }} --runnersAmount "$RUNNERS" >> "$GITHUB_OUTPUT" | |
run-testcases: | |
name: "Run testcases" | |
needs: [gen-matrix] | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.gen-matrix.outputs.ci-tests) }} | |
runs-on: [self-hosted, linux, nixos] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: "Run testcases" | |
run: | | |
nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}" --emuLib "verilator" --top ${{ env.EMU_TOP }} | |
report: | |
name: "Report CI result" | |
# Don't run report when: | |
# - user cancel ( we don't need report at this case ) | |
# - PR from outside repository ( we don't have permission to push commit into fork repository ) | |
if: ${{ !cancelled() && github.event.pull_request.head.repo.full_name == github.repository }} | |
needs: [run-testcases] | |
runs-on: [self-hosted, linux, nixos] | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.head_ref }} | |
- name: "Print step summary" | |
run: | | |
nix run ".#ci-helper" -- postCI \ | |
--cycle-update-file-path ./cycle-update.md | |
--emu-lib "verilator" \ | |
--top ${{ env.EMU_TOP }} | |
echo >> $GITHUB_STEP_SUMMARY | |
cat ./cycle-update.md >> $GITHUB_STEP_SUMMARY |