-
-
Notifications
You must be signed in to change notification settings - Fork 3
245 lines (217 loc) · 6.71 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
name: CI
on:
push:
branches:
- master
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
context:
name: Obtain run context
runs-on: ubuntu-latest
outputs:
should-skip: ${{ steps.skip.outputs.should_skip }}
skip-reason: ${{ steps.skip.outputs.reason }}
skipped-by: ${{ steps.skip.outputs.skipped_by }}
permissions:
actions: read
steps:
- name: Skip duplicate actions
id: skip
uses: fkirc/skip-duplicate-actions@v5.3.1
with:
paths_ignore: '["**/readme.md"]'
build:
needs: context
if: needs.context.outputs.should-skip != 'true' && !cancelled()
strategy:
fail-fast: false
matrix:
compiler:
- name: nim
version: devel
- name: nim
version: version-2-0
- name: nimskull
version: "*"
target: [linux, macos, windows]
arch: [i386, amd64]
include:
- target: linux
builder: ubuntu-20.04
- target: macos
builder: macos-11
- target: windows
builder: windows-2019
- target: windows
arch: i386
winlib_arch: i686
- target: windows
arch: amd64
winlib_arch: x86_64
- target: linux
arch: amd64
compiler:
name: nim
version: devel
uploaddocs: true
# XXX: nimskull hangs forever trying to build docs
- compiler:
name: nimskull
nodocs: true
exclude:
- target: macos
arch: i386
# TODO: nimskull needs fixes for this to work
- target: linux
arch: i386
compiler:
name: nimskull
# TODO: a handful of problems with SSL must be solved before this
- target: windows
compiler:
name: nimskull
name:
${{ matrix.target }} on ${{ matrix.arch }} (${{ matrix.compiler.name }}
${{ matrix.compiler.version }})
runs-on: ${{ matrix.builder }}
defaults:
run:
shell: bash
working-directory: nim-sys
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
with:
path: nim-sys
submodules: "recursive"
- name: Configure Nim for 32 bit GCC (Linux-only)
if: matrix.arch == 'i386' && runner.os == 'Linux'
run: |
sudo apt-fast update -qq
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
--no-install-recommends -yq \
gcc-10-i686-linux-gnu \
g++-10-i686-linux-gnu \
libc6-dev-i386-cross \
libstdc++-10-dev-i386-cross
mkdir -p ~/.config/nim
cat << EOF > ~/.config/nim/nim.cfg
cpu = "i386"
gcc.exe = "i686-linux-gnu-gcc-10"
gcc.cpp.exe = "i686-linux-gnu-g++-10"
gcc.linkerexe = "i686-linux-gnu-gcc-10"
gcc.cpp.linkerexe = "i686-linux-gnu-g++-10"
EOF
- name: Configure target architecture for Windows (i386)
if: matrix.arch == 'i386' && runner.os == 'Windows'
run: |
mkdir -p "$APPDATA/nim"
echo 'cpu = "i386"' >> "$APPDATA/nim/nim.cfg"
- name: Setup GCC (Windows-only)
if: runner.os == 'Windows'
uses: bwoodsend/setup-winlibs-action@v1.15
with:
architecture: ${{ matrix.winlib_arch }}
- name: Setup Nim
if: matrix.compiler.name == 'nim'
uses: alaviss/setup-nim@0.1.1
with:
path: nim
version: ${{ matrix.compiler.version }}
architecture: ${{ matrix.arch }}
- name: Setup nimskull
id: nimskull
if: matrix.compiler.name == 'nimskull'
uses: nim-works/setup-nimskull@0.1.0
with:
nimskull-version: ${{ matrix.compiler.version }}
- name: Fetch nimble source for nimskull
if: matrix.compiler.name == 'nimskull'
uses: actions/checkout@v4.1.1
with:
path: nimble
repository: alaviss/nimble
ref: nimskull
- name: Install nimble for nimskull
if: matrix.compiler.name == 'nimskull'
run: |
nim c -d:release -o:"$NIMSKULL_BIN/nimble" src/nimble.nim
# Add nimble binary folder to PATH
echo "$HOME/.nimble/bin" >> "$GITHUB_PATH"
working-directory: nimble
env:
NIMSKULL_BIN: ${{ steps.nimskull.outputs.bin-path }}
- name: Install dependencies
run: |
nimble install -y --depsOnly
nimble install -y "https://github.com/disruptek/balls@>= 3.9.11 & < 4.0.0"
- name: Run tests
run: balls
- name: Build docs
if: "!matrix.nodocs"
shell: bash
run: |
branch=${{ github.ref }}
branch=${branch##*/}
for i in src/sys/*.nim src/sys/ioqueue/*.nim; do
nimble doc --project --outdir:htmldocs \
'--git.url:https://github.com/${{ github.repository }}' \
'--git.commit:${{ github.sha }}' \
"--git.devel:$branch" \
"$i"
done
# Ignore failures for older Nim
cp htmldocs/{the,}index.html || true
- name: Upload GitHub Pages artifact
if: matrix.uploaddocs
uses: actions/upload-pages-artifact@v3.0.1
with:
path: nim-sys/htmldocs
deploy:
needs:
- build
- context
if: |
github.ref == 'refs/heads/master' &&
success() ||
(!cancelled() &&
!failure() &&
needs.context.outputs.skip-reason == 'skip_after_successful_duplicate')
permissions:
actions: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
name: Deploy docs to GitHub Pages
runs-on: ubuntu-latest
steps:
- name: Download github-pages artifact
if:
needs.context.outputs.skip-reason == 'skip_after_successful_duplicate'
uses: actions/download-artifact@v4.1.2
with:
name: github-pages
path: page
run-id: ${{ fromJson(needs.context.outputs.skipped-by).id }}
github-token: ${{ github.token }}
- name: Upload pages artifact
if:
needs.context.outputs.skip-reason == 'skip_after_successful_duplicate'
uses: actions/upload-pages-artifact@v3.0.1
with:
path: page
- name: Deploy page
id: deployment
uses: actions/deploy-pages@v4.0.4
passed:
needs: build
if: failure() || cancelled()
name: All tests passed
runs-on: ubuntu-latest
steps:
- run: exit 1