|
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 |
| - shell: bash |
37 |
| - - target: |
38 |
| - os: linux-gcc-14 # This is to use ubuntu 24 and install gcc 14. Should be removed when ubuntu-latest is 26.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 |
| - with: |
67 |
| - submodules: recursive |
68 |
| - |
69 |
| - - name: Install build dependencies (Linux i386) |
70 |
| - if: runner.os == 'Linux' && matrix.target.cpu == 'i386' |
71 |
| - run: | |
72 |
| - sudo dpkg --add-architecture i386 |
73 |
| - sudo apt-get update -qq |
74 |
| - sudo DEBIAN_FRONTEND='noninteractive' apt-get install \ |
75 |
| - --no-install-recommends -yq gcc-multilib g++-multilib \ |
76 |
| - libssl-dev:i386 |
77 |
| - mkdir -p external/bin |
78 |
| - cat << EOF > external/bin/gcc |
79 |
| - #!/bin/bash |
80 |
| - exec $(which gcc) -m32 "\$@" |
81 |
| - EOF |
82 |
| - cat << EOF > external/bin/g++ |
83 |
| - #!/bin/bash |
84 |
| - exec $(which g++) -m32 "\$@" |
85 |
| - EOF |
86 |
| - chmod 755 external/bin/gcc external/bin/g++ |
87 |
| - echo '${{ github.workspace }}/external/bin' >> $GITHUB_PATH |
88 |
| -
|
89 |
| - - name: MSYS2 (Windows i386) |
90 |
| - if: runner.os == 'Windows' && matrix.target.cpu == 'i386' |
91 |
| - uses: msys2/setup-msys2@v2 |
92 |
| - with: |
93 |
| - path-type: inherit |
94 |
| - msystem: MINGW32 |
95 |
| - install: >- |
96 |
| - base-devel |
97 |
| - git |
98 |
| - mingw-w64-i686-toolchain |
99 |
| -
|
100 |
| - - name: MSYS2 (Windows amd64) |
101 |
| - if: runner.os == 'Windows' && matrix.target.cpu == 'amd64' |
102 |
| - uses: msys2/setup-msys2@v2 |
103 |
| - with: |
104 |
| - path-type: inherit |
105 |
| - install: >- |
106 |
| - base-devel |
107 |
| - git |
108 |
| - mingw-w64-x86_64-toolchain |
109 |
| -
|
110 |
| - - name: Restore Nim DLLs dependencies (Windows) from cache |
111 |
| - if: runner.os == 'Windows' |
112 |
| - id: windows-dlls-cache |
113 |
| - uses: actions/cache@v4 |
114 |
| - with: |
115 |
| - path: external/dlls-${{ matrix.target.cpu }} |
116 |
| - key: 'dlls-${{ matrix.target.cpu }}' |
117 |
| - |
118 |
| - - name: Install DLLs dependencies (Windows) |
119 |
| - if: > |
120 |
| - steps.windows-dlls-cache.outputs.cache-hit != 'true' && |
121 |
| - runner.os == 'Windows' |
122 |
| - run: | |
123 |
| - mkdir -p external |
124 |
| - curl -L "https://nim-lang.org/download/windeps.zip" -o external/windeps.zip |
125 |
| - 7z x -y external/windeps.zip -oexternal/dlls-${{ matrix.target.cpu }} |
126 |
| -
|
127 |
| - - name: Path to cached dependencies (Windows) |
128 |
| - if: > |
129 |
| - runner.os == 'Windows' |
130 |
| - run: | |
131 |
| - echo "${{ github.workspace }}/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH |
132 |
| -
|
133 |
| - - name: Derive environment variables |
134 |
| - run: | |
135 |
| - if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then |
136 |
| - PLATFORM=x64 |
137 |
| - elif [[ '${{ matrix.target.cpu }}' == 'arm64' ]]; then |
138 |
| - PLATFORM=arm64 |
139 |
| - else |
140 |
| - PLATFORM=x86 |
141 |
| - fi |
142 |
| - echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV |
143 |
| -
|
144 |
| - ncpu= |
145 |
| - MAKE_CMD="make" |
146 |
| - case '${{ runner.os }}' in |
147 |
| - 'Linux') |
148 |
| - ncpu=$(nproc) |
149 |
| - ;; |
150 |
| - 'macOS') |
151 |
| - ncpu=$(sysctl -n hw.ncpu) |
152 |
| - ;; |
153 |
| - 'Windows') |
154 |
| - ncpu=$NUMBER_OF_PROCESSORS |
155 |
| - MAKE_CMD="mingw32-make" |
156 |
| - ;; |
157 |
| - esac |
158 |
| - [[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1 |
159 |
| - echo "ncpu=$ncpu" >> $GITHUB_ENV |
160 |
| - echo "MAKE_CMD=${MAKE_CMD}" >> $GITHUB_ENV |
161 |
| -
|
162 |
| - - name: Build Nim and Nimble |
163 |
| - run: | |
164 |
| - curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh |
165 |
| - env MAKE="${MAKE_CMD} -j${ncpu}" ARCH_OVERRIDE=${PLATFORM} NIM_COMMIT=${{ matrix.branch }} \ |
166 |
| - QUICK_AND_DIRTY_COMPILER=1 QUICK_AND_DIRTY_NIMBLE=1 CC=gcc \ |
167 |
| - bash build_nim.sh nim csources dist/nimble NimBinaries |
168 |
| - echo '${{ github.workspace }}/nim/bin' >> $GITHUB_PATH |
169 |
| -
|
170 |
| - - name: Build snappy-cpp |
171 |
| - run: | |
172 |
| - cd tests/snappycpp |
173 |
| - mkdir -p build |
174 |
| - cd build |
175 |
| - if [[ '${{ matrix.target.os }}' == 'windows' ]]; then |
176 |
| - cmake -E env CXXFLAGS="-w" cmake .. -G "MinGW Makefiles" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" |
177 |
| - mingw32-make |
178 |
| - else |
179 |
| - cmake -E env CC=gcc CXX=g++ cmake -D CMAKE_CXX_FLAGS="-Wno-unused-variable -Wno-unused-parameter" ../ |
180 |
| - make |
181 |
| - fi |
182 |
| - cp libsnappy.a ../../ |
183 |
| -
|
184 |
| - - name: Use gcc 14 |
185 |
| - # Should be removed when ubuntu-latest is 26.04 |
186 |
| - if : ${{ matrix.target.os == 'linux-gcc-14' }} |
187 |
| - run: | |
188 |
| - # Add GCC-14 to alternatives |
189 |
| - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 14 |
190 |
| - # Set GCC-14 as the default |
191 |
| - sudo update-alternatives --set gcc /usr/bin/gcc-14 |
192 |
| -
|
193 |
| - - name: Run tests |
194 |
| - run: | |
195 |
| - nim --version |
196 |
| - nimble --version |
197 |
| - gcc --version |
198 |
| - nimble install -y --depsOnly |
199 |
| - env NIMLANG=c nimble test |
| 12 | + uses: status-im/nimbus-common-workflow/.github/workflows/common.yml@main |
0 commit comments