2ef874dbc9
This tests the sorting.inc API similar to the existing test plugin in the plugins/testsuite folder. Tests fail if the srcds output contains "FAIL".
105 lines
3.2 KiB
YAML
105 lines
3.2 KiB
YAML
name: hl2sdk-mock tests
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- '[0-9]+.[0-9]+-dev'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- '[0-9]+.[0-9]+-dev'
|
|
jobs:
|
|
mock:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
name: Clone sourcemod
|
|
with:
|
|
submodules: recursive
|
|
path: sourcemod
|
|
|
|
- uses: actions/checkout@v3
|
|
name: Clone metamod-source
|
|
with:
|
|
repository: alliedmodders/metamod-source
|
|
submodules: recursive
|
|
path: metamod-source
|
|
|
|
- uses: actions/checkout@v3
|
|
name: Clone hl2sdk-mock
|
|
with:
|
|
repository: alliedmodders/hl2sdk-mock
|
|
submodules: recursive
|
|
path: hl2sdk-mock
|
|
|
|
- uses: actions/setup-python@v4
|
|
name: Setup Python 3.10
|
|
with:
|
|
python-version: "3.10"
|
|
|
|
- name: Install AMBuild
|
|
run: |
|
|
python -m pip install --upgrade pip setuptools wheel
|
|
pip install git+https://github.com/alliedmodders/ambuild
|
|
|
|
- name: Build MetaMod:Source
|
|
working-directory: metamod-source
|
|
run: |
|
|
python configure.py --enable-optimize --sdks=mock --targets=x86_64
|
|
ambuild objdir
|
|
|
|
- name: Build SourceMod
|
|
working-directory: sourcemod
|
|
run: |
|
|
python configure.py --no-mysql --enable-optimize --sdks=mock --targets=x86_64
|
|
ambuild objdir
|
|
|
|
- name: Build hl2sdk-mock
|
|
working-directory: hl2sdk-mock
|
|
run: |
|
|
python configure.py --enable-optimize --targets=x86_64
|
|
ambuild objdir
|
|
|
|
- name: Setup gamedir
|
|
working-directory: hl2sdk-mock
|
|
shell: bash
|
|
run: |
|
|
mkdir ../gamedir
|
|
./build_gamedir.sh ../gamedir ../metamod-source/objdir/package
|
|
./build_gamedir.sh ../gamedir ../sourcemod/objdir/package
|
|
|
|
- name: Compile testsuite
|
|
working-directory: hl2sdk-mock
|
|
shell: bash
|
|
run: |
|
|
mkdir ../gamedir/addons/sourcemod/plugins/optional
|
|
|
|
for f in ../sourcemod/plugins/testsuite/mock/*.sp; do
|
|
echo "Compiling $(basename $f)"
|
|
../gamedir/addons/sourcemod/scripting/spcomp64 -i ../gamedir/addons/sourcemod/scripting/include -o "../gamedir/addons/sourcemod/plugins/optional/$(basename $f .sp).smx" -E "$f"
|
|
done
|
|
|
|
- name: Test
|
|
working-directory: hl2sdk-mock
|
|
shell: bash
|
|
run: |
|
|
for f in ../gamedir/addons/sourcemod/plugins/optional/*.smx; do
|
|
echo "==================================="
|
|
echo "Running $(basename $f)..."
|
|
echo "==================================="
|
|
timeout 60 ./objdir/dist/x86_64/srcds -game_dir ../gamedir +map de_thunder -command "sm plugins load optional/$(basename $f)" -run -run-ticks 20 |
|
|
{
|
|
failed=0
|
|
while IFS= read -r line; do
|
|
echo "$line"
|
|
if [[ "$line" == *"FAIL"* ]]; then
|
|
failed=1
|
|
fi
|
|
done
|
|
if [ "$failed" = "1" ]; then
|
|
echo "$(basename $f) failed."
|
|
exit 1
|
|
fi
|
|
}
|
|
done
|