From cde1eb52eec3fb65223b05fbf8d41485203a75d3 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/t1rocket.yml | 10 +++++----- .github/workflows/vcs.yml | 8 ++++---- script/ci/src/Main.scala | 25 ++++++++++--------------- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/.github/workflows/t1rocket.yml b/.github/workflows/t1rocket.yml index a5b24f4f0b..ab55e31887 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: @@ -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/vcs.yml b/.github/workflows/vcs.yml index 1b36c6c2f9..52ca5d0af3 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/script/ci/src/Main.scala b/script/ci/src/Main.scala index 37244550af..b73de2a6cc 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