-
Notifications
You must be signed in to change notification settings - Fork 6
209 lines (185 loc) Β· 5.85 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
200
201
202
203
204
205
206
207
208
209
name: CI
on:
schedule:
- cron: '30 5 * * *'
push:
branches:
- main
- v3
- v4
- v5
- v6
pull_request:
branches:
- '*'
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
# Disable the filter on scheduled runs because we don't want to skip those
if: github.event_name != 'schedule'
continue-on-error: true # Makes sure errors won't stop us
runs-on: ubuntu-latest
outputs:
src: ${{ steps.filter.outputs.src }}
steps:
# For PRs the path filter check with Github API, so no need to checkout
# for them.
- if: github.event_name != 'pull_request'
name: Checkout (if not PR)
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
src:
- '**.cfg'
- '**.nims'
- '**.nim'
- '**.nimble'
- 'tests/**'
- '.github/workflows/ci.yml'
build:
# Build if the files we care about are changed.
needs: changes
# Make sure to always run regardless of whether the filter success or not.
# When the filter fails there won't be an output, so checking for `false`
# state is better than checking for `true`.
#
# The always() function here is required for the job to always run despite
# what Github docs said, see: https://github.com/actions/runner/issues/491
if: always() && !cancelled() && needs.changes.outputs.src != 'false'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
compiler:
- name: nim
version: version-2-0
- name: nimskull
version: "*"
# docs: true
name: "${{ matrix.os }} (${{ matrix.compiler.name }} ${{ matrix.compiler.version }})"
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
working-directory: project
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: project
- name: Compiler (nim)
if: matrix.compiler.name == 'nim'
uses: alaviss/[email protected]
with:
path: nim
version: ${{ matrix.compiler.version }}
- name: Compiler (nimskull)
id: nimskull
if: matrix.compiler.name == 'nimskull'
uses: nim-works/[email protected]
with:
nimskull-version: ${{ matrix.compiler.version }}
- name: Fetch Nimble
if: matrix.compiler.name == 'nimskull'
uses: actions/checkout@v4
with:
path: nimble
repository: alaviss/nimble
ref: nimskull
- name: Build Nimble
if: matrix.compiler.name == 'nimskull'
run: |
cd ../nimble
nim c -d:release -o:nimble src/nimble.nim
cp nimble "$NIMSKULL_BIN/nimble"
# Add nimble binary folder to PATH too
echo "$HOME/.nimble/bin" >> $GITHUB_PATH
env:
NIMSKULL_BIN: ${{ steps.nimskull.outputs.bin-path }}
# - name: Valgrind
# shell: bash
# run: |
# sudo apt-get update
# sudo apt install --fix-missing valgrind
- name: Dependencies
run: |
nimble --accept develop
nimble --accept install
env:
NIM: ${{ matrix.compiler.name }}
- name: Tests
run: |
if [[ $NIM == "nim" ]]; then
# test cpp under old nim
balls --path="." --backend:cpp --backend:e
fi
balls --path="." --backend:js --backend:c
# rm spam from the unittest output examples
echo "--hint[Link]:off" >> nim.cfg
echo "--hint[Exec]:off" >> nim.cfg
echo "--hint[Processing]:off" >> nim.cfg
echo "--hint[Conf]:off" >> nim.cfg
echo "--hint[Cc]:off" >> nim.cfg
echo "--hint[ConvFromXtoItselfNotNeeded]:off" >> nim.cfg
echo "--hint[SuccessX]:off" >> nim.cfg
echo "--warning[User]:off" >> nim.cfg
echo "--warning[Deprecated]:off" >> nim.cfg
echo "--define:ballsAuditTimeSpace" >> nim.cfg
echo "--debugger:native" >> nim.cfg
echo "--stacktrace:on" >> nim.cfg
echo "--define:useMalloc" >> nim.cfg
- name: Sample Success
run: |
# inspect success example
nim c --run tests/test.nim
- name: Sample Failure
run: |
# inspect failure example
nim c examples/fails.nim
! examples/fails
- name: Dry Rebuild
run: |
# build a dry version of the runner
echo "--define:ballsDry" >> nim.cfg
nim c balls.nim
- name: Dry Matrix
run: |
# inspect matrix
balls --path="." --backend:js --backend:c
- name: Dry Success
run: |
# inspect unit tests
nim c --run tests/test.nim
- name: Dry Failure
run: |
# inspect failure examples
nim c examples/fails.nim
! examples/fails
# - name: Docs
# if: ${{ matrix.docs }} == 'true'
# shell: bash
# run: |
# cd project
# branch=${{ github.ref }}
# branch=${branch##*/}
# nimble doc --project --path="." --outdir:docs \
# '--git.url:https://github.com/${{ github.repository }}' \
# '--git.commit:${{ github.sha }}' \
# "--git.devel:$branch" \
# balls.nim
# # Ignore failures for older Nim
# cp docs/{the,}index.html || true
#
# - name: Pages
# if: >
# github.event_name == 'push' && github.ref == 'refs/heads/main' &&
# matrix.os == 'ubuntu-latest' && matrix.docs == 'true'
# uses: crazy-max/ghaction-github-pages@v1
# with:
# build_dir: project/docs
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}