mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
339 lines
12 KiB
YAML
339 lines
12 KiB
YAML
name: Build
|
|
|
|
on: [push, pull_request]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
name: ${{matrix.config.name}} Build
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
config:
|
|
- os: "windows-2025"
|
|
cxx-compiler: cl
|
|
c-compiler: cl
|
|
compiler-version: default
|
|
build-type: Debug
|
|
cmake-cfg: ""
|
|
tests: true
|
|
name: Windows CL
|
|
|
|
- os: "ubuntu-latest"
|
|
cxx-compiler: g++
|
|
c-compiler: gcc
|
|
compiler-version: 12
|
|
build-type: Debug
|
|
cmake-cfg: ""
|
|
tests: true
|
|
name: Linux GCC
|
|
|
|
- os: "ubuntu-latest"
|
|
cxx-compiler: clang++
|
|
c-compiler: clang
|
|
compiler-version: 16
|
|
build-type: Debug
|
|
cmake-cfg: ""
|
|
tests: true
|
|
name: Linux Clang
|
|
|
|
- os: "macos-14"
|
|
cxx-compiler: clang++
|
|
c-compiler: clang
|
|
compiler-version: default
|
|
build-type: Debug
|
|
cmake-cfg: "-DREUSE_PCH=1 -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64'"
|
|
tests: true
|
|
name: MacOS Clang
|
|
|
|
- os: "ubuntu-latest"
|
|
cxx-compiler: clang++
|
|
c-compiler: clang
|
|
compiler-version: 16
|
|
build-type: Release
|
|
cmake-cfg: "-DNO_PCH=1"
|
|
tests: false
|
|
name: Linux Clang noPCH
|
|
|
|
runs-on: ${{ matrix.config.os }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-python@v6
|
|
with:
|
|
python-version: '3.x'
|
|
- uses: egor-tensin/vs-shell@v2
|
|
- name: Cache curl
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: lib/curl-8_14_1
|
|
key: ${{ matrix.config.os }}-${{ matrix.config.cxx-compiler }}-${{ matrix.config.compiler-version }}-curl-8.14.1-2
|
|
- name: Cache antlr
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: lib/antlr-cb85012
|
|
key: ${{ matrix.config.os }}-${{ matrix.config.cxx-compiler }}-${{ matrix.config.compiler-version }}-antlr-cb85012-2
|
|
- name: Cache boost
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: lib/boost_1_91_0-1
|
|
key: ${{ matrix.config.os }}-${{ matrix.config.cxx-compiler }}-${{ matrix.config.compiler-version }}-boost-1.91.0-1
|
|
- name: Cache cppdap
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: lib/cppdap-82beeea
|
|
key: ${{ matrix.config.os }}-${{ matrix.config.cxx-compiler }}-${{ matrix.config.compiler-version }}-cppdap-82beeea-2
|
|
|
|
- name: Install Compiler and Dependencies (Linux)
|
|
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
|
|
}
|
|
sudo apt-get install kwstyle -y
|
|
sudo apt-get install uuid-dev -y
|
|
pip install aiosmtpd
|
|
|
|
$ninja_version = "1.12.1"
|
|
$cmake_version = "3.31.3"
|
|
$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 "$Env:GITHUB_WORKSPACE/bin-build" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
echo "$Env:GITHUB_WORKSPACE/$cmake_archive/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
|
|
- name: Install Dependencies (Windows)
|
|
if: startsWith( matrix.config.os, 'windows-' )
|
|
shell: pwsh
|
|
run: |
|
|
pip install aiosmtpd
|
|
|
|
- name: Install Dependencies (macOS)
|
|
if: startsWith( matrix.config.os, 'macos' )
|
|
shell: bash
|
|
run: |
|
|
set -e
|
|
/opt/homebrew/bin/pip3.13 install --break-system-packages aiosmtpd
|
|
brew bundle --file=bin-build/Brewfile
|
|
# Update the Homebrew-installed shared library binaries with the other architecture (amd64) via `brew-universalize`.
|
|
./bin-build/brew-universalize openssl@3 libssh2 zstd
|
|
OPENSSL_VERSION_INSTALLED=$(brew info --json openssl@3 | jq -r '.[0].installed[0].version')
|
|
echo "PKG_CONFIG_PATH=/opt/homebrew/Cellar/openssl@3/$OPENSSL_VERSION_INSTALLED/lib/pkgconfig:$Env:PKG_CONFIG_PATH" >> $GITHUB_ENV
|
|
#env:
|
|
#HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: '1'
|
|
|
|
|
|
- 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 "CXX=$cxx_compiler" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
echo "CC=$c_compiler" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
- name: Register problem matcher
|
|
run: echo "::add-matcher::.github/problem-matchers/${{ matrix.config.c-compiler }}.json"
|
|
|
|
- name: Config
|
|
run: |
|
|
cd bin-build
|
|
cmake .. -G Ninja ${{ matrix.config.cmake-cfg }} -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }}
|
|
- name: Build
|
|
run: |
|
|
cd bin-build
|
|
cmake --build . --config ${{ matrix.config.build-type }} -- -j 4
|
|
|
|
- name: Start MySQL (linux)
|
|
if: matrix.config.os == 'ubuntu-latest' && matrix.config.tests
|
|
shell: pwsh
|
|
run: |
|
|
sudo /etc/init.d/mysql start
|
|
mysql -e "CREATE DATABASE IF NOT EXISTS poltest;" -uroot -proot
|
|
echo "POLCORE_TESTSQL=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
- name: Start MySQL (win)
|
|
if: startsWith( matrix.config.os, 'windows-' )
|
|
run: |
|
|
mysqld --initialize-insecure
|
|
mysqld --install
|
|
net start MySQL
|
|
mysqladmin -u root --skip-password password root
|
|
mysql -e "CREATE DATABASE IF NOT EXISTS poltest;" -uroot -proot
|
|
echo "POLCORE_TESTSQL=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
- name: Start MySQL (macOS)
|
|
if: startsWith( matrix.config.os, 'macos' )
|
|
run: |
|
|
brew install mysql
|
|
mysql.server start
|
|
mysqladmin -u root --skip-password password root
|
|
mysql -e "CREATE DATABASE IF NOT EXISTS poltest;" -uroot -proot
|
|
echo "POLCORE_TESTSQL=1" >> $GITHUB_ENV
|
|
|
|
- name: Test (EScript)
|
|
if: matrix.config.tests
|
|
run: |
|
|
cd bin-build
|
|
cmake --build . --config ${{ matrix.config.build-type }} --target test_escript
|
|
- name: Test (Shard Fixtures)
|
|
if: matrix.config.tests
|
|
run: |
|
|
cd bin-build
|
|
cmake --build . --config ${{ matrix.config.build-type }} --target test_pol_fixture
|
|
- name: Test (UnitTests)
|
|
if: matrix.config.tests
|
|
run: |
|
|
cd bin-build
|
|
cmake --build . --config ${{ matrix.config.build-type }} --target unittest_pol
|
|
- name: Test (Shard)
|
|
if: matrix.config.tests
|
|
run: |
|
|
cd bin-build
|
|
cmake --build . --config ${{ matrix.config.build-type }} --target test_pol_only
|
|
#env:
|
|
#POLCORE_TEST_FILTER: testitems
|
|
- name: Testsummary
|
|
if: matrix.config.tests && always()
|
|
shell: bash
|
|
run: |
|
|
cd bin-build
|
|
{
|
|
python coretest/ci_summary.py Testing/Temporary/LastTest.log
|
|
} > "$GITHUB_STEP_SUMMARY"
|
|
- name: Test (Ecompile Watch)
|
|
if: matrix.config.tests
|
|
run: |
|
|
cd bin-build
|
|
cmake --build . --config ${{ matrix.config.build-type }} --target test_ecompile_watch
|
|
#env:
|
|
#POLCORE_TEST_FILTER: testitems
|
|
- name: Upload coretest folder
|
|
if: matrix.config.tests && always()
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: Testdir-${{ runner.os }}-${{ matrix.config.cxx-compiler }}
|
|
path: bin-build/coretest/
|
|
|
|
- name: Create Artefact
|
|
if: matrix.config.tests
|
|
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: ${{ !startsWith( matrix.config.os, 'windows-' ) && matrix.config.tests }}
|
|
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.tests
|
|
uses: actions/upload-artifact@v7
|
|
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@v8
|
|
with:
|
|
name: Nightly-Linux-g++
|
|
path: Nightly-Linux-g++
|
|
- name: Download artefacts
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: Nightly-Linux-clang++
|
|
path: Nightly-Linux-clang++
|
|
- name: Download artefacts
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: Nightly-Windows-cl
|
|
path: Nightly-Windows-cl
|
|
- name: Download artefacts
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: Nightly-macOS-clang++
|
|
path: Nightly-macOS-clang++
|
|
|
|
- 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++/*
|
|
zip -j Nightly-MacOS-clang.zip Nightly-macOS-clang++/*
|
|
|
|
- name: Create Release
|
|
uses: "turleypol/release_action_dist@master"
|
|
with:
|
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
|
automatic_release_tag: "NightlyRelease"
|
|
reference_release_tag: "v100.2.0"
|
|
prerelease: true
|
|
title: "Nightly Release"
|
|
files: |
|
|
Nightly-Windows.zip
|
|
Nightly-Linux-gcc.zip
|
|
Nightly-Linux-clang.zip
|
|
Nightly-MacOS-clang.zip
|
|
|
|
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
|