Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run basic native tests using hl2sdk-mock in CI (#2015)
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".
- Loading branch information
1 parent
cb85415
commit 2ef874d
Showing
3 changed files
with
462 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.