Skip to content

Commit c117dee

Browse files
committed
[ci] add checkfmt for PRs
Signed-off-by: unlsycn <[email protected]>
1 parent cb2af5c commit c117dee

File tree

4 files changed

+54
-2
lines changed

4 files changed

+54
-2
lines changed

.github/workflows/checkfmt.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Check the format of a PR
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- synchronize
7+
- reopened
8+
- ready_for_review
9+
- labeled
10+
env:
11+
USER: runner
12+
13+
# Cancel the current workflow when new commit pushed
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
20+
check-format:
21+
name: "Check format"
22+
runs-on: [self-hosted, linux, nixos]
23+
strategy:
24+
fail-fast: false
25+
defaults:
26+
run:
27+
working-directory: ./templates/chisel
28+
steps:
29+
- uses: actions/checkout@v4
30+
with:
31+
ref: ${{ github.event.pull_request.head.sha }}
32+
- name: "Check Scala format"
33+
run: |
34+
nix develop -c bash -c 'mill gcd.checkFormat && mill elaborator.checkFormat'
35+
- name: "Check Rust format"
36+
run: |
37+
cd gcdemu
38+
nix develop -c cargo fmt --check
39+
cd ..
40+
- name: "Check nix format"
41+
run: |
42+
nix fmt -- --check nix flake.nix
43+

templates/chisel/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
.bloop
22
.bsp
3+
.jvm-opts
4+
.mill-jvm-opts
35
.metals/
46
.vscode/
7+
58
out/
69
result*
10+
gcd-sim-result/
711
/dependencies/
812
target/
13+
14+
*.vcd
15+
*.fst
16+
*.fsdb
17+
*.log

templates/chisel/.scalafmt.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ lineEndings = preserve
1010
includeCurlyBraceInSelectChains = false
1111
danglingParentheses.preset = true
1212

13-
align.tokens.add = [
13+
align.tokens."+" = [
1414
{
1515
code = ":"
1616
}

templates/chisel/build.sc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ trait GCD extends millbuild.common.HasChisel with ScalafmtModule {
3737
}
3838

3939
object elaborator extends Elaborator
40-
trait Elaborator extends millbuild.common.ElaboratorModule {
40+
trait Elaborator extends millbuild.common.ElaboratorModule with ScalafmtModule {
4141
def scalaVersion = T(deps.scalaVer)
4242

4343
def panamaconverterModule = panamaconverter

0 commit comments

Comments
 (0)