-
Notifications
You must be signed in to change notification settings - Fork 4
141 lines (117 loc) · 3.72 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
# yamllint disable rule:line-length
name: build
# yamllint disable rule:truthy
on:
pull_request:
paths-ignore:
- '*.md'
push:
paths-ignore:
- '*.md'
# yamllint enable rule:truthy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
test_x86:
name: Test nim-${{ matrix.nim-version }} / ${{ matrix.runs-on }} / x86_64
runs-on: ${{ matrix.runs-on }}
timeout-minutes: ${{ matrix.timeout-minutes }}
strategy:
fail-fast: false
matrix:
include:
- runs-on: macos-latest
nim-version: 'ref:version-2-0'
sanitize-threads: 'yes'
timeout-minutes: 20
- runs-on: ubuntu-latest
nim-version: 'latest:2.0'
sanitize-threads: 'yes'
timeout-minutes: 5
steps:
# Optimization: re-use cached Nim->C compilation
- name: Restore cache
uses: actions/cache@v3
with:
path: ${HOME}/.cache
key: cache-${{ matrix.runs-on }}-${{ matrix.nim-version }}
- name: Checkout project
uses: actions/checkout@v4
- name: Install Nim
uses: asdf-vm/actions/install@v3
- name: Install dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update -q -y
sudo apt-get -qq install -y clang
- name: Run tests
run: |
export SANITIZE_THREADS
SANITIZE_THREADS=${{ matrix.sanitize-threads }}
. "${HOME}/.asdf/asdf.sh"
asdf local nim ${{ matrix.nim-version }}
nimble develop -y
nimble test
nimble examples
test_non_x86:
name: Test nim-${{ matrix.nim-version }} / debian-buster / ${{ matrix.arch }}
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- arch: aarch64
nim-version: 'ref:version-2-0'
steps:
# Optimization: re-use cached Nim->C compilation
- name: Restore cache
uses: actions/cache@v3
with:
path: ${HOME}/.cache
key: cache-${{ matrix.arch }}-${{ matrix.nim-version }}
- name: Checkout Nim project
uses: actions/checkout@v4
# Install & run tests on non-x86
- uses: uraimo/run-on-arch-action@v2.7.2
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: |
set -uexo pipefail
# Install asdf and dependencies
apt-get update -q -y
apt-get -qq install -y build-essential curl git
git clone https://github.com/asdf-vm/asdf.git \
"${HOME}/.asdf" \
--branch v0.10.2
env: |
SANITIZE_THREADS: no
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -uexo pipefail
. "${HOME}/.asdf/asdf.sh"
# Install asdf-nim and dependencies
echo "::group::Install Nim"
git clone https://github.com/asdf-community/asdf-nim.git \
~/asdf-nim \
--branch main \
--depth 1
asdf plugin add nim ~/asdf-nim
asdf nim install-deps -y
# Install Nim
asdf install nim ${{ matrix.nim-version }}
asdf local nim ${{ matrix.nim-version }}
echo "::endgroup::"
# Run tests
echo "::group::Run tests"
git config --global --add safe.directory ${PWD}
nimble develop -y
nimble test
nimble examples
echo "::endgroup::"