0d96b52c09c38f847f0414f45660e1ae5f4285af
[reactos.git] / .github / workflows / build.yml
1 name: Build
2 on: [push, pull_request]
3
4 jobs:
5 build-linux:
6 strategy:
7 matrix:
8 compiler: [gcc, clang]
9 arch: [i386, amd64]
10 config: [Debug, Release]
11 fail-fast: false
12 runs-on: ubuntu-latest
13 steps:
14 - name: Get RosBE build specifics
15 id: get_rosbe_spec
16 run: |
17 gcc -march=native -Q --help=target | grep "\-march= " | awk '{print $NF}'
18 echo ::set-output name=march-sha::$(gcc -march=native -Q --help=target | sha1sum | awk '{print $1}')
19 echo ::set-output name=git-sha::$(git ls-remote https://github.com/zefklop/RosBE.git | grep unix_amd64 | awk '{print $1}')
20 wget https://gist.githubusercontent.com/zefklop/b2d6a0b470c70183e93d5285a03f5899/raw/build_rosbe_ci.sh
21 - name: Get RosBE
22 id: get_rosbe
23 uses: actions/cache@v2
24 with:
25 path: RosBE-CI
26 key: RosBE-CI-${{runner.os}}-${{steps.get_rosbe_spec.outputs.march-sha}}-${{steps.get_rosbe_spec.outputs.git-sha}}-${{hashfiles('./build_rosbe_ci.sh')}}
27 - name: Compile RosBE
28 if: ${{ steps.get_rosbe.outputs.cache-hit != 'true' }}
29 run: |
30 chmod +x build_rosbe_ci.sh
31 ./build_rosbe_ci.sh ${{github.workspace}}/RosBE-CI
32 - name: Install ccache
33 run: sudo apt install ccache
34 - name: Install LLVM
35 if: ${{ matrix.compiler == 'clang' }}
36 run: |
37 export LLVM_VERSION=12
38 wget https://apt.llvm.org/llvm.sh
39 chmod +x llvm.sh
40 sudo ./llvm.sh $LLVM_VERSION
41 echo "D_CLANG_VERSION=-DCLANG_VERSION=$LLVM_VERSION" >> $GITHUB_ENV
42 - name: Source checkout
43 uses: actions/checkout@v2
44 with:
45 path: src
46 - name: Set up cache for ccache
47 uses: actions/cache@v2
48 with:
49 path: ccache
50 key: ccache-${{matrix.compiler}}-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
51 restore-keys: |
52 ccache-${{matrix.compiler}}-${{matrix.arch}}-
53 - name: Set ccache settings
54 run: |
55 echo "CCACHE_BASEDIR=${{github.workspace}}" >> $GITHUB_ENV
56 echo "CCACHE_DIR=${{github.workspace}}/ccache" >> $GITHUB_ENV
57 echo "CCACHE_MAXSIZE=1G" >> $GITHUB_ENV
58 echo "CCACHE_SLOPPINESS=time_macros" >> $GITHUB_ENV
59 - name: Ease ccache compiler check (GCC)
60 if: ${{ matrix.compiler == 'gcc' }}
61 run: echo "CCACHE_COMPILERCHECK=string:${{steps.get_rosbe_spec.outputs.git-sha}}-${{hashfiles('./build_rosbe_ci.sh')}}" >> $GITHUB_ENV
62 - name: Configure
63 run: echo 'cmake -S ${{github.workspace}}/src -B ${{github.workspace}}/build -G Ninja -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-${{matrix.compiler}}.cmake -DARCH:STRING=${{matrix.arch}} -DCMAKE_BUILD_TYPE=${{matrix.config}} -DENABLE_CCACHE=1 -DENABLE_ROSTESTS=1 -DENABLE_ROSAPPS=1 ${{env.D_CLANG_VERSION}}' | ${{github.workspace}}/RosBE-CI/RosBE.sh . 0 ${{matrix.arch}}
64 - name: Build
65 run: echo 'cmake --build ${{github.workspace}}/build -- -k0' | ${{github.workspace}}/RosBE-CI/RosBE.sh . 0 ${{matrix.arch}}
66 - name: Generate ISOs
67 run: echo 'cmake --build ${{github.workspace}}/build --target bootcd --target livecd' | ${{github.workspace}}/RosBE-CI/RosBE.sh . 0 ${{matrix.arch}}
68 - name: Print ccache statistics
69 run: ccache -s
70 - name: Upload ISOs
71 uses: actions/upload-artifact@v2
72 with:
73 name: reactos-${{matrix.compiler}}-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
74 path: |
75 build/bootcd.iso
76 build/livecd.iso
77
78 build-msvc:
79 strategy:
80 matrix:
81 toolset: ['14.2', '14.1'] # VS 2019, 2017
82 arch: [i386, amd64]
83 config: [Debug, Release]
84 include:
85 - arch: i386 # Not compiling on amd64 prompt
86 toolset: '14.0' # VS 2015
87 fail-fast: false
88 runs-on: windows-latest
89 steps:
90 - name: Install ninja
91 run: choco install -y ninja
92 - name: Install Flex & Bison
93 run: |
94 curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
95 7z x flexbison.7z -O${{github.workspace}}\bin
96 echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
97 echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
98 echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
99 - name: Activate VS cmd (x86)
100 if: ${{ matrix.arch == 'i386' }}
101 uses: ilammy/msvc-dev-cmd@v1
102 with:
103 arch: amd64_x86
104 toolset: ${{matrix.toolset}}
105 - name: Activate VS cmd (amd64)
106 if: ${{ matrix.arch == 'amd64' }}
107 uses: ilammy/msvc-dev-cmd@v1
108 with:
109 arch: amd64
110 toolset: ${{matrix.toolset}}
111 - name: Source checkout
112 uses: actions/checkout@v2
113 with:
114 path: src
115 - name: Configure
116 run: cmake -S src -B build -G Ninja -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=${{matrix.arch}} -DCMAKE_BUILD_TYPE=${{matrix.config}} -DENABLE_ROSTESTS=1 -DENABLE_ROSAPPS=1
117 - name: Build
118 run: cmake --build build -- -k0
119 - name: Generate ISOs
120 run: cmake --build build --target bootcd --target livecd
121 - name: Upload ISOs
122 uses: actions/upload-artifact@v2
123 with:
124 name: reactos-msvc${{matrix.toolset}}-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
125 path: |
126 build/bootcd.iso
127 build/livecd.iso
128 - name: Upload debug symbols
129 if: ${{ matrix.config == 'Debug' }}
130 uses: actions/upload-artifact@v2
131 with:
132 name: reactos-syms-msvc${{matrix.toolset}}-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
133 path: build/msvc_pdb
134
135 build-msvc-arm:
136 strategy:
137 matrix:
138 toolset: ['14.2', '14.1'] # VS 2019, 2017
139 arch: [arm]
140 fail-fast: false
141 runs-on: windows-latest
142 steps:
143 - name: Install ninja
144 run: choco install -y ninja
145 - name: Install Flex & Bison
146 run: |
147 curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
148 7z x flexbison.7z -O${{github.workspace}}\bin
149 echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
150 echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
151 echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
152 - name: Activate VS cmd (arm)
153 uses: ilammy/msvc-dev-cmd@v1
154 with:
155 arch: x86_arm
156 toolset: ${{matrix.toolset}}
157 - name: Source checkout
158 uses: actions/checkout@v2
159 with:
160 path: src
161 - name: Configure
162 run: cmake -S src -B build -G Ninja -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=${{matrix.arch}} -DENABLE_ROSTESTS=1 -DENABLE_ROSAPPS=1
163 - name: Build rapps
164 run: cmake --build build --target rapps
165
166 build-clang-cl:
167 strategy:
168 matrix:
169 arch: [i386, amd64]
170 config: [Debug, Release]
171 fail-fast: false
172 runs-on: windows-latest
173 steps:
174 - name: Install ninja
175 run: choco install -y ninja
176 - name: Install LLVM (x86)
177 if: ${{ matrix.arch == 'i386' }}
178 run: |
179 choco install --x86 -y llvm
180 echo "LLVM_PATH=${env:PROGRAMFILES(X86)}\llvm\bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
181 - name: Install LLVM (amd64)
182 if: ${{ matrix.arch == 'amd64' }}
183 run: |
184 choco install -y llvm
185 echo "LLVM_PATH=${env:PROGRAMFILES}\llvm\bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
186 - name: Install Flex & Bison
187 run: |
188 curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
189 7z x flexbison.7z -O${{github.workspace}}\bin
190 echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
191 echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
192 echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
193 - name: Activate VS cmd (x86)
194 if: ${{ matrix.arch == 'i386' }}
195 uses: ilammy/msvc-dev-cmd@v1
196 with:
197 arch: amd64_x86
198 toolset: '14.1' # latest masm build known to make bootable builds
199 - name: Activate VS cmd (amd64)
200 if: ${{ matrix.arch == 'amd64' }}
201 uses: ilammy/msvc-dev-cmd@v1
202 with:
203 arch: amd64
204 toolset: '14.1' # latest masm build known to make bootable builds
205 - name: Add LLVM to PATH
206 run: echo "${env:LLVM_PATH}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
207 - name: Source checkout
208 uses: actions/checkout@v2
209 with:
210 path: src
211 - name: Configure
212 run: cmake -S src -B build -G Ninja -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=${{matrix.arch}} -DCMAKE_BUILD_TYPE=${{matrix.config}} -DENABLE_ROSTESTS=1 -DENABLE_ROSAPPS=1 -DUSE_CLANG_CL:BOOL=TRUE
213 - name: Build
214 run: cmake --build build -- -k0
215 - name: Generate ISOs
216 run: cmake --build build --target bootcd --target livecd
217 - name: Upload ISOs
218 uses: actions/upload-artifact@v2
219 with:
220 name: reactos-clang-cl-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
221 path: |
222 build/bootcd.iso
223 build/livecd.iso
224 - name: Upload debug symbols
225 if: ${{ matrix.config == 'Debug' }}
226 uses: actions/upload-artifact@v2
227 with:
228 name: reactos-syms-clang-cl-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
229 path: build/msvc_pdb
230
231 build-msbuild-i386:
232 name: MSBuild (i386)
233 runs-on: windows-latest
234 steps:
235 - name: Install Flex and Bison
236 run: |
237 curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
238 7z x flexbison.7z -O${{github.workspace}}\bin
239 echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
240 echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
241 echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
242 - name: Add CL to PATH
243 uses: ilammy/msvc-dev-cmd@v1
244 with:
245 arch: amd64_x86
246 - uses: actions/checkout@v2
247 with:
248 path: src
249 - name: Configure
250 run: |
251 mkdir build
252 cd build
253 cmake -G "Visual Studio 16 2019" -A Win32 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=i386 -DENABLE_ROSTESTS=1 -DENABLE_ROSAPPS=1 ${{github.workspace}}\src
254 - name: Build
255 run: cmake --build ${{github.workspace}}\build --target bootcd --target livecd