xref: /reactos/.github/workflows/build.yml (revision f308c6a2)
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, arm64]
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      if: ${{ matrix.arch == 'arm' }}
160      uses: ilammy/msvc-dev-cmd@v1
161      with:
162        arch: amd64_arm
163        toolset: ${{matrix.toolset}}
164    - name: Activate VS cmd (arm64)
165      if: ${{ matrix.arch == 'arm64' }}
166      uses: ilammy/msvc-dev-cmd@v1
167      with:
168        arch: amd64_arm64
169        toolset: ${{matrix.toolset}}
170    - name: Source checkout
171      uses: actions/checkout@v2
172      with:
173        path: src
174    - name: Configure
175      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
176    - name: Build base module
177      if: ${{ matrix.arch == 'arm' }}
178      run: cmake --build build --target base/all
179    - name: Build control panel applets
180      if: ${{ matrix.arch == 'arm' }}
181      run: cmake --build build --target dll/cpl/all
182    - name: Build rosapps
183      if: ${{ matrix.arch == 'arm' }}
184      run: cmake --build build --target modules/rosapps/all
185    - name: Build some applications (arm64)
186      if: ${{ matrix.arch == 'arm64' }}
187      run: cmake --build build --target calc magnify mstsc notepad osk regedit taskmgr winmine wordpad base/applications/screensavers/all -- -k0
188    - name: Upload compiled binaries
189      uses: actions/upload-artifact@v2
190      with:
191        name: reactos-msvc${{matrix.toolset}}-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
192        path: |
193          build/base
194          build/dll/cpl
195          build/modules/rosapps
196          !**/CMakeFiles
197          !**/cmake_install.cmake
198          !**/*.asm
199          !**/*.bin
200          !**/*.c
201          !**/*.def
202          !**/*.exp
203          !**/*.h
204          !**/*.lib
205          !**/*.mc
206          !**/*.obj
207          !**/*.rc
208          !**/*.tlb
209    - name: Upload debug symbols
210      if: ${{ matrix.config == 'Debug' }}
211      uses: actions/upload-artifact@v2
212      with:
213        name: reactos-syms-msvc${{matrix.toolset}}-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
214        path: build/msvc_pdb
215
216  build-clang-cl:
217    strategy:
218      matrix:
219        arch: [i386, amd64]
220        config: [Debug, Release]
221      fail-fast: false
222    runs-on: windows-latest
223    steps:
224    - name: Install ninja
225      run: choco install -y ninja
226    - name: Install LLVM
227      run: |
228        choco install -y --allow-downgrade llvm --version 13.0.1
229        echo "LLVM_PATH=${env:PROGRAMFILES}\llvm\bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
230    - name: Install Flex & Bison
231      run: |
232        curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
233        7z x flexbison.7z -O${{github.workspace}}\bin
234        echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
235        echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
236        echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
237    - name: Activate VS cmd (x86)
238      if: ${{ matrix.arch == 'i386' }}
239      uses: ilammy/msvc-dev-cmd@v1
240      with:
241        arch: amd64_x86
242        toolset: '14.1' # latest masm build known to make bootable builds
243    - name: Activate VS cmd (amd64)
244      if: ${{ matrix.arch == 'amd64' }}
245      uses: ilammy/msvc-dev-cmd@v1
246      with:
247        arch: amd64
248        toolset: '14.1' # latest masm build known to make bootable builds
249    - name: Add LLVM to PATH
250      run: echo "${env:LLVM_PATH}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
251    - name: Source checkout
252      uses: actions/checkout@v2
253      with:
254        path: src
255    - name: Configure
256      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
257    - name: Build
258      run: cmake --build build -- -k0
259    - name: Generate ISOs
260      run: cmake --build build --target bootcd --target livecd
261    - name: Upload ISOs
262      uses: actions/upload-artifact@v2
263      with:
264        name: reactos-clang-cl-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
265        path: |
266          build/bootcd.iso
267          build/livecd.iso
268    - name: Upload debug symbols
269      if: ${{ matrix.config == 'Debug' }}
270      uses: actions/upload-artifact@v2
271      with:
272        name: reactos-syms-clang-cl-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
273        path: build/msvc_pdb
274
275  build-msbuild-i386:
276    name: MSBuild (i386)
277    runs-on: windows-2019
278    steps:
279    - name: Install Flex and Bison
280      run: |
281        curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
282        7z x flexbison.7z -O${{github.workspace}}\bin
283        echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
284        echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
285        echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
286    - name: Add CL to PATH
287      uses: ilammy/msvc-dev-cmd@v1
288      with:
289        arch: amd64_x86
290    - uses: actions/checkout@v2
291      with:
292        path: src
293    - name: Configure
294      run: |
295        mkdir build
296        cd build
297        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
298    - name: Build
299      run: cmake --build ${{github.workspace}}\build --target bootcd --target livecd
300