From b021ea1400cc2b998d48a2cc16e717b792adf248 Mon Sep 17 00:00:00 2001 From: Avimitin Date: Sat, 12 Oct 2024 19:38:10 +0800 Subject: [PATCH] [ci] fix CI script to use latest nix structure Signed-off-by: Avimitin --- .github/workflows/pd.yml | 19 +++++++++++-------- .github/workflows/t1rocket.yml | 12 ++++++------ .github/workflows/trace.yml | 3 ++- .github/workflows/vcs.yml | 8 ++++---- .github/workflows/verilator.yml | 8 ++++---- difftest/default.nix | 2 +- script/ci/src/Main.scala | 25 ++++++++++--------------- 7 files changed, 38 insertions(+), 39 deletions(-) diff --git a/.github/workflows/pd.yml b/.github/workflows/pd.yml index 8b8af45db..b152176be 100644 --- a/.github/workflows/pd.yml +++ b/.github/workflows/pd.yml @@ -28,15 +28,18 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: "Test elaborate" run: | - configArray=( $(ls configgen/generated | sed 's/\.json$//') ) + configArray=( $(ls .github/designs) ) + ipArray=( "t1emu" "t1rocketemu" ) for cfg in "${configArray[@]}"; do - echo "Building .#t1.${cfg}.ip.rtl" - if ! nix build ".#t1.${cfg}.ip.rtl" -L; then - failed_rtl_configs+=("${cfg}.ip") - fi - if ! nix run ".#ci-helper" -- runOMTests --config ${cfg}; then - failed_om+=("${cfg}") - fi + for ip in "${ipArray[@]}"; do + echo "Building .#t1.${cfg}.${ip}.rtl" + if ! nix build ".#t1.${cfg}.${ip}.rtl" -L; then + failed_rtl_configs+=("${cfg}.${ip}") + fi + if ! nix run ".#ci-helper" -- runOMTests --config ${cfg}; then + failed_om+=("${cfg}") + fi + done done if [ -n "${failed_rtl_configs[*]}" ]; then echo -e "## Failed RTL\n" >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/workflows/t1rocket.yml b/.github/workflows/t1rocket.yml index a5b24f4f0..92945dfdd 100644 --- a/.github/workflows/t1rocket.yml +++ b/.github/workflows/t1rocket.yml @@ -1,4 +1,4 @@ -name: VCS Test (T1 w/ Rocket) +name: T1 Rocket VCS Emulator Test on: pull_request: types: @@ -27,7 +27,7 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} - id: "get-all-configs" - run: echo "out=$(nix run .#ci-helper -- generateTestPlan --testType t1rocket)" > $GITHUB_OUTPUT + run: echo "out=$(nix run .#ci-helper -- generateTestPlan)" > $GITHUB_OUTPUT build-emulators: name: "Build VCS Emulators w/ Rocket" @@ -42,10 +42,10 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: "Build vcs emulator" run: | - nix build '.#t1.${{ matrix.config }}.ip.vcs-emu' --impure --no-link --cores 64 + nix build '.#t1.${{ matrix.config }}.t1rocketemu.vcs-emu' --impure --no-link - name: "Build all testcases" run: | - nix build ".#t1.${{ matrix.config }}.ip.cases._all" --max-jobs auto --no-link --cores 64 + nix build ".#t1.${{ matrix.config }}.t1rocketemu.cases._all" --max-jobs auto --no-link --cores 64 gen-matrix: name: "Prepare for running testcases" @@ -66,7 +66,7 @@ jobs: name: "Generate test matrix" run: | echo -n matrix= >> "$GITHUB_OUTPUT" - nix run ".#ci-helper" -- generateCiMatrix --caseDir t1rocket-cases --runnersAmount "$RUNNERS" >> "$GITHUB_OUTPUT" + nix run ".#ci-helper" -- generateCiMatrix --runnersAmount "$RUNNERS" >> "$GITHUB_OUTPUT" run-testcases: name: "Run VCS w/ Rocket" @@ -81,7 +81,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: "Run testcases" run: | - nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}" --testType "vcs" + nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}" --testType "vcs" --testIp "t1rocketemu" report: name: "Report VCS (w/ Rocket) CI result" diff --git a/.github/workflows/trace.yml b/.github/workflows/trace.yml index a7efb8e16..f153aeba5 100644 --- a/.github/workflows/trace.yml +++ b/.github/workflows/trace.yml @@ -42,4 +42,5 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: "Build vcs emulator" run: | - nix build '.#t1.${{ matrix.config }}.ip.vcs-emu-trace' --impure --no-link --cores 64 \ No newline at end of file + nix build '.#t1.${{ matrix.config }}.t1emu.vcs-emu-trace' --impure --no-link --cores 64 + nix build '.#t1.${{ matrix.config }}.t1rocketemu.vcs-emu-trace' --impure --no-link --cores 64 diff --git a/.github/workflows/vcs.yml b/.github/workflows/vcs.yml index 1b36c6c2f..52ca5d0af 100644 --- a/.github/workflows/vcs.yml +++ b/.github/workflows/vcs.yml @@ -1,4 +1,4 @@ -name: VCS Test +name: T1 VCS Emulator Test on: pull_request: types: @@ -42,10 +42,10 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: "Build vcs emulator" run: | - nix build '.#t1.${{ matrix.config }}.ip.vcs-emu' --impure --no-link --cores 64 + nix build '.#t1.${{ matrix.config }}.t1emu.vcs-emu' --impure --no-link - name: "Build all testcases" run: | - nix build ".#t1.${{ matrix.config }}.ip.cases._all" --max-jobs auto --no-link --cores 64 + nix build ".#t1.${{ matrix.config }}.t1emu.cases._all" --max-jobs auto --no-link --cores 64 gen-matrix: name: "Prepare for running testcases" @@ -81,7 +81,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: "Run testcases" run: | - nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}" --testType "vcs" + nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}" --testType "vcs" --testIp "t1emu" report: name: "Report VCS CI result" diff --git a/.github/workflows/verilator.yml b/.github/workflows/verilator.yml index cfe7eb774..18362566c 100644 --- a/.github/workflows/verilator.yml +++ b/.github/workflows/verilator.yml @@ -30,11 +30,11 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: "Build verilator emulator" run: | - nix build '.#t1.${{ matrix.config }}.ip.verilator-emu' -L --no-link --cores 64 + nix build '.#t1.${{ matrix.config }}.t1emu.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 }}.ip.cases._all" --max-jobs auto -L --no-link --cores 64 + nix build ".#t1.${{ matrix.config }}.t1emu.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 +49,7 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} - name: "Build verilator emulator with trace" - run: nix build '.#t1.${{ matrix.config }}.ip.verilator-emu-trace' -L --no-link --cores 64 + run: nix build '.#t1.${{ matrix.config }}.t1emu.verilator-emu-trace' -L --no-link --cores 64 gen-matrix: name: "Prepare for running testcases" @@ -85,7 +85,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: "Run testcases" run: | - nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}" + nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}" --testType "verilator" --testIp "t1emu" report: name: "Report CI result" diff --git a/difftest/default.nix b/difftest/default.nix index dc6667e52..dc7f760d0 100644 --- a/difftest/default.nix +++ b/difftest/default.nix @@ -15,7 +15,7 @@ assert let available = [ "dpi_t1emu" "dpi_t1rocketemu" "offline_t1emu" "offline_t1rocketemu" ]; in -lib.assertMsg (lib.elem moduleType available) "emuType is not in ${lib.concatStringsSep ", " available}"; +lib.assertMsg (lib.elem moduleType available) "moduleType is not in ${lib.concatStringsSep ", " available}"; # if emuType is empty, then moduleType must be offline-*, or user should give valid emuType assert lib.assertMsg ((emuType == "" && lib.hasPrefix "offline" moduleType) || (lib.elem emuType [ "verilator" "vcs" ])) "emuType is either 'vcs' nor 'verilator'"; diff --git a/script/ci/src/Main.scala b/script/ci/src/Main.scala index 37244550a..b73de2a6c 100644 --- a/script/ci/src/Main.scala +++ b/script/ci/src/Main.scala @@ -125,7 +125,7 @@ object Main: @main def generateCiMatrix( runnersAmount: Int, - caseDir: String = "cases", + caseDir: String = "designs", testPlanFile: String = "default.json" ) = { val testPlans = @@ -145,7 +145,8 @@ object Main: @main def runTests( jobs: String, - testType: String = "verilator" + testIp: String, + testType: String ): Unit = if jobs == "" then Logger.info("No test found, exiting") @@ -162,8 +163,8 @@ object Main: val testAttr = testType.toLowerCase() match case "verilator" => - s".#t1.$config.ip.run.$caseName.verilator-emu" - case "vcs" => s".#t1.$config.ip.run.$caseName.vcs-emu" + s".#t1.$config.$testIp.run.$caseName.verilator-emu" + case "vcs" => s".#t1.$config.$testIp.run.$caseName.vcs-emu" case _ => Logger.fatal(s"Invalid test type ${testType}") val testResultPath = try @@ -308,17 +309,11 @@ object Main: end postCI @main - def generateTestPlan(testType: String = "") = - val casePath = testType match - case "t1rocket" => os.pwd / ".github" / "t1rocket-cases" - case _ => os.pwd / ".github" / "cases" - - val allCases = os.walk(casePath).filter(_.last == "default.json") - val testPlans = allCases.map: caseFilePath => - caseFilePath.segments - .dropWhile(!Seq("cases", "t1rocket-cases").contains(_)) - .drop(1) - .next + def generateTestPlan() = + val testPlans = os + .walk(os.pwd / ".github" / "designs") + .filter(_.last == "default.json") + .map(path => path.segments.toSeq.reverse.drop(1).head) println(ujson.write(Map("config" -> testPlans))) end generateTestPlan