Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into death_cam_time
Browse files Browse the repository at this point in the history
  • Loading branch information
wopox1337 committed Mar 10, 2022
2 parents f2d29a8 + 972e14a commit cf39535
Show file tree
Hide file tree
Showing 167 changed files with 3,251 additions and 4,070 deletions.
4 changes: 0 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@

# Scripts
*.sh text eol=lf
gradlew text eol=lf
*.bat text eol=crlf
*.gradle text eol=crlf
*.groovy text eol=crlf
*.def text eol=crlf
*.fgd text eol=crlf
*.cfg text eol=crlf
*.properties text eol=crlf
*.vm text eol=crlf

# Compiled Object files
Expand Down
279 changes: 279 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
name: C/C++ CI

on:
push:
branches: [master]
paths-ignore:
- '**.md'

pull_request:
types: [opened, reopened, synchronize]
release:
types: [published]

jobs:
windows:
name: 'Windows'
runs-on: windows-2019

env:
solution: 'msvc/ReGameDLL.sln'
buildPlatform: 'Win32'
buildRelease: 'Release'
buildReleasePlay: 'Release Play'
buildTests: 'Tests'

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Nuget
uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NuGetAPIKey }}
nuget-version: '5.x'

- run: nuget restore '${{ env.solution }}'

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.0.2
with:
vs-version: '16.8'

- name: Build and Run unittests
run: |
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildTests }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false
.\"msvc\Tests\mp.exe"
If ($LASTEXITCODE -ne 0 -And
$LASTEXITCODE -ne 3)
{[Environment]::Exit(1)}
shell: "pwsh"

- name: Build
run: |
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildRelease }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildReleasePlay }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false
- name: Move files
run: |
mkdir publish\debug
mkdir publish\tests
mkdir publish\bin\win32\cstrike\dlls
move "msvc\${{ env.buildReleasePlay }}\mp.dll" publish\tests\mp.dll
move msvc\${{ env.buildRelease }}\mp.dll publish\bin\win32\cstrike\dlls\mp.dll
move msvc\${{ env.buildRelease }}\mp.pdb publish\debug\mp.pdb
- name: Deploy artifacts
uses: actions/upload-artifact@v2
with:
name: win32
path: publish/*

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

env:
WINEDEBUG: -all
WINEDLLOVERRIDES: mshtml=

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

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

- name: Play demos
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
linux:
name: 'Linux'
runs-on: ubuntu-latest
container: s1lentq/linux86buildtools:latest

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

- name: Build and Run unittests
run: |
rm -rf build && CC=icc CXX=icpc cmake -DCMAKE_BUILD_TYPE=Unittests -B build && cmake --build build -j8
retVal=0
./build/regamedll/cs 2> /dev/null > result.log || retVal=$?
while read line; do
if [[ ${line} == *"Warning in test"* ]] ; then
echo -e "\e[2;38m$line"
elif [[ ${line} == *"Failure in test"* ]] ; then
echo -e "\e[1;31m$line"
else
echo -e "\e[0;33m$line"
fi
done <<< $(cat result.log)
if [ $retVal -ne 0 ] && [ $retVal -ne 3 ]; then
echo -e "\e[30;41mExit code: $retVal\e[0m"
exit 1 # Unittest failed
else
echo -e "\e[30;43mExit code: $retVal\e[0m"
fi
shell: bash

- name: Build using Intel C++ Compiler 19.0
run: |
rm -rf build-icc && CC=icc CXX=icpc cmake -B build-icc && cmake --build build-icc -j8
- name: Build using GCC Compiler 9.3
run: |
rm -rf build-gcc && CC=gcc CXX=g++ cmake -B build-gcc && cmake --build build-gcc -j8
- name: Prepare CSSDK
run: |
mkdir -p publish/cssdk
rsync -a regamedll/extra/cssdk/ publish/cssdk/ --exclude=.git --exclude=LICENSE --exclude=README.md
- name: Move files
run: |
mkdir -p publish/bin/linux32/cstrike/dlls
mv build-icc/regamedll/cs.so publish/bin/linux32/cstrike/dlls/cs.so
mv build-gcc/regamedll/cs.so publish/cs-gcc.so
mv regamedll/version/appversion.h publish/appversion.h
mv dist/ publish/
- name: Run GLIBC/ABI version compat test
run: |
binaries=(
"publish/bin/linux32/cstrike/dlls/cs.so"
"publish/cs-gcc.so"
)
bash ./regamedll/version/glibc_test.sh ${binaries[@]}
if [[ $? -ne 0 ]]; then
exit 1 # Assertion failed
fi
shell: bash

- name: Deploy artifacts
uses: actions/upload-artifact@v2
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@v2
with:
name: linux32

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

- name: Reading appversion.h
run: |
if [ -e appversion.h ]; then
APP_VERSION=$(cat appversion.h | grep -wi '#define APP_VERSION_STRD' | sed -e 's/#define APP_VERSION_STRD[ \t\r\n\v\f]\+\(.*\)/\1/i' -e 's/\r//g')
if [ $? -ne 0 ]; then
APP_VERSION=""
else
# Remove quotes
APP_VERSION=$(echo $APP_VERSION | xargs)
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
fi
fi
rm -f appversion.h
- name: Packaging binaries
id: packaging-job
if: |
github.event_name == 'release' &&
github.event.action == 'published' &&
startsWith(github.ref, 'refs/tags/')
run: |
rsync -a dist/ bin/win32/cstrike
rsync -a dist/ bin/linux32/cstrike
7z a -tzip regamedll-bin-${{ env.APP_VERSION }}.zip bin/ cssdk/
- name: Publish artifacts
uses: softprops/action-gh-release@v1
id: publish-job
if: |
startsWith(github.ref, 'refs/tags/') &&
steps.packaging-job.outcome == 'success'
with:
files: |
*.zip
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
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
**/build
**/.gradle
.idea
*.iml
*.bat
*.log
*.lnk
Expand All @@ -15,12 +12,11 @@
**/msvc/*.db
**/msvc/*.opendb
**/msvc/*.txt
**/msvc/*.aps
**/msvc/*.amplxeproj
**/msvc/.vs
**/msvc/ipch

regamedll/version/appversion.h
regamedll/msvc/PublishPath*.txt
regamedll/_regamedllTestImg
regamedll/_dev
publish
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "regamedll/extra/cssdk"]
path = regamedll/extra/cssdk
url = https://github.com/s1lentq/CSSDK.git
url = https://github.com/s1lentq/CSSDK.git
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.1)
project(regamedll CXX)

if (WIN32)
message(FATAL_ERROR "CMakeLists.txt Windows platform isn't supported yet. Use msvc/ReGameDLL.sln instead it!")
endif()

add_custom_target(appversion DEPENDS
COMMAND "${PROJECT_SOURCE_DIR}/regamedll/version/appversion.sh" "${PROJECT_SOURCE_DIR}"
)

add_subdirectory(regamedll)
Loading

0 comments on commit cf39535

Please sign in to comment.