commit 5ce26af2c37730a9add3aed54e82824f67aa7e4b
parent 2c3db9fcef4beecff3dfb63ac5e09f772ce70a80
Author: Bradley Gannon <bradley@bradleygannon.com>
Date: Sat, 29 Nov 2025 21:27:53 -0500
Add better CI, updated .gitignore, add scalafmt as sbt plugin
Diffstat:
6 files changed, 89 insertions(+), 41 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
@@ -0,0 +1,77 @@
+name: CI
+
+on:
+ push:
+ pull_request:
+
+jobs:
+ build-test-generate:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Set up JDK
+ uses: actions/setup-java@v4
+ with:
+ distribution: temurin
+ java-version: 21
+
+ - name: Install sbt
+ run: |
+ sudo apt-get update
+ sudo apt-get install apt-transport-https curl gnupg -yqq
+ echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
+ echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
+ curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo -H gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import
+ sudo chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg
+ sudo apt-get update
+ sudo apt-get install -y sbt
+
+ - name: Cache sbt
+ uses: actions/cache@v4
+ with:
+ path: |
+ ~/.ivy2/cache
+ ~/.sbt
+ ~/.cache/coursier
+ key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt', '**/project/**') }}
+ restore-keys: |
+ ${{ runner.os }}-sbt-
+
+ - name: Install Verilator
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y verilator
+
+ # Ensure sbt & scalafmt plugins are resolved (if needed)
+ - name: sbt update
+ run: sbt update
+
+ - name: Check scalafmt
+ run: |
+ # This assumes you have sbt-scalafmt configured in project/plugins.sbt
+ sbt scalafmtAll
+ # Fail if scalafmt caused changes
+ if ! git diff --quiet **/*.scala; then
+ echo "Code is not scalafmt-formatted. Run 'sbt scalafmtAll' locally."
+ exit 1
+ fi
+
+ - name: Run tests
+ run: sbt test
+
+ - name: Run main (generate Perilus.sv)
+ run: |
+ sbt run
+ if [ ! -f Perilus.sv ]; then
+ echo "Perilus.sv was not generated by sbt run"
+ exit 1
+ fi
+
+ - name: Upload Perilus.sv artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: Perilus-sv
+ path: Perilus.sv
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
@@ -1,33 +0,0 @@
-name: Continuous Integration
-
-on:
- push:
- tags: ['*']
- branches: ['main']
- pull_request:
- workflow_dispatch:
-
-jobs:
- ci:
- name: ci
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- - name: Cleanup
- run: sed -i "s/%NAME%/test/g" build.mill
- - name: Cache Scala
- uses: coursier/cache-action@v6
- - name: Setup Scala
- uses: coursier/setup-action@v1
- with:
- jvm: adopt:11
- apps: sbt
- - name: Setup Dependencies
- run: |
- sudo apt-get install verilator
- verilator --version
- - name: SBT Test
- run: sbt test
- - name: mill Test
- run: ./mill _.test
diff --git a/.gitignore b/.gitignore
@@ -1,10 +1,12 @@
*.sv
*.v
-.bloop
-.bsp
-.metals
-.scala-build
-build
+.bloop/
+.bsp/
+.metals/
+.scala-build/
+build/
filelist.f
-project
-target
+project/metals.sbt
+project/project/
+project/target/
+target/
diff --git a/project/build.properties b/project/build.properties
@@ -0,0 +1 @@
+sbt.version=1.10.11
diff --git a/project/plugins.sbt b/project/plugins.sbt
@@ -0,0 +1 @@
+addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.6")
diff --git a/shell.nix b/shell.nix
@@ -5,10 +5,10 @@ in
pkgs.mkShellNoCC {
packages = with pkgs; [
+ act
jdk21
metals
sbt
- scalafmt
verilator
];
}