Skip to content

Commit

Permalink
Merge pull request #27 from rehlds/master
Browse files Browse the repository at this point in the history
同步官方分支
  • Loading branch information
jonathan-up authored Nov 17, 2024
2 parents 16b24f9 + 7738142 commit 2a9dbb8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 73 deletions.
106 changes: 34 additions & 72 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
with:
vs-version: '16.8'
vs-version: '16'

- name: Build and Run unittests
run: |
Expand All @@ -58,95 +58,68 @@ jobs:
move msvc\${{ env.buildRelease }}\mp.pdb publish\debug\mp.pdb
- name: Deploy artifacts
uses: actions/upload-artifact@v3.1.1
uses: actions/upload-artifact@v4
with:
name: win32
path: publish/*

testdemos:
name: 'Test demos'
runs-on: ubuntu-20.04
container: s1lentq/testdemos:latest
runs-on: ubuntu-latest
container: rehldsorg/testdemos:latest
needs: [windows]

env:
WINEDEBUG: -all
WINEDLLOVERRIDES: mshtml=
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

defaults:
run:
shell: bash
working-directory: ../../../opt/HLDS
working-directory: /opt/HLDS

strategy:
fail-fast: false
matrix:
test: [
{ file: 'cstrike-basic-1', desc: 'CS: Testing jumping, scenarios, shooting etc' },
]

steps:
- name: Deploying windows artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: win32

- name: Play demos
- name: Setup dependencies
run: |
chown root ~
rsync -a deps/regamedll/* .
mv $GITHUB_WORKSPACE/tests/mp.dll cstrike/dlls/mp.dll
descs=(
"CS: Testing jumping, scenarios, shooting etc"
)
demos=(
"cstrike-basic-1"
)
retVal=0
for i in "${!demos[@]}"; do
params=$(cat "testdemos/${demos[i]}.params")
echo -e "\e[1m[$((i + 1))/${#demos[@]}] \e[1;36m${descs[i]} testing...\e[0m"
echo -e " - \e[0;33mParameters $params\e[0m"
wine hlds.exe --rehlds-enable-all-hooks --rehlds-test-play "testdemos/${demos[i]}.bin" $params &> result.log || retVal=$?
if [ $retVal -ne 777 ] && [ $retVal -ne 9 ]; then
# Print with catchy messages
while read line; do
echo -e " \e[0;33m$line"
done <<< $(cat result.log | sed '0,/demo failed/I!d;/wine:/d;/./,$!d')
echo " 🔸 🔸 🔸 🔸 🔸 🔸 🔸 🔸 🔸 🔸"
while read line; do
echo -e " \e[1;31m$line";
done < rehlds_demo_error.txt
echo -e " \e[30;41mExit code: $retVal\e[0m"
echo -e "\e[1m[$((i + 1))/${#demos[@]}] \e[1;36m${descs[i]} testing...\e[1;31m Failed ❌"
exit 6 # Test demo failed
else
# Print result HLDS console
while read line; do
echo -e " \e[0;33m$line"
done <<< $(cat result.log | sed '/wine:/d;/./,$!d')
echo -e " \e[30;43mExit code: $retVal\e[0m"
echo -e "\e[1m[$((i + 1))/${#demos[@]}] \e[1;36m${descs[i]} testing...\e[1;32m Succeed ✔"
fi
done
- name: Play test
env:
demo: ${{ matrix.test.file }}
desc: ${{ matrix.test.desc }}
run: ./runTest.sh

linux:
name: 'Linux'
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container: debian:11-slim

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- name: Check dependencies
- name: Install dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib
dpkg --add-architecture i386
apt-get update
apt-get install -y \
gcc-multilib g++-multilib \
build-essential \
libc6-dev libc6-dev-i386 \
git cmake rsync \
g++ gcc
- name: Build and Run unittests
run: |
Expand All @@ -171,7 +144,7 @@ jobs:
fi
shell: bash

- name: Build
- name: Build using GCC Compiler
run: |
rm -rf build && CC=gcc CXX=g++ cmake -B build && cmake --build build -j8
Expand Down Expand Up @@ -199,31 +172,25 @@ jobs:
shell: bash

- name: Deploy artifacts
uses: actions/upload-artifact@v3.1.1
uses: actions/upload-artifact@v4
id: upload-job
with:
name: linux32
path: publish/*

- name: Cleanup temporary artifacts
if: success() && steps.upload-job.outcome == 'success'
run: |
rm -rf cssdk
rm -f appversion.h
publish:
name: 'Publish'
runs-on: ubuntu-latest
needs: [windows, testdemos, linux]

steps:
- name: Deploying linux artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: linux32

- name: Deploying windows artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: win32

Expand Down Expand Up @@ -264,8 +231,3 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}

- name: Cleanup temporary artifacts
if: success() && steps.publish-job.outcome == 'success'
run: |
rm -rf bin dist debug cssdk
rm -f *.zip appversion.h
2 changes: 1 addition & 1 deletion regamedll/dlls/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4307,7 +4307,7 @@ void ClientPrecache()
PRECACHE_GENERIC("sprites/scope_arc_ne.tga");
PRECACHE_GENERIC("sprites/scope_arc_sw.tga");

m_usResetDecals = g_engfuncs.pfnPrecacheEvent(1, "events/decal_reset.sc");
m_usResetDecals = PRECACHE_EVENT(1, "events/decal_reset.sc");
}

const char *EXT_FUNC GetGameDescription()
Expand Down

0 comments on commit 2a9dbb8

Please sign in to comment.