Skip to content

Introduce test apps & data #43

Introduce test apps & data

Introduce test apps & data #43

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
job:
name: ${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.compiler }}
runs-on: ${{ matrix.run-on }}
strategy:
fail-fast: false
matrix:
run-on: [ubuntu-latest, windows-latest]
compiler: [any]
include:
- run-on: windows-latest
triplet: x64-windows-static-release
arch: x86_64
platform: windows
compiler: msvc
- run-on: ubuntu-latest
triplet: x64-linux-release
arch: x86_64
platform: linux
compiler: gcc
- run-on: ubuntu-latest
triplet: x64-linux-release
arch: x86_64
platform: linux
compiler: clang
exclude:
- compiler: any
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
VCPKG_GIT_COMMIT_ID: "f6a5d4e8eb7476b8d7fc12a56dff300c1c986131"
steps:
- name: Install gcc-13
if: runner.os == 'Linux'
run: |
wget --no-verbose http://kayari.org/gcc-latest/gcc-latest_13.0.1-20230326git55bc61a75a68.deb
sudo dpkg -i gcc-latest_13.0.1-20230326git55bc61a75a68.deb
echo "/opt/gcc-latest/bin" >> $GITHUB_PATH
echo "LD_RUN_PATH=/opt/gcc-latest/lib64" >> $GITHUB_ENV
- name: Install clang-17(dev)
if: runner.os == 'Linux' && matrix.compiler == 'clang'
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy main'
sudo apt update
sudo apt install clang-17 llvm-17-dev
echo "CC=clang-17" >> $GITHUB_ENV
echo "CXX=clang++-17" >> $GITHUB_ENV
echo "CFLAGS=--gcc-toolchain=/opt/gcc-latest" >> $GITHUB_ENV
echo "CXXFLAGS=--gcc-toolchain=/opt/gcc-latest" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.25.0"
ninjaVersion: "^1.11.1"
- uses: TheMrMilchmann/setup-msvc-dev@v2
if: runner.os == 'Windows'
with:
arch: x64
- name: Setup vcpkg (windows)
if: runner.os == 'Windows'
run: |
cd "C:\"
if(Test-Path C:\vcpkg) { rm -r -Force "C:\vcpkg" }
git clone --depth 1 --branch "2023.06.20" https://github.com/microsoft/vcpkg.git
- name: Restore vcpkg-tool (windows)
if: runner.os == 'Windows'
id: restore-vcpkg-tool
uses: actions/cache/restore@v3
with:
path: C:\vcpkg\vcpkg.exe
key: windows-cache-vcpkg-tool
- name: Build vcpkg-tool (windows)
if: runner.os == 'Windows' && steps.restore-vcpkg-tool.outputs.cache-hit != 'true'
run: |
cd "C:\"
if(Test-Path C:\vcpkg-tool) { rm -r -Force "C:\vcpkg-tool" }
git clone --depth 1 --branch gha-upload-fixes https://github.com/albertziegenhagel/vcpkg-tool.git
cd "C:\vcpkg-tool"
mkdir build
cd build
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release
ninja
cp .\vcpkg.exe C:\vcpkg\
- name: Store vcpkg-tool (windows)
if: runner.os == 'Windows' && steps.restore-vcpkg-tool.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: C:\vcpkg\vcpkg.exe
key: ${{ steps.restore-vcpkg-tool.outputs.cache-primary-key }}
- name: Setup GHA cache
if: runner.os == 'Windows'
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Setup vcpkg (non-windows)
if: runner.os != 'Windows'
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: "${{ env.VCPKG_GIT_COMMIT_ID }}"
- name: Build & Test project (Windows)
if: runner.os == 'Windows'
run: |
cd '${{ github.workspace }}'
$env:VCPKG_BINARY_SOURCES="clear;x-gha,readwrite"
cmake --preset ci . -G Ninja -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release "-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }}" "-DVCPKG_INSTALL_OPTIONS=--debug"
cmake --build --preset ci .
ctest --preset ci
- name: Build & Test project (default)
uses: lukka/run-cmake@v10
if: runner.os == 'Linux' && matrix.compiler != 'clang'
with:
configurePreset: "ci"
configurePresetAdditionalArgs: "['-DCMAKE_BUILD_TYPE=Release', '-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }}', '-DVCPKG_VERBOSE=ON', '-DVCPKG_INSTALL_OPTIONS=--debug']"
buildPreset: "ci"
testPreset: "ci"
- name: Build & Test project (system LLVM)
uses: lukka/run-cmake@v10
if: runner.os == 'Linux' && matrix.compiler == 'clang'
with:
configurePreset: "ci"
configurePresetAdditionalArgs: "['-DCMAKE_BUILD_TYPE=Release', '-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }}', '-DLLVM_DIR=/usr/lib/llvm-17/lib/cmake/llvm/']"
buildPreset: "ci"
testPreset: "ci"
- name: Install
run: |
cmake --install ${{ github.workspace }}/build/ci --component server --prefix ${{ github.workspace }}/install
- name: Upload binaries
uses: actions/upload-artifact@v3
if: runner.os != 'Linux' || matrix.compiler == 'gcc'
with:
name: snail-server-${{ matrix.arch }}-${{ matrix.platform }}
path: ${{ github.workspace }}/install/bin/snail-server*