xref: /reactos/.github/workflows/build.yml (revision 48a0d8e0)
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@v4
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@v4
50      with:
51        path: src
52    - name: Set up cache for ccache
53      uses: actions/cache@v4
54      with:
55        path: ccache
56        key: ccache-${{matrix.compiler}}-${{matrix.arch}}-${{matrix.config}}-${{matrix.dllver}}-${{github.sha}}
57        restore-keys: |
58          ccache-${{matrix.compiler}}-${{matrix.arch}}-${{matrix.config}}-${{matrix.dllver}}-
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@v4
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]
88        toolset: ['14.2', '14.1'] # VS 2019, and 2017 (see below)
89        arch: [i386, amd64]
90        config: [Debug, Release]
91        dllver: ['0x502', '0x600']
92        exclude: # VS 2019, 2017 only with windows-latest
93          - dllver: 0x600
94            toolset: '14.1'
95          - dllver: 0x600
96            config: Release
97      fail-fast: false
98    runs-on: ${{matrix.os}}
99    steps:
100    - name: Install ninja
101      run: choco install -y ninja
102    - name: Install Flex & Bison
103      run: |
104        curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
105        7z x flexbison.7z -O${{github.workspace}}\bin
106        echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
107        echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
108        echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
109    - name: Activate VS cmd (x86)
110      if: ${{ matrix.arch == 'i386' }}
111      uses: ilammy/msvc-dev-cmd@v1
112      with:
113        arch: amd64_x86
114        toolset: ${{matrix.toolset}}
115    - name: Activate VS cmd (amd64)
116      if: ${{ matrix.arch == 'amd64' }}
117      uses: ilammy/msvc-dev-cmd@v1
118      with:
119        arch: amd64
120        toolset: ${{matrix.toolset}}
121    - name: Source checkout
122      uses: actions/checkout@v4
123      with:
124        path: src
125    - name: Configure
126      run: cmake -S src -B build -G Ninja -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=${{matrix.arch}} -DCMAKE_BUILD_TYPE=${{matrix.config}} -DDLL_EXPORT_VERSION=${{matrix.dllver}} -DENABLE_ROSTESTS=1 -DENABLE_ROSAPPS=1
127    - name: Build
128      run: cmake --build build -- -k0
129    - name: Generate ISOs
130      run: cmake --build build --target bootcd --target livecd
131    - name: Upload ISOs
132      uses: actions/upload-artifact@v4
133      with:
134        name: reactos-msvc${{matrix.toolset}}-${{matrix.arch}}-${{matrix.config}}-${{matrix.dllver}}-${{github.sha}}
135        path: |
136          build/bootcd.iso
137          build/livecd.iso
138    - name: Upload debug symbols
139      if: ${{ matrix.config == 'Debug' }}
140      uses: actions/upload-artifact@v4
141      with:
142        name: reactos-syms-msvc${{matrix.toolset}}-${{matrix.arch}}-${{matrix.config}}-${{matrix.dllver}}-${{github.sha}}
143        path: build/msvc_pdb
144
145  build-msvc-arm:
146    strategy:
147      matrix:
148        toolset: ['14.2', '14.1'] # VS 2019, 2017
149        arch: [arm, arm64]
150        config: [Debug, Release]
151      fail-fast: false
152    runs-on: windows-latest
153    steps:
154    - name: Install ninja
155      run: choco install -y ninja
156    - name: Install Flex & Bison
157      run: |
158        curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
159        7z x flexbison.7z -O${{github.workspace}}\bin
160        echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
161        echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
162        echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
163    - name: Activate VS cmd (arm)
164      if: ${{ matrix.arch == 'arm' }}
165      uses: ilammy/msvc-dev-cmd@v1
166      with:
167        arch: amd64_arm
168        toolset: ${{matrix.toolset}}
169    - name: Activate VS cmd (arm64)
170      if: ${{ matrix.arch == 'arm64' }}
171      uses: ilammy/msvc-dev-cmd@v1
172      with:
173        arch: amd64_arm64
174        toolset: ${{matrix.toolset}}
175    - name: Source checkout
176      uses: actions/checkout@v4
177      with:
178        path: src
179    - name: Configure
180      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
181    - name: Build base module
182      if: ${{ matrix.arch == 'arm' }}
183      run: cmake --build build --target base/all
184    - name: Build control panel applets
185      if: ${{ matrix.arch == 'arm' }}
186      run: cmake --build build --target dll/cpl/all
187    - name: Build rosapps
188      if: ${{ matrix.arch == 'arm' }}
189      run: cmake --build build --target modules/rosapps/all
190    - name: Build subsystems
191      if: ${{ matrix.arch == 'arm' }}
192      run: cmake --build build --target subsystems/all
193    - name: Build some applications (arm64)
194      if: ${{ matrix.arch == 'arm64' }}
195      run: cmake --build build --target calc magnify mstsc notepad osk regedit taskmgr winmine wordpad base/applications/screensavers/all -- -k0
196    - name: Upload compiled binaries
197      uses: actions/upload-artifact@v4
198      with:
199        name: reactos-msvc${{matrix.toolset}}-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
200        path: |
201          build/base
202          build/dll/cpl
203          build/modules/rosapps
204          build/subsystems
205          !**/CMakeFiles
206          !**/cmake_install.cmake
207          !**/*.asm
208          !**/*.bin
209          !**/*.c
210          !**/*.def
211          !**/*.exp
212          !**/*.h
213          !**/*.lib
214          !**/*.mc
215          !**/*.obj
216          !**/*.rc
217          !**/*.tlb
218    - name: Upload debug symbols
219      if: ${{ matrix.config == 'Debug' }}
220      uses: actions/upload-artifact@v4
221      with:
222        name: reactos-syms-msvc${{matrix.toolset}}-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
223        path: build/msvc_pdb
224
225  build-clang-cl:
226    strategy:
227      matrix:
228        arch: [i386, amd64]
229        config: [Debug, Release]
230      fail-fast: false
231    runs-on: windows-latest
232    steps:
233    - name: Install ninja
234      run: choco install -y ninja
235    - name: Install LLVM
236      run: |
237        choco install -y --allow-downgrade llvm --version 13.0.1
238        echo "LLVM_PATH=${env:PROGRAMFILES}\llvm\bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
239    - name: Install Flex & Bison
240      run: |
241        curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
242        7z x flexbison.7z -O${{github.workspace}}\bin
243        echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
244        echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
245        echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
246    - name: Activate VS cmd (x86)
247      if: ${{ matrix.arch == 'i386' }}
248      uses: ilammy/msvc-dev-cmd@v1
249      with:
250        arch: amd64_x86
251        toolset: '14.1' # latest masm build known to make bootable builds
252    - name: Activate VS cmd (amd64)
253      if: ${{ matrix.arch == 'amd64' }}
254      uses: ilammy/msvc-dev-cmd@v1
255      with:
256        arch: amd64
257        toolset: '14.1' # latest masm build known to make bootable builds
258    - name: Add LLVM to PATH
259      run: echo "${env:LLVM_PATH}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
260    - name: Source checkout
261      uses: actions/checkout@v4
262      with:
263        path: src
264    - name: Configure
265      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
266    - name: Build
267      run: cmake --build build -- -k0
268    - name: Generate ISOs
269      run: cmake --build build --target bootcd --target livecd
270    - name: Upload ISOs
271      uses: actions/upload-artifact@v4
272      with:
273        name: reactos-clang-cl-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
274        path: |
275          build/bootcd.iso
276          build/livecd.iso
277    - name: Upload debug symbols
278      if: ${{ matrix.config == 'Debug' }}
279      uses: actions/upload-artifact@v4
280      with:
281        name: reactos-syms-clang-cl-${{matrix.arch}}-${{matrix.config}}-${{github.sha}}
282        path: build/msvc_pdb
283
284  build-msbuild-i386:
285    name: MSBuild (i386)
286    runs-on: windows-2019
287    steps:
288    - name: Install Flex and Bison
289      run: |
290        curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
291        7z x flexbison.7z -O${{github.workspace}}\bin
292        echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
293        echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
294        echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
295    - name: Add CL to PATH
296      uses: ilammy/msvc-dev-cmd@v1
297      with:
298        arch: amd64_x86
299    - uses: actions/checkout@v4
300      with:
301        path: src
302    - name: Configure
303      run: |
304        mkdir build
305        cd build
306        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
307    - name: Build
308      run: cmake --build ${{github.workspace}}\build --target bootcd --target livecd
309