-
Notifications
You must be signed in to change notification settings - Fork 22
77 lines (70 loc) · 2.19 KB
/
lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Code linting
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
- labeled
env:
USER: runner
# Cancel the current workflow when new commit pushed
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
checkfmt:
name: "Check formats"
strategy:
fail-fast: false
runs-on: [self-hosted, linux, nixos]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: "Run testcases"
run: |
ALL_PASS=0
nix develop '.#t1.elaborator' -c mill -i _.reformat
if ! git diff -q --exit-code; then
msg="* Scala format fail, please run 'nix develop '.#t1.elaborator' -c mill -i _.reformat'"
echo "$msg"
echo "$msg" >> $GITHUB_STEP_SUMMARY
git reset --hard
fi
nix fmt
if ! git diff -q --exit-code; then
msg="* Nix format fail, please run 'nix fmt'"
echo "$msg"
echo "$msg" >> $GITHUB_STEP_SUMMARY
git reset --hard
fi
pushd difftest
nix run '.#cargo' -- format
if ! git diff -q --exit-code; then
msg="* Cargo format fail, please run 'cd difftest; nix run .#cargo -- format'"
echo "$msg"
echo "$msg" >> $GITHUB_STEP_SUMMARY
git reset --hard
fi
popd
pushd t1rocketemu
nix run '.#cargo' -- format
if ! git diff -q --exit-code; then
msg="* Cargo format fail, please run 'cd t1rocketemu; nix run .#cargo -- format'"
echo "$msg"
echo "$msg" >> $GITHUB_STEP_SUMMARY
git reset --hard
fi
popd
if nix run '.#rg' -- '\p{Script=Han}' > zh-hans.txt; then
msg="* Found ZH_CN comments"
echo "$msg"
echo "$msg" >> $GITHUB_STEP_SUMMARY
echo "```text" >> $GITHUB_STEP_SUMMARY
cat zh-hans.txt >> $GITHUB_STEP_SUMMARY
echo "```" >> $GITHUB_STEP_SUMMARY
git reset --hard
fi