reactos/.github/workflows/build.yml
2021-05-04 01:10:22 +03:00

167 lines
6.8 KiB
YAML

name: Build
on: [push, pull_request]
jobs:
build-linux:
strategy:
matrix:
compiler: [gcc, clang]
arch: [i386, amd64]
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Get Runner arch
id: get_native_arch
run: |
gcc -march=native -Q --help=target | grep "\-march= " | awk '{print $NF}'
echo ::set-output name=march::$(gcc -march=native -Q --help=target | grep "\-march= " | awk '{print $NF}')
- name: Get RosBE
uses: actions/cache@v2
with:
path: RosBE-CI
key: RosBE-CI-${{runner.os}}-${{steps.get_native_arch.outputs.march}}
- name: Compile RosBE
run: |
wget https://gist.githubusercontent.com/zefklop/b2d6a0b470c70183e93d5285a03f5899/raw/build_rosbe_ci.sh
chmod +x build_rosbe_ci.sh
./build_rosbe_ci.sh ${{github.workspace}}/RosBE-CI
- name: Install ccache
run: sudo apt install ccache
- name: Install LLVM
if: ${{ matrix.compiler == 'clang' }}
run: |
echo "LLVM_VERSION=12" >> $GITHUB_ENV
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh $LLVM_VERSION
- name: Source checkout
uses: actions/checkout@v2
with:
path: src
- name: Set up cache for ccache
uses: actions/cache@v2
with:
path: ccache
key: ccache-${{matrix.compiler}}-${{matrix.arch}}-${{github.sha}}
restore-keys: |
ccache-${{matrix.compiler}}-${{matrix.arch}}-
- name: Set ccache settings
run: |
echo "CCACHE_BASEDIR=${{github.workspace}}" >> $GITHUB_ENV
echo "CCACHE_DIR=${{github.workspace}}/ccache" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=1G" >> $GITHUB_ENV
echo "CCACHE_SLOPPINESS=time_macros" >> $GITHUB_ENV
echo "CCACHE_COMPILERCHECK=string:${{hashfiles('./build_rosbe_ci.sh', './RosBE-CI/git-commit')}}" >> $GITHUB_ENV
- name: Configure
run: echo 'cmake -S src -B build -G Ninja -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-${{matrix.compiler}}.cmake -DARCH:STRING=${{matrix.arch}} -DENABLE_CCACHE=1 -DENABLE_ROSTESTS=1 -DENABLE_ROSAPPS=1 -DCLANG_VERSION=${{env.LLVM_VERSION}}' | ${{github.workspace}}/RosBE-CI/RosBE.sh . 0 ${{matrix.arch}}
- name: Build
working-directory: ${{github.workspace}}/build
run: echo 'cmake --build .' | ${{github.workspace}}/RosBE-CI/RosBE.sh . 0 ${{matrix.arch}}
- name: Generate ISOs
working-directory: ${{github.workspace}}/build
run: echo 'cmake --build . --target bootcd --target livecd' | ${{github.workspace}}/RosBE-CI/RosBE.sh . 0 ${{matrix.arch}}
- name: Print ccache statistics
run: ccache -s
- name: Upload bootcd
uses: actions/upload-artifact@v2
with:
name: reactos-${{matrix.compiler}}-${{matrix.arch}}-${{github.sha}}
path: build/bootcd.iso
- name: Upload livecd
uses: actions/upload-artifact@v2
with:
name: reactos-${{matrix.compiler}}-${{matrix.arch}}-${{github.sha}}
path: build/livecd.iso
build-msvc:
strategy:
matrix:
compiler: [msvc, clang-cl]
arch: [i386, amd64]
fail-fast: false
runs-on: windows-latest
steps:
- name: Install ninja
run: choco install -y ninja
- name: Install LLVM (x86)
if: ${{ (matrix.compiler == 'clang-cl') && (matrix.arch == 'i386') }}
run: |
choco install --x86 -y llvm
echo "LLVM_PATH=${env:PROGRAMFILES(X86)}\llvm\bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install LLVM (amd64)
if: ${{ (matrix.compiler == 'clang-cl') && (matrix.arch == 'amd64') }}
run: |
choco install -y llvm
echo "LLVM_PATH=${env:PROGRAMFILES}\llvm\bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install Flex & Bison
run: |
curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
7z x flexbison.7z -O${{github.workspace}}\bin
echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Activate VS cmd (x86)
if: ${{ matrix.arch == 'i386' }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64_x86
- name: Activate VS cmd (amd64)
if: ${{ matrix.arch == 'amd64' }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- name: Add LLVM to PATH
if: ${{ matrix.compiler == 'clang-cl' }}
run: echo "${env:LLVM_PATH}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Source checkout
uses: actions/checkout@v2
with:
path: src
- name: Configure
working-directory: ${{github.workspace}}\build
run: cmake -S src -B build -G Ninja -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=${{matrix.arch}} -DENABLE_ROSTESTS=1 -DENABLE_ROSAPPS=1 -DUSE_CLANG_CL:BOOL=${{matrix.compiler == 'clang-cl'}}
- name: Build
working-directory: ${{github.workspace}}\build
run: cmake --build .
- name: Generate ISOs
working-directory: ${{github.workspace}}\build
run: |
cmake --build . --target bootcd
cmake --build . --target livecd
- name: Upload bootcd
uses: actions/upload-artifact@v2
with:
name: reactos-${{matrix.compiler}}-${{matrix.arch}}-${{github.sha}}
path: build/bootcd.iso
- name: Upload livecd
uses: actions/upload-artifact@v2
with:
name: reactos-${{matrix.compiler}}-${{matrix.arch}}-${{github.sha}}
path: build/livecd.iso
build-msbuild-i386:
name: MSBuild (i386)
runs-on: windows-latest
steps:
- name: Install Flex and Bison
run: |
curl -O https://svn.reactos.org/storage/vperevertkin/flexbison.7z
7z x flexbison.7z -O${{github.workspace}}\bin
echo "${{github.workspace}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "BISON_PKGDATADIR=${{github.workspace}}\bin\share\bison" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "M4=${{github.workspace}}\bin\m4.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Add CL to PATH
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64_x86
- uses: actions/checkout@v2
with:
path: src
- name: Configure
run: |
mkdir build
cd build
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
- name: Build
run: cmake --build ${{github.workspace}}\build --target bootcd --target livecd