mirror of
https://github.com/rehlds/rehlds.git
synced 2024-12-29 08:05:50 +03:00
CI Workflow Improvements and Fixes (#1056)
chore(ci): standardize and update CI workflows for compatibility and consistency - Updated action versions (`checkout@v4`, `upload-artifact@v4`, `download-artifact@v4`) for enhanced compatibility and security - Removed unsecure Node.js version allowance to align with *-latest OS requirements - Downgraded MSBuild to version 16 to resolve CI compatibility issues - Migrated test demos to `rehldsorg/testdemos:latest` container with a streamlined testing approach via matrix strategy and `runTest.sh` - Standardized Linux dependency installation for consistent build environment across jobs - Unified CI workflow structure with `rehlds` and `regamedll` repositories for better consistency - Optimized artifact deployment steps and removed unnecessary cleanup operations Co-authored-by: s1lentq <s1lentsk@yandex.ru>
This commit is contained in:
parent
fe184a82e0
commit
5a1f66a6b4
123
.github/workflows/build.yml
vendored
123
.github/workflows/build.yml
vendored
@ -11,9 +11,6 @@ on:
|
|||||||
release:
|
release:
|
||||||
types: [published]
|
types: [published]
|
||||||
|
|
||||||
env:
|
|
||||||
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
windows:
|
windows:
|
||||||
name: 'Windows'
|
name: 'Windows'
|
||||||
@ -28,12 +25,12 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup MSBuild
|
- name: Setup MSBuild
|
||||||
uses: microsoft/setup-msbuild@v1.1.3
|
uses: microsoft/setup-msbuild@v2
|
||||||
|
|
||||||
- name: Build and Run unittests
|
- name: Build and Run unittests
|
||||||
run: |
|
run: |
|
||||||
@ -73,7 +70,7 @@ jobs:
|
|||||||
move msvc\${{ env.buildRelease }}\director.pdb publish\debug\director.pdb
|
move msvc\${{ env.buildRelease }}\director.pdb publish\debug\director.pdb
|
||||||
|
|
||||||
- name: Deploy artifacts
|
- name: Deploy artifacts
|
||||||
uses: actions/upload-artifact@v3.1.1
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: win32
|
name: win32
|
||||||
path: publish/*
|
path: publish/*
|
||||||
@ -81,90 +78,66 @@ jobs:
|
|||||||
testdemos:
|
testdemos:
|
||||||
name: 'Test demos'
|
name: 'Test demos'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: s1lentq/testdemos:latest
|
container: rehldsorg/testdemos:latest
|
||||||
needs: [windows]
|
needs: [windows]
|
||||||
|
|
||||||
env:
|
|
||||||
WINEDEBUG: -all
|
|
||||||
WINEDLLOVERRIDES: mshtml=
|
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: ../../../opt/HLDS
|
working-directory: /opt/HLDS
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
test: [
|
||||||
|
{ file: 'cstrike-muliplayer-1', desc: 'CS: Multiplayer' },
|
||||||
|
{ file: 'rehlds-phys-single1', desc: 'Half-Life: Physics singleplayer' },
|
||||||
|
{ file: 'crossfire-1-multiplayer-1', desc: 'Half-Life: Multiplayer on crossfire map' },
|
||||||
|
{ file: 'shooting-hl-1', desc: 'Half-Life: Shooting with several weapons' },
|
||||||
|
]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Deploying windows artifacts
|
- name: Deploying windows artifacts
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: win32
|
name: win32
|
||||||
|
|
||||||
- name: Play demos
|
- name: Setup dependencies
|
||||||
run: |
|
run: |
|
||||||
chown root ~
|
chown root ~
|
||||||
rsync -a deps/rehlds/* .
|
rsync -a deps/rehlds/* .
|
||||||
mv $GITHUB_WORKSPACE/tests/swds.dll .
|
mv $GITHUB_WORKSPACE/tests/swds.dll .
|
||||||
|
|
||||||
descs=(
|
- name: Play test
|
||||||
"CS: Multiplayer"
|
env:
|
||||||
"Half-Life: Physics singleplayer"
|
demo: ${{ matrix.test.file }}
|
||||||
"Half-Life: Multiplayer on crossfire map"
|
desc: ${{ matrix.test.desc }}
|
||||||
"Half-Life: Shooting with several weapons"
|
run: ./runTest.sh
|
||||||
)
|
|
||||||
|
|
||||||
demos=(
|
|
||||||
"cstrike-muliplayer-1"
|
|
||||||
"rehlds-phys-single1"
|
|
||||||
"crossfire-1-multiplayer-1"
|
|
||||||
"shooting-hl-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
|
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
name: 'Linux'
|
name: 'Linux'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: s1lentq/linux86buildtools:latest
|
container: debian:11-slim
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
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
|
- name: Build and Run unittests
|
||||||
run: |
|
run: |
|
||||||
rm -rf build && CC=icc CXX=icpc cmake -DCMAKE_BUILD_TYPE=Unittests -B build && cmake --build build -j8
|
rm -rf build && cmake -DCMAKE_BUILD_TYPE=Unittests -B build && cmake --build build -j8
|
||||||
retVal=0
|
retVal=0
|
||||||
export LD_LIBRARY_PATH="rehlds/lib/linux32:$LD_LIBRARY_PATH"
|
export LD_LIBRARY_PATH="rehlds/lib/linux32:$LD_LIBRARY_PATH"
|
||||||
./build/rehlds/engine_i486 2> /dev/null > result.log || retVal=$?
|
./build/rehlds/engine_i486 2> /dev/null > result.log || retVal=$?
|
||||||
@ -186,9 +159,9 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Build using Intel C++ Compiler
|
- name: Build using GCC Compiler
|
||||||
run: |
|
run: |
|
||||||
rm -rf build && CC=icc CXX=icpc cmake -B build && cmake --build build -j8
|
rm -rf build && cmake -B build && cmake --build build -j8
|
||||||
|
|
||||||
- name: Prepare HLSDK
|
- name: Prepare HLSDK
|
||||||
run: |
|
run: |
|
||||||
@ -231,18 +204,12 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Deploy artifacts
|
- name: Deploy artifacts
|
||||||
uses: actions/upload-artifact@v3.1.1
|
uses: actions/upload-artifact@v4
|
||||||
id: upload-job
|
id: upload-job
|
||||||
with:
|
with:
|
||||||
name: linux32
|
name: linux32
|
||||||
path: publish/*
|
path: publish/*
|
||||||
|
|
||||||
- name: Cleanup temporary artifacts
|
|
||||||
if: success() && steps.upload-job.outcome == 'success'
|
|
||||||
run: |
|
|
||||||
rm -rf hlsdk
|
|
||||||
rm -f appversion.h
|
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
name: 'Publish'
|
name: 'Publish'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -250,12 +217,12 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Deploying linux artifacts
|
- name: Deploying linux artifacts
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: linux32
|
name: linux32
|
||||||
|
|
||||||
- name: Deploying windows artifacts
|
- name: Deploying windows artifacts
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: win32
|
name: win32
|
||||||
|
|
||||||
@ -284,7 +251,7 @@ jobs:
|
|||||||
7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -aoa rehlds-dbg-${{ env.APP_VERSION }}.7z debug/
|
7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -aoa rehlds-dbg-${{ env.APP_VERSION }}.7z debug/
|
||||||
|
|
||||||
- name: Publish artifacts
|
- name: Publish artifacts
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v2
|
||||||
id: publish-job
|
id: publish-job
|
||||||
if: |
|
if: |
|
||||||
startsWith(github.ref, 'refs/tags/') &&
|
startsWith(github.ref, 'refs/tags/') &&
|
||||||
@ -295,9 +262,3 @@ jobs:
|
|||||||
*.7z
|
*.7z
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}
|
||||||
|
|
||||||
- name: Cleanup temporary artifacts
|
|
||||||
if: success() && steps.publish-job.outcome == 'success'
|
|
||||||
run: |
|
|
||||||
rm -rf bin debug hlsdk
|
|
||||||
rm -f *.7z *.zip appversion.h
|
|
||||||
|
Loading…
Reference in New Issue
Block a user