-
-
Notifications
You must be signed in to change notification settings - Fork 9
205 lines (170 loc) · 5.5 KB
/
build.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
# yamllint disable rule:line-length
name: build
# yamllint disable rule:truthy
on:
pull_request:
branches: ['*']
paths:
- .github/workflows/build.yml # changes to this file
- bin/** # changes to asdf entrypoint scripts
- lib/** # changes to library functions
- share/** # changes to data files
- shims/** # changes to shim scripts
- test/** # changes to tests
- package*.json # bats upgrade
push:
branches: ['main']
tags: ['*']
paths:
- .github/workflows/build.yml # changes to this file
- bin/** # changes to asdf entrypoint scripts
- lib/** # changes to library functions
- share/** # changes to data files
- shims/** # changes to shim scripts
- test/** # changes to tests
- package*.json # bats upgrade
# yamllint enable rule:truthy
jobs:
# Run tests with bats
bats_tests:
name: Bats tests
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout plugin
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- uses: actions/setup-node@v3
with:
node-version: '15'
- name: Run tests
run: |
npm install --include=dev
[ -n "$(which bats)" ] || npm link bats
npm run test -- --jobs 4
plugin_test_x86:
name: 👑${{ matrix.nim-version }}/${{ matrix.platform }}/x86_64
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Stable binary
- os: ubuntu-latest
nim-version: 'latest:1.6'
platform: linux-glibc
# Stable binary
- os: ubuntu-latest
nim-version: 'latest:1.4'
platform: linux-glibc
# Unstable binary
- os: ubuntu-latest
nim-version: 'ref:version-1-6'
platform: linux-glibc
# Unstable binary
- os: macos-latest
nim-version: 'ref:devel'
platform: macOS
# Build from source
- os: ubuntu-latest
nim-version: 'ref:HEAD'
platform: linux-glibc
# Build from source
- os: macos-latest
nim-version: 'latest:1.4'
platform: macOS
steps:
# Optimization: re-use cached Nim->C compilation
- name: Restore cache
if: matrix.nim-version != 'ref:HEAD' && matrix.nim-version != 'latest'
uses: actions/cache@v3
with:
path: ~/.cache
key: cache-${{ matrix.os }}-${{ matrix.nim-version }}
- name: Upgrade bash
if: runner.os == 'macOS'
run: brew install bash parallel
- name: Install asdf
uses: asdf-vm/actions/setup@v1
- name: Checkout plugin
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- name: Install asdf-nim & test
shell: bash
run: |
set -ueo pipefail
asdf plugin test nim . \
--asdf-tool-version \
"${{ matrix.nim-version }}" \
--asdf-plugin-gitref \
"${GITHUB_SHA}" \
nim -v
# Test musl installation
plugin_test_x86_musl:
name: 👑1.6.8/linux-musl/x86_64
runs-on: ubuntu-latest
container: alpine:latest
steps:
# Optimization: re-use cached Nim->C compilation
- name: Restore cache
uses: actions/cache@v3
with:
path: ~/.cache
key: cache-ubuntu-latest-${{ matrix.nim-version }}
- name: Install dependencies
run: apk add --update --no-cache --upgrade bash git curl coreutils tar xz grep build-base
- name: Test plugin
uses: asdf-vm/actions/plugin-test@v1
with:
command: nim -v
version: 'latest:1.6'
# Test installation for a few non-x86 architectures
plugin_test_non_x86:
name: 👑${{ matrix.nim-version }}/linux-glibc/${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# Unstable binary
- runs-on: ubuntu-latest
nim-version: 'ref:version-1-6'
arch: aarch64
# Unstable binary
- runs-on: ubuntu-latest
nim-version: 'ref:version-1-4'
arch: armv7
steps:
# Optimization: re-use cached Nim->C compilation
- name: Restore cache
uses: actions/cache@v3
with:
path: ~/.cache
key: cache-${{ matrix.arch }}-${{ matrix.nim-version }}
- name: Checkout plugin
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
# Install & run tests on non-x86
- uses: uraimo/run-on-arch-action@v2
name: Install Nim & run tests
with:
arch: ${{ matrix.arch }}
distro: buster
dockerRunArgs: |
--volume "${HOME}/.cache:/root/.cache"
setup: mkdir -p "${HOME}/.cache"
shell: /usr/bin/env bash
install: |
apt-get update -q -y
apt-get -qq install -y curl git xz-utils build-essential
git clone https://github.com/asdf-vm/asdf.git "${HOME}/.asdf"
env: |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -exo pipefail
set +u
. "${HOME}/.asdf/asdf.sh"
asdf plugin test nim . \
--asdf-tool-version \
"${{ matrix.nim-version }}" \
--asdf-plugin-gitref \
"${GITHUB_SHA}" \
nim -v