xref: /reactos/.github/workflows/build.yml (revision cce399e7)
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        dllver: ['0x502', '0x600']
12        exclude:
13          - dllver: 0x600
14            compiler: clang
15          - dllver: 0x600
16            config: Release
17      fail-fast: false
18    runs-on: ubuntu-latest
19    steps:
20    - name: Get RosBE build specifics
21      id: get_rosbe_spec
22      run: |
23        gcc -march=native -Q --help=target | grep "\-march= " | awk '{print $NF}'
24        echo march-sha=$(gcc -march=native -Q --help=target | sha1sum | awk '{print $1}') >> $GITHUB_OUTPUT
25        echo git-sha=$(git ls-remote https://github.com/zefklop/RosBE.git | grep unix_amd64 | awk '{print $1}') >> $GITHUB_OUTPUT
26        wget https://gist.githubusercontent.com/zefklop/b2d6a0b470c70183e93d5285a03f5899/raw/build_rosbe_ci.sh
27    - name: Get RosBE
28      id: get_rosbe
29      uses: actions/cache@v3
30      with:
31        path: RosBE-CI
32        key: RosBE-CI-${{runner.os}}-${{steps.get_rosbe_spec.outputs.march-sha}}-${{steps.get_rosbe_spec.outputs.git-sha}}-${{hashfiles('./build_rosbe_ci.sh')}}
33    - name: Compile RosBE
34      if: ${{ steps.get_rosbe.outputs.cache-hit != 'true' }}
35      run: |
36        chmod +x build_rosbe_ci.sh
37        ./build_rosbe_ci.sh ${{github.workspace}}/RosBE-CI
38    - name: Install ccache
39      run: sudo apt install ccache
40    - name: Install LLVM
41      if: ${{ matrix.compiler == 'clang' }}
42      run: |
43        export LLVM_VERSION=13
44        wget https://apt.llvm.org/llvm.sh
45        chmod +x llvm.sh
46        sudo ./llvm.sh $LLVM_VERSION
47        echo "D_CLANG_VERSION=-DCLANG_VERSION=$LLVM_VERSION" >> $GITHUB_ENV
48    - name: Source checkout
49      uses: actions/checkout@v3
50      with:
51        path: src
52    - name: Set up cache for ccache
53      uses: actions/cache@v3
54      with:
55        path: ccache
56        key: ccache-${{matrix.compiler}}-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
57        restore-keys: |
58          ccache-${{matrix.compiler}}-${{matrix.arch}}-
59    - name: Set ccache settings
60      run: |
61        echo "CCACHE_BASEDIR=${{github.workspace}}" >> $GITHUB_ENV
62        echo "CCACHE_DIR=${{github.workspace}}/ccache" >> $GITHUB_ENV
63        echo "CCACHE_MAXSIZE=1G" >> $GITHUB_ENV
64        echo "CCACHE_SLOPPINESS=time_macros" >> $GITHUB_ENV
65    - name: Ease ccache compiler check (GCC)
66      if: ${{ matrix.compiler == 'gcc' }}
67      run: echo "CCACHE_COMPILERCHECK=string:${{steps.get_rosbe_spec.outputs.git-sha}}-${{hashfiles('./build_rosbe_ci.sh')}}" >> $GITHUB_ENV
68    - name: Configure
69      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}} -DDLL_EXPORT_VERSION=${{matrix.dllver}} -DENABLE_CCACHE=1 -DENABLE_ROSTESTS=1 -DENABLE_ROSAPPS=1 ${{env.D_CLANG_VERSION}}' | ${{github.workspace}}/RosBE-CI/RosBE.sh . 0 ${{matrix.arch}}
70    - name: Build
71      run: echo 'cmake --build ${{github.workspace}}/build -- -k0' | ${{github.workspace}}/RosBE-CI/RosBE.sh . 0 ${{matrix.arch}}
72    - name: Generate ISOs
73      run: echo 'cmake --build ${{github.workspace}}/build --target bootcd --target livecd' | ${{github.workspace}}/RosBE-CI/RosBE.sh . 0 ${{matrix.arch}}
74    - name: Print ccache statistics
75      run: ccache -s
76    - name: Upload ISOs
77      uses: actions/upload-artifact@v3
78      with:
79        name: reactos-${{matrix.compiler}}-${{matrix.arch}}-${{matrix.config}}-${{matrix.dllver}}-${{github.sha}}
80        path: |
81          build/bootcd.iso
82          build/livecd.iso
83
84  build-msvc:
85    strategy:
86      matrix:
87        os: [windows-latest, windows-2019]
88        toolset: ['14.2', '14.1', '14.0'] # VS 2019, 2017, and 2015 (see below)
89        arch: [i386, amd64]
90        config: [Debug, Release]
91        dllver: ['0x502', '0x600']
92        exclude: # VS 2019, 2017 only with windows-latest; VS 2015 only with windows-2019
93          - os: windows-2019
94            toolset: '14.2'
95          - os: windows-2019
96            toolset: '14.1'
97          - os: windows-latest
98            toolset: '14.0'
99          - dllver: 0x600
100            os: windows-2019
101          - dllver: 0x600
102            toolset: '14.1'
103          - dllver: 0x600
104            toolset: '14.0'
105          - dllver: 0x600
106            config: Release
107      fail-fast: false
108    runs-on: ${{matrix.os}}
109    steps:
110    - name: Install ninja
111      run: choco install -y ninja
112    - name: Install Flex & Bison
113      run: |
114        curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
115        7z x flexbison.7z -O${{github.workspace}}\bin
116        echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
117        echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
118        echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
119    - name: Activate VS cmd (x86)
120      if: ${{ matrix.arch == 'i386' }}
121      uses: ilammy/msvc-dev-cmd@v1
122      with:
123        arch: amd64_x86
124        toolset: ${{matrix.toolset}}
125    - name: Activate VS cmd (amd64)
126      if: ${{ matrix.arch == 'amd64' }}
127      uses: ilammy/msvc-dev-cmd@v1
128      with:
129        arch: amd64
130        toolset: ${{matrix.toolset}}
131    - name: Source checkout
132      uses: actions/checkout@v3
133      with:
134        path: src
135    - name: Configure
136      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 -DDLL_EXPORT_VERSION=${{matrix.dllver}}
137    - name: Build
138      run: cmake --build build -- -k0
139    - name: Generate ISOs
140      run: cmake --build build --target bootcd --target livecd
141    - name: Upload ISOs
142      uses: actions/upload-artifact@v3
143      with:
144        name: reactos-msvc${{matrix.toolset}}-${{matrix.arch}}-${{matrix.config}}-${{matrix.dllver}}-${{github.sha}}
145        path: |
146          build/bootcd.iso
147          build/livecd.iso
148    - name: Upload debug symbols
149      if: ${{ matrix.config == 'Debug' }}
150      uses: actions/upload-artifact@v3
151      with:
152        name: reactos-syms-msvc${{matrix.toolset}}-${{matrix.arch}}-${{matrix.config}}-${{matrix.dllver}}-${{github.sha}}
153        path: build/msvc_pdb
154
155  build-msvc-arm:
156    strategy:
157      matrix:
158        toolset: ['14.2', '14.1'] # VS 2019, 2017
159        arch: [arm, arm64]
160        config: [Debug, Release]
161      fail-fast: false
162    runs-on: windows-latest
163    steps:
164    - name: Install ninja
165      run: choco install -y ninja
166    - name: Install Flex & Bison
167      run: |
168        curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
169        7z x flexbison.7z -O${{github.workspace}}\bin
170        echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
171        echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
172        echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
173    - name: Activate VS cmd (arm)
174      if: ${{ matrix.arch == 'arm' }}
175      uses: ilammy/msvc-dev-cmd@v1
176      with:
177        arch: amd64_arm
178        toolset: ${{matrix.toolset}}
179    - name: Activate VS cmd (arm64)
180      if: ${{ matrix.arch == 'arm64' }}
181      uses: ilammy/msvc-dev-cmd@v1
182      with:
183        arch: amd64_arm64
184        toolset: ${{matrix.toolset}}
185    - name: Source checkout
186      uses: actions/checkout@v3
187      with:
188        path: src
189    - name: Configure
190      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
191    - name: Build base module
192      if: ${{ matrix.arch == 'arm' }}
193      run: cmake --build build --target base/all
194    - name: Build control panel applets
195      if: ${{ matrix.arch == 'arm' }}
196      run: cmake --build build --target dll/cpl/all
197    - name: Build rosapps
198      if: ${{ matrix.arch == 'arm' }}
199      run: cmake --build build --target modules/rosapps/all
200    - name: Build subsystems
201      if: ${{ matrix.arch == 'arm' }}
202      run: cmake --build build --target subsystems/all
203    - name: Build some applications (arm64)
204      if: ${{ matrix.arch == 'arm64' }}
205      run: cmake --build build --target calc magnify mstsc notepad osk regedit taskmgr winmine wordpad base/applications/screensavers/all -- -k0
206    - name: Upload compiled binaries
207      uses: actions/upload-artifact@v3
208      with:
209        name: reactos-msvc${{matrix.toolset}}-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
210        path: |
211          build/base
212          build/dll/cpl
213          build/modules/rosapps
214          build/subsystems
215          !**/CMakeFiles
216          !**/cmake_install.cmake
217          !**/*.asm
218          !**/*.bin
219          !**/*.c
220          !**/*.def
221          !**/*.exp
222          !**/*.h
223          !**/*.lib
224          !**/*.mc
225          !**/*.obj
226          !**/*.rc
227          !**/*.tlb
228    - name: Upload debug symbols
229      if: ${{ matrix.config == 'Debug' }}
230      uses: actions/upload-artifact@v3
231      with:
232        name: reactos-syms-msvc${{matrix.toolset}}-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
233        path: build/msvc_pdb
234
235  build-clang-cl:
236    strategy:
237      matrix:
238        arch: [i386, amd64]
239        config: [Debug, Release]
240      fail-fast: false
241    runs-on: windows-latest
242    steps:
243    - name: Install ninja
244      run: choco install -y ninja
245    - name: Install LLVM
246      run: |
247        choco install -y --allow-downgrade llvm --version 13.0.1
248        echo "LLVM_PATH=${env:PROGRAMFILES}\llvm\bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
249    - name: Install Flex & Bison
250      run: |
251        curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
252        7z x flexbison.7z -O${{github.workspace}}\bin
253        echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
254        echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
255        echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
256    - name: Activate VS cmd (x86)
257      if: ${{ matrix.arch == 'i386' }}
258      uses: ilammy/msvc-dev-cmd@v1
259      with:
260        arch: amd64_x86
261        toolset: '14.1' # latest masm build known to make bootable builds
262    - name: Activate VS cmd (amd64)
263      if: ${{ matrix.arch == 'amd64' }}
264      uses: ilammy/msvc-dev-cmd@v1
265      with:
266        arch: amd64
267        toolset: '14.1' # latest masm build known to make bootable builds
268    - name: Add LLVM to PATH
269      run: echo "${env:LLVM_PATH}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
270    - name: Source checkout
271      uses: actions/checkout@v3
272      with:
273        path: src
274    - name: Configure
275      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
276    - name: Build
277      run: cmake --build build -- -k0
278    - name: Generate ISOs
279      run: cmake --build build --target bootcd --target livecd
280    - name: Upload ISOs
281      uses: actions/upload-artifact@v3
282      with:
283        name: reactos-clang-cl-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
284        path: |
285          build/bootcd.iso
286          build/livecd.iso
287    - name: Upload debug symbols
288      if: ${{ matrix.config == 'Debug' }}
289      uses: actions/upload-artifact@v3
290      with:
291        name: reactos-syms-clang-cl-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
292        path: build/msvc_pdb
293
294# Disable MSBuild for the moment being until a proper fix is provided -- see CORE-18911
295#  build-msbuild-i386:
296#    name: MSBuild (i386)
297#    runs-on: windows-2019
298#    steps:
299#    - name: Install Flex and Bison
300#      run: |
301#        curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
302#        7z x flexbison.7z -O${{github.workspace}}\bin
303#        echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
304#        echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
305#        echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
306#    - name: Add CL to PATH
307#      uses: ilammy/msvc-dev-cmd@v1
308#      with:
309#        arch: amd64_x86
310#    - uses: actions/checkout@v3
311#      with:
312#        path: src
313#    - name: Configure
314#      run: |
315#        mkdir build
316#        cd build
317#        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
318#    - name: Build
319#      run: cmake --build ${{github.workspace}}\build --target bootcd --target livecd
320