1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-02-20 13:54:14 +01:00

Start using Github Actions (#83)

* Start using Github Actions

Test on all platforms. SourceHook tests are broken on windows
so allow failures until they're fixed.

* Only run the workflow for the master branch
This commit is contained in:
peace-maker 2021-05-07 10:49:22 +02:00 committed by GitHub
parent 80d3f9c14d
commit 076717b6f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 177 additions and 11 deletions

141
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,141 @@
name: Continuous Integration
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
strategy:
matrix:
include:
- os: windows-latest
os_short: windows
compiler_cc: msvc-vs2019
- os: windows-2016
os_short: windows
compiler_cc: msvc-vs2017
- os: ubuntu-latest
os_short: linux
compiler_cc: clang
compiler_cxx: clang++
- os: ubuntu-18.04
os_short: linux
compiler_cc: clang-3.9
compiler_cxx: clang++-3.9
compiler_install: clang-3.9
- os: ubuntu-18.04
os_short: linux
compiler_cc: gcc-6
compiler_cxx: g++-6
compiler_install: 'gcc-6 g++6 g++-6-multilib'
- os: macos-latest
os_short: mac
compiler_cc: clang
compiler_cxx: clang++
fail-fast: false
runs-on: ${{ matrix.os }}
name: ${{ matrix.os_short }}-${{ matrix.compiler_cc }}
env:
SDKS: '["episode1","tf2","l4d2","csgo","dota"]'
DEPENDENCIES_FOLDER: dependencies
DEPENDENCIES_ROOT: ${{ github.workspace }}/dependencies
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
path: metamod-source
- name: Select HL2SDKs
if: startsWith(runner.os, 'Windows')
run: echo 'SDKS=["episode1","tf2","l4d2","csgo","dota","insurgency"]' >> $GITHUB_ENV
- name: Cache dependencies
uses: actions/cache@v2
env:
cache-name: hl2sdk
with:
path: ${{ env.DEPENDENCIES_ROOT }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ join(fromJSON(env.SDKS), '') }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-
# Setup Python for AMBuild
- uses: actions/setup-python@v2
name: Setup Python 3.8
with:
python-version: 3.8
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
- name: Install dependencies
shell: bash
run: |
mkdir -p ${{ env.DEPENDENCIES_FOLDER }}
cd ${{ env.DEPENDENCIES_FOLDER }}
# Satisfy checkout-deps requirement for a "metamod-source" folder.
mkdir -p metamod-source
../metamod-source/support/checkout-deps.sh -s ${{ join(fromJSON(env.SDKS)) }}
- name: Install Linux dependencies
if: startsWith(runner.os, 'Linux')
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
gcc-multilib g++-multilib libstdc++6 lib32stdc++6 \
libc6-dev libc6-dev-i386 linux-libc-dev \
linux-libc-dev:i386 lib32z1-dev ${{ matrix.compiler_install }}
- name: Select clang compiler
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS')
run: |
echo "CC=${{ matrix.compiler_cc }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.compiler_cxx }}" >> $GITHUB_ENV
${{ matrix.compiler_cc }} --version
${{ matrix.compiler_cxx }} --version
- name: Build
working-directory: metamod-source
run: |
mkdir build
cd build
python ../configure.py --enable-optimize --sdks=${{ join(fromJSON(env.SDKS)) }} --hl2sdk-root=${{ env.DEPENDENCIES_ROOT }}
ambuild
- name: Test SourceHook (Optimized)
working-directory: metamod-source
shell: bash
# SourceHook tests are busted on Windows
continue-on-error: ${{ startsWith(runner.os, 'Windows') }}
run: |
mkdir build-sh-opt && cd build-sh-opt
python ../configure.py --enable-optimize --enable-tests --sdks=
ambuild
cd ./core/sourcehook/test/test_sourcehook
if [ -d "${{ matrix.os_short }}-x86" ]; then
./${{ matrix.os_short }}-x86/test_sourcehook -v
fi
if [ -d "${{ matrix.os_short }}-x86_64" ]; then
./${{ matrix.os_short }}-x86_64/test_sourcehook -v
fi
- name: Test SourceHook (Debug)
working-directory: metamod-source
shell: bash
# SourceHook tests are busted on Windows
continue-on-error: ${{ startsWith(runner.os, 'Windows') }}
run: |
mkdir build-sh-debug && cd build-sh-debug
python ../configure.py --enable-debug --enable-tests --sdks=
ambuild
cd ./core/sourcehook/test/test_sourcehook
if [ -d "${{ matrix.os_short }}-x86" ]; then
./${{ matrix.os_short }}-x86/test_sourcehook -v
fi
if [ -d "${{ matrix.os_short }}-x86_64" ]; then
./${{ matrix.os_short }}-x86_64/test_sourcehook -v
fi

View File

@ -225,6 +225,13 @@ class MMSConfig(object):
cxx.cxxflags += ['-Wno-deprecated-register']
else:
cxx.cxxflags += ['-Wno-deprecated']
# Work around SDK warnings.
if cxx.version >= 'clang-10.0' or cxx.version >= 'apple-clang-12.0':
cxx.cflags += [
'-Wno-implicit-int-float-conversion',
'-Wno-tautological-overlap-compare',
]
elif cxx.like('msvc'):
if builder.options.debug == '1':

View File

@ -3,6 +3,17 @@
trap "exit" INT
# List of HL2SDK branch names to download.
# ./checkout-deps.sh -s tf2,css
while getopts ":s:" opt; do
case $opt in
s) IFS=', ' read -r -a sdks <<< "$OPTARG"
;;
\?) echo "Invalid option -$OPTARG" >&2
;;
esac
done
ismac=0
iswin=0
@ -28,27 +39,34 @@ checkout ()
git clone $repo -b $branch $name
if [ -n "$origin" ]; then
cd $name
git remote rm origin
git remote add origin $origin
git remote set-url origin $origin
cd ..
fi
else
cd $name
if [ -n "$origin" ]; then
git remote set-url origin ../$repo
fi
git checkout $branch
git pull origin $branch
if [ -n "$origin" ]; then
git remote set-url origin $origin
fi
cd ..
fi
}
sdks=( csgo hl2dm nucleardawn l4d2 dods l4d css tf2 insurgency sdk2013 dota )
if [ -z ${sdks+x} ]; then
sdks=( csgo hl2dm nucleardawn l4d2 dods l4d css tf2 insurgency sdk2013 dota doi )
if [ $ismac -eq 0 ]; then
# Add these SDKs for Windows or Linux
sdks+=( orangebox blade episode1 bms )
if [ $ismac -eq 0 ]; then
# Add these SDKs for Windows or Linux
sdks+=( orangebox blade episode1 bms )
# Add more SDKs for Windows only
if [ $iswin -eq 1 ]; then
sdks+=( darkm swarm bgt eye contagion )
# Add more SDKs for Windows only
if [ $iswin -eq 1 ]; then
sdks+=( darkm swarm bgt eye contagion )
fi
fi
fi
@ -80,11 +98,11 @@ if [ -z "$python_cmd" ]; then
fi
fi
`$python_cmd -c "import ambuild2"` 2>&1 1>/dev/null
$python_cmd -c "import ambuild2" 2>&1 1>/dev/null
if [ $? -eq 1 ]; then
echo "AMBuild is required to build Metamod:Source"
`$python_cmd -m pip --version` 2>&1 1>/dev/null
$python_cmd -m pip --version 2>&1 1>/dev/null
if [ $? -eq 1 ]; then
echo "The detected Python installation does not have PIP"
echo "Installing the latest version of PIP available (VIA \"get-pip.py\")"