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