-
Notifications
You must be signed in to change notification settings - Fork 6
199 lines (165 loc) · 5.41 KB
/
ci.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: NITTA Build and Test
on:
pull_request:
push:
branches: master
env:
GH_PAGES_DIR: gh-pages
jobs:
notify-about-push:
runs-on: ubuntu-latest
steps:
- name: Send msg on push
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: html
args: |
Repository: <strong>${{ github.event.repository.full_name }}</strong>
Ref: <strong>${{ github.ref }}</strong>
Event: <strong>${{ github.event_name }}</strong>
Info: ${{ github.event.pull_request.title }}
${{ github.event.pull_request.html_url }}
nitta-haskell-deps:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- name: Cache haskell-stack
uses: actions/cache@v3.2.5
with:
path: |
~/.stack
.stack-work
/home/runner/.local/bin
key: ${{ runner.os }}-haskell-stack-${{ hashFiles('**/stack.yaml', '**/package.yaml') }}
- name: Install haskell-stack
uses: haskell/actions/setup@v2.4.3
with:
enable-stack: true
stack-no-global: true
stack-version: "latest"
- name: Build nitta backend dependencies and doctest
run: |
stack build --haddock --test --only-dependencies
stack install doctest
- name: Install weeder
run: stack install weeder-2.4.1
nitta:
runs-on: ubuntu-latest
needs: nitta-haskell-deps
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- name: Cache haskell-stack
uses: actions/cache@v3.2.5
with:
path: |
~/.stack
.stack-work
/home/runner/.local/bin
key: ${{ runner.os }}-haskell-stack-${{ hashFiles('**/stack.yaml', '**/package.yaml') }}
- name: Install haskell-stack
uses: haskell/actions/setup@v2.3.3
with:
enable-stack: true
stack-no-global: true
stack-version: "latest"
- name: Install Icarus Verilog
run: sudo apt-get install iverilog
- name: Build & test nitta backend
run: stack build --haddock --no-haddock-deps --test --keep-going --test-suite-timeout 600 --copy-bins --coverage
- name: Generate test coverage report
run: stack hpc report nitta
- name: Check examples by doctest
run: find src -name '*.hs' -exec grep -l '>>>' {} \; | xargs -t -L 1 -P 4 stack exec doctest
- name: Generate backend API
run: stack exec nitta-api-gen -- -v
- name: Cache node_modules
uses: actions/cache@v3.2.5
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Build nitta frontend dependencies
working-directory: ./web
run: yarn install
- name: Build frontend
working-directory: ./web
timeout-minutes: 5
run: yarn build
- name: Run weeder
run: weeder
- name: Copy doc to GH_PAGES_DIR
run: |
mkdir -p "${{ env.GH_PAGES_DIR }}/haddock/"
cp -r $(stack path --dist-dir)/doc/html/nitta "$_"
- name: Copy test coverage to GH_PAGES_DIR
run: cp -r $(stack path --local-hpc-root)/combined/custom ${{ env.GH_PAGES_DIR }}/hpc
- name: Copy API doc to GH_PAGES_DIR
run: |
mkdir -p "${{ env.GH_PAGES_DIR }}/rest-api/"
cp ./web/src/services/gen/rest_api.markdown "$_"
- name: Copy README.md to GH_PAGES_DIR
run: cp README.md ${{ env.GH_PAGES_DIR }}/
- name: Publish generated content to GitHub Pages
if: ${{ github.ref == 'refs/heads/master'}}
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
folder: ${{ env.GH_PAGES_DIR }}
branch: gh-pages
verilog-formatting:
timeout-minutes: 5
runs-on: ubuntu-latest
container: ryukzak/alpine-iverilog
defaults:
run:
shell: sh
steps:
- uses: actions/checkout@v3
- run: |
make -C hdl > make_hdl.log
cat make_hdl.log
test "$(grep -ci error make_hdl.log)" -eq 0
haskell-lint:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Set up HLint"
uses: haskell/actions/hlint-setup@v2.3.3
with:
version: "3.5"
- name: "Run HLint"
uses: haskell/actions/hlint-run@v2.3.3
with:
path: .
fail-on: suggestion
haskell-formatting:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check formatting
uses: fourmolu/fourmolu-action@v8 # fourmolu-0.12.0.0
typescript-formatting:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check ts and tsx code style by prettier
working-directory: ./web
run: |
yarn add -s prettier
yarn exec -s prettier -- --check src/**/*.{ts,tsx}
markdown-formatting:
timeout-minutes: 5
runs-on: ubuntu-22.04
steps:
- name: Check out repository code
uses: actions/checkout@v3.2.0
- name: Run mdl for check markdown format
uses: nosborn/github-action-markdown-cli@v3.3.0
with:
files: .
config_file: .markdownlint.yaml