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