-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci] add multiple top support for emulator tests
Signed-off-by: Avimitin <[email protected]>
- Loading branch information
Showing
5 changed files
with
98 additions
and
52 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Current test flow | ||
----------------- | ||
|
||
```mermaid | ||
stateDiagram-v2 | ||
state "GitHub CI Action" as github_ci | ||
state generateTestPlan { | ||
state "read .github/designs/**/*.json" as read_config | ||
state "parse config info" as parse_config | ||
read_config --> parse_config | ||
} | ||
parse_config --> github_ci | ||
state "Build emulator before test" as prebuild_emulator | ||
github_ci --> prebuild_emulator | ||
state "Generate test matrix" as generate_matrix | ||
prebuild_emulator --> generate_matrix | ||
generate_matrix --> github_ci | ||
state "Dispatch tests to machine" as run_test | ||
github_ci --> run_test | ||
state "Collect results" as report | ||
run_test --> report | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: T1 Rocket VCS Emulator Test | ||
name: T1RocketEmu VCS Test | ||
on: | ||
pull_request: | ||
types: | ||
|
@@ -9,6 +9,7 @@ on: | |
- labeled | ||
env: | ||
USER: runner | ||
EMU_TOP: t1rocketemu | ||
|
||
# Cancel the current workflow when new commit pushed | ||
concurrency: | ||
|
@@ -27,10 +28,10 @@ jobs: | |
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- id: "get-all-configs" | ||
run: echo "out=$(nix run .#ci-helper -- generateTestPlan)" > $GITHUB_OUTPUT | ||
run: echo "out=$(nix run .#ci-helper -- generateTestPlan --top ${{ env.EMU_TOP }})" > $GITHUB_OUTPUT | ||
|
||
build-emulators: | ||
name: "Build VCS Emulators w/ Rocket" | ||
name: "Build VCS Emulators" | ||
needs: [gen-test-plan] | ||
runs-on: [self-hosted, linux, nixos, BIGRAM] | ||
strategy: | ||
|
@@ -42,10 +43,10 @@ jobs: | |
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: "Build vcs emulator" | ||
run: | | ||
nix build '.#t1.${{ matrix.config }}.t1rocketemu.vcs-emu' --impure --no-link | ||
nix build '.#t1.${{ matrix.config }}.${{ env.EMU_TOP }}.vcs-emu' --impure --no-link | ||
- name: "Build all testcases" | ||
run: | | ||
nix build ".#t1.${{ matrix.config }}.t1rocketemu.cases._all" --max-jobs auto --no-link --cores 64 | ||
nix build ".#t1.${{ matrix.config }}.${{ env.EMU_TOP }}.cases._all" --max-jobs auto --no-link --cores 64 | ||
gen-matrix: | ||
name: "Prepare for running testcases" | ||
|
@@ -66,10 +67,10 @@ jobs: | |
name: "Generate test matrix" | ||
run: | | ||
echo -n matrix= >> "$GITHUB_OUTPUT" | ||
nix run ".#ci-helper" -- generateCiMatrix --runnersAmount "$RUNNERS" >> "$GITHUB_OUTPUT" | ||
nix run ".#ci-helper" -- generateCiMatrix --top ${{ env.EMU_TOP }} --runnersAmount "$RUNNERS" >> "$GITHUB_OUTPUT" | ||
run-testcases: | ||
name: "Run VCS w/ Rocket" | ||
name: "Run VCS" | ||
needs: [gen-matrix] | ||
strategy: | ||
fail-fast: false | ||
|
@@ -81,10 +82,10 @@ jobs: | |
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: "Run testcases" | ||
run: | | ||
nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}" --testType "vcs" --testIp "t1rocketemu" | ||
nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}" --emuLib "vcs" --top ${{ env.EMU_TOP }} | ||
report: | ||
name: "Report VCS (w/ Rocket) CI result" | ||
name: "Report VCS 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 ) | ||
|
@@ -101,23 +102,26 @@ jobs: | |
- name: "Print step summary" | ||
run: | | ||
nix run ".#ci-helper" -- postCI \ | ||
--case-dir t1rocket-cases \ | ||
--failed-tests-file-path ./failed-tests.md \ | ||
--urg-report-file-path ./urg-report.md \ | ||
--cycle-update-file-path ./cycle-update.md \ | ||
--emu-type vcs | ||
cat ./failed-tests.md >> $GITHUB_STEP_SUMMARY | ||
--failed-tests-file-path ./failed-tests.md \ | ||
--emu-lib "vcs" \ | ||
--top ${{ env.EMU_TOP }} | ||
cat ./urg-report.md >> $GITHUB_STEP_SUMMARY | ||
echo >> $GITHUB_STEP_SUMMARY | ||
cat ./cycle-update.md >> $GITHUB_STEP_SUMMARY | ||
echo >> $GITHUB_STEP_SUMMARY | ||
cat ./failed-tests.md >> $GITHUB_STEP_SUMMARY | ||
- name: "Commit cycle updates" | ||
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
changed_cases=$(git diff --name-only '.github/**/default.json') | ||
changed_cases=$(git diff --name-only '.github/designs/**/*.json') | ||
if [ -n "$changed_cases" ]; then | ||
echo "changed cases: $changed_cases" | ||
git add '.github/**/default.json' | ||
git commit -m "[ci] update t1rocket test case cycle data" | ||
git commit -m "[ci] update t1 test case cycle data" | ||
git push origin ${{ github.head_ref }} | ||
else | ||
echo "No cycle change detect" | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: T1 VCS Emulator Test | ||
name: T1Emu VCS Test | ||
on: | ||
pull_request: | ||
types: | ||
|
@@ -9,6 +9,7 @@ on: | |
- labeled | ||
env: | ||
USER: runner | ||
EMU_TOP: t1emu | ||
|
||
# Cancel the current workflow when new commit pushed | ||
concurrency: | ||
|
@@ -27,7 +28,7 @@ jobs: | |
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- id: "get-all-configs" | ||
run: echo "out=$(nix run .#ci-helper generateTestPlan)" > $GITHUB_OUTPUT | ||
run: echo "out=$(nix run .#ci-helper -- generateTestPlan --top ${{ env.EMU_TOP }})" > $GITHUB_OUTPUT | ||
|
||
build-emulators: | ||
name: "Build VCS Emulators" | ||
|
@@ -42,10 +43,10 @@ jobs: | |
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: "Build vcs emulator" | ||
run: | | ||
nix build '.#t1.${{ matrix.config }}.t1emu.vcs-emu' --impure --no-link | ||
nix build '.#t1.${{ matrix.config }}.${{ env.EMU_TOP }}.vcs-emu' --impure --no-link | ||
- name: "Build all testcases" | ||
run: | | ||
nix build ".#t1.${{ matrix.config }}.t1emu.cases._all" --max-jobs auto --no-link --cores 64 | ||
nix build ".#t1.${{ matrix.config }}.${{ env.EMU_TOP }}.cases._all" --max-jobs auto --no-link --cores 64 | ||
gen-matrix: | ||
name: "Prepare for running testcases" | ||
|
@@ -66,7 +67,7 @@ jobs: | |
name: "Generate test matrix" | ||
run: | | ||
echo -n matrix= >> "$GITHUB_OUTPUT" | ||
nix run ".#ci-helper" -- generateCiMatrix --runnersAmount "$RUNNERS" >> "$GITHUB_OUTPUT" | ||
nix run ".#ci-helper" -- generateCiMatrix --top ${{ env.EMU_TOP }} --runnersAmount "$RUNNERS" >> "$GITHUB_OUTPUT" | ||
run-testcases: | ||
name: "Run VCS" | ||
|
@@ -81,7 +82,7 @@ jobs: | |
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: "Run testcases" | ||
run: | | ||
nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}" --testType "vcs" --testIp "t1emu" | ||
nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}" --emuLib "vcs" --top ${{ env.EMU_TOP }} | ||
report: | ||
name: "Report VCS CI result" | ||
|
@@ -104,7 +105,8 @@ jobs: | |
--urg-report-file-path ./urg-report.md \ | ||
--cycle-update-file-path ./cycle-update.md \ | ||
--failed-tests-file-path ./failed-tests.md \ | ||
--emu-type vcs | ||
--emu-lib "vcs" \ | ||
--top ${{ env.EMU_TOP }} | ||
cat ./urg-report.md >> $GITHUB_STEP_SUMMARY | ||
echo >> $GITHUB_STEP_SUMMARY | ||
cat ./cycle-update.md >> $GITHUB_STEP_SUMMARY | ||
|
@@ -114,7 +116,7 @@ jobs: | |
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
changed_cases=$(git diff --name-only '.github/**/default.json') | ||
changed_cases=$(git diff --name-only '.github/designs/**/*.json') | ||
if [ -n "$changed_cases" ]; then | ||
echo "changed cases: $changed_cases" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
name: Verilator Daily Regression | ||
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" | ||
|
@@ -15,7 +18,7 @@ jobs: | |
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- id: "get-all-configs" | ||
run: echo "out=$(nix run .#ci-helper generateTestPlan)" > $GITHUB_OUTPUT | ||
run: echo "out=$(nix run .#ci-helper -- generateTestPlan --top ${{ env.EMU_TOP }})" > $GITHUB_OUTPUT | ||
|
||
build-verilator-emulators: | ||
name: "Build Verilator Emulators" | ||
|
@@ -30,11 +33,11 @@ jobs: | |
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: "Build verilator emulator" | ||
run: | | ||
nix build '.#t1.${{ matrix.config }}.t1emu.verilator-emu' -L --no-link --cores 64 | ||
nix build '.#t1.${{ matrix.config }}.${{ env.EMU_TOP }}.verilator-emu' -L --no-link --cores 64 | ||
- name: "Build all testcases" | ||
run: | | ||
# Build testcases with vlen 1024 and vlen 4096 | ||
nix build ".#t1.${{ matrix.config }}.t1emu.cases._all" --max-jobs auto -L --no-link --cores 64 | ||
nix build ".#t1.${{ matrix.config }}.${{ env.EMU_TOP }}.cases._all" --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: | ||
|
@@ -49,7 +52,7 @@ jobs: | |
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: "Build verilator emulator with trace" | ||
run: nix build '.#t1.${{ matrix.config }}.t1emu.verilator-emu-trace' -L --no-link --cores 64 | ||
run: nix build '.#t1.${{ matrix.config }}.${{ env.EMU_TOP }}.verilator-emu-trace' -L --no-link --cores 64 | ||
|
||
gen-matrix: | ||
name: "Prepare for running testcases" | ||
|
@@ -70,7 +73,7 @@ jobs: | |
name: "Generate test matrix" | ||
run: | | ||
echo -n matrix= >> "$GITHUB_OUTPUT" | ||
nix run ".#ci-helper" -- generateCiMatrix --runnersAmount "$RUNNERS" >> "$GITHUB_OUTPUT" | ||
nix run ".#ci-helper" -- generateCiMatrix --top ${{ env.EMU_TOP }} --runnersAmount "$RUNNERS" >> "$GITHUB_OUTPUT" | ||
run-testcases: | ||
name: "Run testcases" | ||
|
@@ -85,7 +88,7 @@ jobs: | |
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: "Run testcases" | ||
run: | | ||
nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}" --testType "verilator" --testIp "t1emu" | ||
nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}" --emuLib "verilator" --top ${{ env.EMU_TOP }} | ||
report: | ||
name: "Report CI result" | ||
|
@@ -107,20 +110,8 @@ jobs: | |
nix run ".#ci-helper" -- postCI \ | ||
--failed-tests-file-path ./failed-tests.md \ | ||
--cycle-update-file-path ./cycle-update.md | ||
--emu-lib "verilator" \ | ||
--top ${{ env.EMU_TOP }} | ||
cat ./failed-tests.md >> $GITHUB_STEP_SUMMARY | ||
echo >> $GITHUB_STEP_SUMMARY | ||
cat ./cycle-update.md >> $GITHUB_STEP_SUMMARY | ||
- name: "Commit cycle updates" | ||
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
changed_cases=$(git diff --name-only '.github/**/default.json') | ||
if [ -n "$changed_cases" ]; then | ||
echo "changed cases: $changed_cases" | ||
git add '.github/**/default.json' | ||
git commit -m "[ci] update test case cycle data" | ||
git push origin ${{ github.head_ref }} | ||
else | ||
echo "No cycle change detect" | ||
fi |