mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* by default on windows the clib pch shouldnt be reused and instead rebuild * activate reuse_pch for windows ci build * changed pch header from public to private
253 lines
8.1 KiB
YAML
253 lines
8.1 KiB
YAML
name: Build
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
config:
|
|
- os: "windows-latest"
|
|
cxx-compiler: cl
|
|
c-compiler: cl
|
|
compiler-version: default
|
|
build-type: Release
|
|
nopch: 0
|
|
|
|
- os: "ubuntu-latest"
|
|
cxx-compiler: g++
|
|
c-compiler: gcc
|
|
compiler-version: 9
|
|
build-type: RelWithDebInfo
|
|
nopch: 0
|
|
|
|
- os: "ubuntu-latest"
|
|
cxx-compiler: clang++
|
|
c-compiler: clang
|
|
compiler-version: 8
|
|
build-type: RelWithDebInfo
|
|
nopch: 0
|
|
|
|
- os: "ubuntu-latest"
|
|
cxx-compiler: clang++
|
|
c-compiler: clang
|
|
compiler-version: 8
|
|
build-type: Release
|
|
nopch: 1
|
|
|
|
runs-on: ${{ matrix.config.os }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- uses: actions/setup-python@v1
|
|
- uses: seanmiddleditch/gha-setup-vsdevenv@v1
|
|
- name: Cache curl
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: lib/curl-7.57.0
|
|
key: ${{ runner.os }}-${{ matrix.config.cxx-compiler }}-${{ matrix.config.compiler-version }}-c++17-buildtype-curl-7.57.0
|
|
- name: Cache antlr
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: lib/antlr
|
|
key: ${{ runner.os }}-${{ matrix.config.cxx-compiler }}-${{ matrix.config.compiler-version }}-antlr-buildtypefix
|
|
|
|
- name: Install Compiler and Dependencies
|
|
if: matrix.config.os == 'ubuntu-latest'
|
|
shell: pwsh
|
|
run: |
|
|
sudo apt-get update
|
|
|
|
$compiler = "${{ matrix.config.cxx-compiler }}"
|
|
$version = "${{ matrix.config.compiler-version }}"
|
|
|
|
if ($version -ne 'default') {
|
|
sudo apt-get install "$compiler-$version" -y
|
|
echo "$compiler-$version --version"
|
|
}
|
|
sudo apt-get install mysql-client libmysqlclient-dev kwstyle uuid-dev -y
|
|
|
|
$ninja_version = "1.9.0"
|
|
$cmake_version = "3.16.2"
|
|
$cmake_archive = "cmake-$cmake_version-Linux-x86_64"
|
|
wget -q "https://github.com/ninja-build/ninja/releases/download/v$ninja_version/ninja-linux.zip"
|
|
unzip -q ninja-linux.zip -d bin-build
|
|
wget -q "https://github.com/Kitware/CMake/releases/download/v$cmake_version/$cmake_archive.tar.gz"
|
|
tar -xf "$cmake_archive.tar.gz"
|
|
|
|
chmod +x bin-build/ninja
|
|
chmod +x "$cmake_archive/bin/cmake"
|
|
echo "::add-path::$Env:GITHUB_WORKSPACE/bin-build"
|
|
echo "::add-path::$Env:GITHUB_WORKSPACE/$cmake_archive/bin"
|
|
|
|
- name: Set CXX and CC
|
|
shell: pwsh
|
|
run: |
|
|
$cxx_compiler = '${{ matrix.config.cxx-compiler }}'
|
|
$c_compiler = '${{ matrix.config.c-compiler }}'
|
|
$version = '${{ matrix.config.compiler-version }}'
|
|
|
|
if ($version -ne 'default') {
|
|
$cxx_compiler = "$cxx_compiler-$version"
|
|
$c_compiler = "$c_compiler-$version"
|
|
}
|
|
|
|
echo "::set-env name=CXX::$cxx_compiler"
|
|
echo "::set-env name=CC::$c_compiler"
|
|
|
|
- name: Config
|
|
run: |
|
|
cd bin-build
|
|
cmake .. -G Ninja -DREUSE_PCH=1 -DNO_PCH=${{ matrix.config.nopch }} -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }}
|
|
- name: Build
|
|
run: |
|
|
cd bin-build
|
|
cmake --build . --config ${{ matrix.config.build-type }} -- -j 2
|
|
|
|
- name: Test (EScript)
|
|
if: matrix.config.nopch == 0
|
|
run: |
|
|
cd bin-build
|
|
ctest -j2 --output-on-failure --repeat-until-fail 2 -C ${{ matrix.config.build-type }} -R escript_
|
|
- name: Test (Shard)
|
|
if: matrix.config.nopch == 0
|
|
run: |
|
|
cd bin-build
|
|
ctest -j2 --output-on-failure -C ${{ matrix.config.build-type }} -E escript_
|
|
- name: Upload shard test log
|
|
if: matrix.config.nopch == 0
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: Testlog-${{ runner.os }}-${{ matrix.config.cxx-compiler }}
|
|
path: bin-build/coretest/log/pol.log
|
|
- name: Stylecheck
|
|
if: matrix.config.cxx-compiler == 'g++'
|
|
run: |
|
|
cd testsuite/style
|
|
./checknl.py -q
|
|
./checkstyle.py -q
|
|
|
|
- name: Create Artefact
|
|
if: matrix.config.nopch == 0
|
|
run: |
|
|
cd bin-build
|
|
cmake --build . --config ${{ matrix.config.build-type }} --target package
|
|
cd ../bin
|
|
mkdir release
|
|
mv *.zip release
|
|
- name: Create Artefact (dbg)
|
|
if: matrix.config.os == 'ubuntu-latest' && matrix.config.nopch == 0
|
|
run: |
|
|
cd bin-build
|
|
cmake --build . --config ${{ matrix.config.build-type }} --target create_dbg_zip
|
|
cd ../bin
|
|
mv *.zip release
|
|
|
|
- name: Upload Artefact
|
|
if: matrix.config.nopch == 0
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: Nightly-${{ runner.os }}-${{ matrix.config.cxx-compiler }}
|
|
path: bin/release
|
|
|
|
release:
|
|
needs: build
|
|
runs-on: "ubuntu-latest"
|
|
if: github.ref == 'refs/heads/master'
|
|
steps:
|
|
- name: Download artefacts
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: Nightly-Linux-g++
|
|
- name: Download artefacts
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: Nightly-Linux-clang++
|
|
- name: Download artefacts
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: Nightly-Windows-cl
|
|
|
|
- name: Create Release zip
|
|
run: |
|
|
zip -j Nightly-Windows.zip Nightly-Windows-cl/*
|
|
zip -j Nightly-Linux-gcc.zip Nightly-Linux-g++/*
|
|
zip -j Nightly-Linux-clang.zip Nightly-Linux-clang++/*
|
|
|
|
- name: Create Release
|
|
# fork until official release can overwrite tag/release
|
|
uses: turleypol/create-release@delete-old-release-asset
|
|
id: create_release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: NightlyRelease
|
|
release_name: NightlyRelease
|
|
replace_old_tag: true
|
|
prerelease: true
|
|
draft: false
|
|
- name: Upload Release Asset
|
|
uses: actions/upload-release-asset@v1.0.1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: Nightly-Windows.zip
|
|
asset_name: Nightly-Windows.zip
|
|
asset_content_type: application/
|
|
- name: Upload Release Asset
|
|
uses: actions/upload-release-asset@v1.0.1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: Nightly-Linux-gcc.zip
|
|
asset_name: Nightly-Linux-gcc.zip
|
|
asset_content_type: application/
|
|
- name: Upload Release Asset
|
|
uses: actions/upload-release-asset@v1.0.1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: Nightly-Linux-clang.zip
|
|
asset_name: Nightly-Linux-clang.zip
|
|
asset_content_type: application/
|
|
|
|
notify_on_failure:
|
|
needs: build
|
|
runs-on: "ubuntu-latest"
|
|
if: failure()
|
|
steps:
|
|
- name: Discord notification failure
|
|
env:
|
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
uses: turleypol/actions-status-discord@master
|
|
with:
|
|
status: failure
|
|
job: Building
|
|
notify_on_success:
|
|
needs: build
|
|
runs-on: "ubuntu-latest"
|
|
if: success()
|
|
steps:
|
|
- name: Discord notification success
|
|
env:
|
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
uses: turleypol/actions-status-discord@master
|
|
with:
|
|
status: success
|
|
job: Building
|
|
notify_on_cancel:
|
|
needs: build
|
|
runs-on: "ubuntu-latest"
|
|
if: cancelled()
|
|
steps:
|
|
- name: Discord notification cancelled
|
|
env:
|
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
uses: turleypol/actions-status-discord@master
|
|
with:
|
|
status: cancelled
|
|
job: Building
|