Skip to content

Commit

Permalink
[ci] fix CI script to use latest nix structure
Browse files Browse the repository at this point in the history
Signed-off-by: Avimitin <[email protected]>
  • Loading branch information
Avimitin committed Oct 12, 2024
1 parent 7493b42 commit cde1eb5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 24 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/t1rocket.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: VCS Test (T1 w/ Rocket)
name: T1 Rocket VCS Emulator Test
on:
pull_request:
types:
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/vcs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: VCS Test
name: T1 VCS Emulator Test
on:
pull_request:
types:
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
25 changes: 10 additions & 15 deletions script/ci/src/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ object Main:
@main
def generateCiMatrix(
runnersAmount: Int,
caseDir: String = "cases",
caseDir: String = "designs",
testPlanFile: String = "default.json"
) = {
val testPlans =
Expand All @@ -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")
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cde1eb5

Please sign in to comment.