mirror of
https://github.com/worldforge/worldforge
synced 2026-08-17 16:26:05 -04:00
94 lines
3.7 KiB
YAML
94 lines
3.7 KiB
YAML
name: Build pull request
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
env:
|
|
CONAN_REVISIONS_ENABLED: 1
|
|
CONAN_SCM_TO_CONANDATA: 1
|
|
CONAN_SYSREQUIRES_MODE: enabled
|
|
PROFILE_CONAN: conan-release
|
|
CI: 1 #This will turn off a couple of warnings in the build
|
|
|
|
jobs:
|
|
build:
|
|
name: Build on *NIX and Windows
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
#Enable building on macOS when it can be fixed. Currently, we're getting SDL linking errors.
|
|
# os: [ ubuntu-22.04, macos-12, macos-11 ]
|
|
os: [ ubuntu-22.04, ubuntu-24.04, windows-2022 ]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4.2.2
|
|
|
|
- name: Workaround preset name difference
|
|
if: runner.os == 'Windows'
|
|
shell: bash
|
|
run: echo "PROFILE_CONAN=conan-default" >> $GITHUB_ENV
|
|
|
|
- name: Use ccache
|
|
uses: hendrikmuhs/ccache-action@v1.2
|
|
with:
|
|
key: ${{ github.job }}-${{ matrix.os }}
|
|
|
|
- name: Setup environment
|
|
shell: bash
|
|
run: |
|
|
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
|
|
|
- name: Install Mac tools
|
|
shell: bash
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
brew install autoconf automake
|
|
|
|
- name: Install Windows tools
|
|
if: runner.os == 'Windows'
|
|
uses: "GuillaumeFalourd/setup-rsync@v1.2"
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.10'
|
|
cache: 'pip'
|
|
|
|
- name: Install Conan
|
|
shell: bash
|
|
run: |
|
|
pip install -r .github/workflows/requirements.txt
|
|
conan profile detect
|
|
#Set the default profile to use g++ 17 it it's not detected
|
|
sed -i.backup 's/compiler.cppstd=14/compiler.cppstd=17/g' ~/.conan2/profiles/default
|
|
conan remote add worldforge https://artifactory.ogenvik.org/artifactory/api/conan/conan-local
|
|
|
|
- name: Have Conan install packages
|
|
shell: bash
|
|
run: |
|
|
export PATH=~/.local/bin:$PATH
|
|
conan install . -pr default --build=missing -c tools.system.package_manager:mode=install -c tools.system.package_manager:sudo=True --lockfile-partial
|
|
if [[ x"$CONAN_PASSWORD" != "x" && x"$CONAN_LOGIN_USERNAME" != "x" ]]; then
|
|
conan remote login worldforge $CONAN_LOGIN_USERNAME -p $CONAN_PASSWORD
|
|
conan upload "*" -r worldforge -c
|
|
fi
|
|
|
|
- name: Configure CMake
|
|
shell: bash
|
|
#The -DCMAKE_C_FLAGS="-s" will strip all executables, which we want because we want to provide a Snap package
|
|
run: cmake --preset $PROFILE_CONAN . -DBUILD_TESTING=ON -DCMAKE_INSTALL_PREFIX=~/install/usr -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_FLAGS="-s" -DATLAS_GENERATE_OBJECTS=OFF -DATLAS_DISABLE_BENCHMARKS=ON
|
|
|
|
- name: Build
|
|
shell: bash
|
|
run: cmake --build --preset conan-release --parallel 4
|
|
|
|
- name: Test
|
|
shell: bash
|
|
run: |
|
|
if [[ "$ImageOS" == "win22" ]]; then
|
|
ctest --preset conan-release --output-on-failure
|
|
else
|
|
cmake --build --preset conan-release --parallel 4 --target check
|
|
fi
|