Skip to content

Commit 70cbe34

Browse files
authored
use the common CI workflow (#561)
1 parent 03f4328 commit 70cbe34

File tree

1 file changed

+7
-181
lines changed

1 file changed

+7
-181
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 181 deletions
Original file line numberDiff line numberDiff line change
@@ -6,186 +6,12 @@ on:
66
pull_request:
77
workflow_dispatch:
88

9-
concurrency: # Cancel stale PR builds (but not push builds)
10-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
11-
cancel-in-progress: true
12-
139
jobs:
1410
build:
15-
strategy:
16-
fail-fast: false
17-
matrix:
18-
target:
19-
- os: linux
20-
cpu: amd64
21-
- os: linux-gcc-14 # this is to use ubuntu 24 and install gcc 14. Must be removed when ubuntu-latest is 24.04
22-
cpu: amd64
23-
- os: linux
24-
cpu: i386
25-
- os: macos
26-
cpu: amd64
27-
- os: macos
28-
cpu: arm64
29-
- os: windows
30-
cpu: amd64
31-
branch: [version-1-6, version-2-0, devel]
32-
include:
33-
- target:
34-
os: linux
35-
builder: ubuntu-latest
36-
shell: bash
37-
- target:
38-
os: linux-gcc-14 # this is to use ubuntu 24 and install gcc 14. Must be removed when ubuntu-latest is 24.04
39-
builder: ubuntu-24.04
40-
shell: bash
41-
- target:
42-
os: macos
43-
cpu: amd64
44-
builder: macos-13
45-
shell: bash
46-
- target:
47-
os: macos
48-
cpu: arm64
49-
builder: macos-latest
50-
shell: bash
51-
- target:
52-
os: windows
53-
builder: windows-latest
54-
shell: msys2 {0}
55-
56-
defaults:
57-
run:
58-
shell: ${{ matrix.shell }}
59-
60-
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch }})'
61-
runs-on: ${{ matrix.builder }}
62-
continue-on-error: ${{ matrix.branch == 'devel' }}
63-
steps:
64-
- name: Checkout
65-
uses: actions/checkout@v4
66-
67-
- name: Enable debug verbosity
68-
if: runner.debug == '1'
69-
run: |
70-
echo "V=1" >> $GITHUB_ENV
71-
echo "UNITTEST2_OUTPUT_LVL=VERBOSE" >> $GITHUB_ENV
72-
73-
- name: Install build dependencies (Linux i386)
74-
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
75-
run: |
76-
sudo dpkg --add-architecture i386
77-
sudo apt-get update -qq
78-
sudo DEBIAN_FRONTEND='noninteractive' apt-get install \
79-
--no-install-recommends -yq gcc-multilib g++-multilib \
80-
libssl-dev:i386
81-
mkdir -p external/bin
82-
cat << EOF > external/bin/gcc
83-
#!/bin/bash
84-
exec $(which gcc) -m32 "\$@"
85-
EOF
86-
cat << EOF > external/bin/g++
87-
#!/bin/bash
88-
exec $(which g++) -m32 "\$@"
89-
EOF
90-
chmod 755 external/bin/gcc external/bin/g++
91-
echo '${{ github.workspace }}/external/bin' >> $GITHUB_PATH
92-
93-
- name: MSYS2 (Windows i386)
94-
if: runner.os == 'Windows' && matrix.target.cpu == 'i386'
95-
uses: msys2/setup-msys2@v2
96-
with:
97-
path-type: inherit
98-
msystem: MINGW32
99-
install: >-
100-
base-devel
101-
git
102-
mingw-w64-i686-toolchain
103-
104-
- name: MSYS2 (Windows amd64)
105-
if: runner.os == 'Windows' && matrix.target.cpu == 'amd64'
106-
uses: msys2/setup-msys2@v2
107-
with:
108-
path-type: inherit
109-
install: >-
110-
base-devel
111-
git
112-
mingw-w64-x86_64-toolchain
113-
114-
- name: Restore Nim DLLs dependencies (Windows) from cache
115-
if: runner.os == 'Windows'
116-
id: windows-dlls-cache
117-
uses: actions/cache@v4
118-
with:
119-
path: external/dlls-${{ matrix.target.cpu }}
120-
key: 'dlls-${{ matrix.target.cpu }}'
121-
122-
- name: Install DLLs dependencies (Windows)
123-
if: >
124-
steps.windows-dlls-cache.outputs.cache-hit != 'true' &&
125-
runner.os == 'Windows'
126-
run: |
127-
mkdir -p external
128-
curl -L "https://nim-lang.org/download/windeps.zip" -o external/windeps.zip
129-
7z x -y external/windeps.zip -oexternal/dlls-${{ matrix.target.cpu }}
130-
131-
- name: Path to cached dependencies (Windows)
132-
if: >
133-
runner.os == 'Windows'
134-
run: |
135-
echo "${{ github.workspace }}/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH
136-
137-
- name: Derive environment variables
138-
run: |
139-
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
140-
PLATFORM=x64
141-
elif [[ '${{ matrix.target.cpu }}' == 'arm64' ]]; then
142-
PLATFORM=arm64
143-
else
144-
PLATFORM=x86
145-
fi
146-
echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV
147-
148-
ncpu=
149-
MAKE_CMD="make"
150-
case '${{ runner.os }}' in
151-
'Linux')
152-
ncpu=$(nproc)
153-
;;
154-
'macOS')
155-
ncpu=$(sysctl -n hw.ncpu)
156-
;;
157-
'Windows')
158-
ncpu=$NUMBER_OF_PROCESSORS
159-
MAKE_CMD="mingw32-make"
160-
;;
161-
esac
162-
[[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
163-
echo "ncpu=$ncpu" >> $GITHUB_ENV
164-
echo "MAKE_CMD=${MAKE_CMD}" >> $GITHUB_ENV
165-
166-
- name: Build Nim and Nimble
167-
run: |
168-
curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh
169-
env MAKE="${MAKE_CMD} -j${ncpu}" ARCH_OVERRIDE=${PLATFORM} NIM_COMMIT=${{ matrix.branch }} \
170-
QUICK_AND_DIRTY_COMPILER=1 QUICK_AND_DIRTY_NIMBLE=1 CC=gcc \
171-
bash build_nim.sh nim csources dist/nimble NimBinaries
172-
echo '${{ github.workspace }}/nim/bin' >> $GITHUB_PATH
173-
174-
- name: Use gcc 14 # Must be removed when ubuntu-latest is 24.04 and gcc 14 is the default
175-
if : ${{ matrix.target.os == 'linux-gcc-14' }}
176-
run: |
177-
# Add GCC-14 to alternatives
178-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 14
179-
180-
# Set GCC-14 as the default
181-
sudo update-alternatives --set gcc /usr/bin/gcc-14
182-
183-
- name: Run tests
184-
run: |
185-
nim --version
186-
nimble --version
187-
nimble install -y --depsOnly
188-
nimble install -y libbacktrace
189-
nimble test
190-
nimble test_libbacktrace
191-
nimble examples
11+
uses: status-im/nimbus-common-workflow/.github/workflows/common.yml@main
12+
with:
13+
test-command: |
14+
nimble install -y libbacktrace
15+
nimble test
16+
nimble test_libbacktrace
17+
nimble examples

0 commit comments

Comments
 (0)