xref: /reactos/.github/workflows/build.yml (revision 08d10098)
1name: Build
2on: [push, pull_request]
3
4jobs:
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=13
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        os: [windows-latest, windows-2019]
82        toolset: ['14.2', '14.1', '14.0'] # VS 2019, 2017, and 2015 (see below)
83        arch: [i386, amd64]
84        config: [Debug, Release]
85        exclude: # VS 2019, 2017 only with windows-latest; VS 2015 only with windows-2019
86          - os: windows-2019
87            toolset: '14.2'
88          - os: windows-2019
89            toolset: '14.1'
90          - os: windows-latest
91            toolset: '14.0'
92      fail-fast: false
93    runs-on: ${{matrix.os}}
94    steps:
95    - name: Install ninja
96      run: choco install -y ninja
97    - name: Install Flex & Bison
98      run: |
99        curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
100        7z x flexbison.7z -O${{github.workspace}}\bin
101        echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
102        echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
103        echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
104    - name: Activate VS cmd (x86)
105      if: ${{ matrix.arch == 'i386' }}
106      uses: ilammy/msvc-dev-cmd@v1
107      with:
108        arch: amd64_x86
109        toolset: ${{matrix.toolset}}
110    - name: Activate VS cmd (amd64)
111      if: ${{ matrix.arch == 'amd64' }}
112      uses: ilammy/msvc-dev-cmd@v1
113      with:
114        arch: amd64
115        toolset: ${{matrix.toolset}}
116    - name: Source checkout
117      uses: actions/checkout@v2
118      with:
119        path: src
120    - name: Configure
121      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
122    - name: Build
123      run: cmake --build build -- -k0
124    - name: Generate ISOs
125      run: cmake --build build --target bootcd --target livecd
126    - name: Upload ISOs
127      uses: actions/upload-artifact@v2
128      with:
129        name: reactos-msvc${{matrix.toolset}}-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
130        path: |
131          build/bootcd.iso
132          build/livecd.iso
133    - name: Upload debug symbols
134      if: ${{ matrix.config == 'Debug' }}
135      uses: actions/upload-artifact@v2
136      with:
137        name: reactos-syms-msvc${{matrix.toolset}}-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
138        path: build/msvc_pdb
139
140  build-msvc-arm:
141    strategy:
142      matrix:
143        toolset: ['14.2', '14.1'] # VS 2019, 2017
144        arch: [arm]
145        config: [Debug, Release]
146      fail-fast: false
147    runs-on: windows-latest
148    steps:
149    - name: Install ninja
150      run: choco install -y ninja
151    - name: Install Flex & Bison
152      run: |
153        curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
154        7z x flexbison.7z -O${{github.workspace}}\bin
155        echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
156        echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
157        echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
158    - name: Activate VS cmd (arm)
159      uses: ilammy/msvc-dev-cmd@v1
160      with:
161        arch: x86_arm
162        toolset: ${{matrix.toolset}}
163    - name: Source checkout
164      uses: actions/checkout@v2
165      with:
166        path: src
167    - name: Configure
168      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
169    - name: Build base module
170      run: cmake --build build --target base/all
171    - name: Build control panel applets
172      run: cmake --build build --target dll/cpl/all
173    - name: Build rosapps
174      run: cmake --build build --target modules/rosapps/all
175    - name: Upload compiled binaries
176      uses: actions/upload-artifact@v2
177      with:
178        name: reactos-msvc${{matrix.toolset}}-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
179        path: |
180          build/base
181          build/dll/cpl
182          build/modules/rosapps
183          !**/CMakeFiles
184          !**/cmake_install.cmake
185          !**/*.asm
186          !**/*.bin
187          !**/*.c
188          !**/*.def
189          !**/*.exp
190          !**/*.h
191          !**/*.lib
192          !**/*.mc
193          !**/*.obj
194          !**/*.rc
195          !**/*.tlb
196    - name: Upload debug symbols
197      if: ${{ matrix.config == 'Debug' }}
198      uses: actions/upload-artifact@v2
199      with:
200        name: reactos-syms-msvc${{matrix.toolset}}-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
201        path: build/msvc_pdb
202
203  build-clang-cl:
204    strategy:
205      matrix:
206        arch: [i386, amd64]
207        config: [Debug, Release]
208      fail-fast: false
209    runs-on: windows-latest
210    steps:
211    - name: Install ninja
212      run: choco install -y ninja
213    - name: Install LLVM
214      run: |
215        choco install -y llvm
216        echo "LLVM_PATH=${env:PROGRAMFILES}\llvm\bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
217    - name: Install Flex & Bison
218      run: |
219        curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
220        7z x flexbison.7z -O${{github.workspace}}\bin
221        echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
222        echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
223        echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
224    - name: Activate VS cmd (x86)
225      if: ${{ matrix.arch == 'i386' }}
226      uses: ilammy/msvc-dev-cmd@v1
227      with:
228        arch: amd64_x86
229        toolset: '14.1' # latest masm build known to make bootable builds
230    - name: Activate VS cmd (amd64)
231      if: ${{ matrix.arch == 'amd64' }}
232      uses: ilammy/msvc-dev-cmd@v1
233      with:
234        arch: amd64
235        toolset: '14.1' # latest masm build known to make bootable builds
236    - name: Add LLVM to PATH
237      run: echo "${env:LLVM_PATH}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
238    - name: Source checkout
239      uses: actions/checkout@v2
240      with:
241        path: src
242    - name: Configure
243      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
244    - name: Build
245      run: cmake --build build -- -k0
246    - name: Generate ISOs
247      run: cmake --build build --target bootcd --target livecd
248    - name: Upload ISOs
249      uses: actions/upload-artifact@v2
250      with:
251        name: reactos-clang-cl-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
252        path: |
253          build/bootcd.iso
254          build/livecd.iso
255    - name: Upload debug symbols
256      if: ${{ matrix.config == 'Debug' }}
257      uses: actions/upload-artifact@v2
258      with:
259        name: reactos-syms-clang-cl-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
260        path: build/msvc_pdb
261
262  build-msbuild-i386:
263    name: MSBuild (i386)
264    runs-on: windows-2019
265    steps:
266    - name: Install Flex and Bison
267      run: |
268        curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
269        7z x flexbison.7z -O${{github.workspace}}\bin
270        echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
271        echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
272        echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
273    - name: Add CL to PATH
274      uses: ilammy/msvc-dev-cmd@v1
275      with:
276        arch: amd64_x86
277    - uses: actions/checkout@v2
278      with:
279        path: src
280    - name: Configure
281      run: |
282        mkdir build
283        cd build
284        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
285    - name: Build
286      run: cmake --build ${{github.workspace}}\build --target bootcd --target livecd
287