* init

* add gitignore

* Use `debian:stable` tag

* Make compability with `s1lentq/testdemos:latest` image

* Clear APT cache

* Use `wine32` only and remove `wineboot` command

* remove any `*64.dll` and add ability to remove all `*.bsp`

* add CI

* Add `CODEOWNERS`
This commit is contained in:
Sergey Shorokhov 2024-09-24 01:14:28 +03:00 committed by GitHub
parent 13aa9e08e0
commit 670c0e714f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 400 additions and 0 deletions

1
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1 @@
* @/Re-HLDS/developers

62
.github/workflows/Build.yml vendored Normal file
View File

@ -0,0 +1,62 @@
name: Docker Image CI
on:
push:
branches: [ master ]
paths-ignore:
- '**.md'
- '.vscode/**'
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
branch:
- steam_legacy
- public
mod:
# - valve
- cstrike
# - czero
# - dod
# - gearbox
# - tfc
# - ricochet
# - dmc
env:
needToPush: ${{ github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@v4.1.1
- uses: docker/setup-buildx-action@v3.2.0
- name: Log in to Docker Hub
if: ${{ env.needToPush }}
uses: docker/login-action@v3.1.0
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v5.3.0
env:
OWNER: ${{ vars.DOCKER_USERNAME }}
REPO: ${{ vars.DOCKER_REPOSITORY }}
TAG: ${{ matrix.branch }}
with:
context: .
file: ./Dockerfile
push: ${{ env.needToPush }}
tags: |
${{ env.OWNER }}/${{ env.REPO }}:${{ env.TAG }}
${{ env.TAG == 'steam_legacy' && format('{0}/{1}:latest', env.OWNER, env.REPO) || null}}
build-args: |
APPBRANCH=${{ matrix.branch }}
MOD=${{ matrix.mod }}
cache-from: type=gha,scope=build-${{ matrix.mod }}-${{ matrix.branch }}
cache-to: type=gha,mode=max,scope=build-${{ matrix.mod }}-${{ matrix.branch }}

96
.gitignore vendored Normal file
View File

@ -0,0 +1,96 @@
# Created by https://www.toptal.com/developers/gitignore/api/linux,macos,windows,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=linux,macos,windows,visualstudiocode
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### macOS Patch ###
# iCloud generated files
*.icloud
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# End of https://www.toptal.com/developers/gitignore/api/linux,macos,windows,visualstudiocode

37
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,37 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Build image",
"type": "docker-build",
"dockerBuild": {
"context": "${workspaceFolder}",
"tag": "testdemos:latest"
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "Run container",
"command": "docker run --rm -ti testdemos:latest",
"dependsOn": [
"Build image"
]
}
],
"inputs": [
{
"type": "pickString",
"id": "betaBranch",
"default": "public",
"description": "Select DepotsDownloader branch.",
"options": [
"public",
"steam_legacy"
]
}
]
}

76
Dockerfile Normal file
View File

@ -0,0 +1,76 @@
FROM debian:stable-slim AS download_hlds_windows
LABEL creator="Sergey Shorokhov <wopox1337@ya.ru>"
# Install required packages
RUN set -x \
&& apt-get update \
&& apt-get install -y --install-recommends \
curl \
libarchive-tools \
&& rm -rf /var/lib/apt/lists/*
# Download and install DepotDownloader
ARG DepotDownloader_URL="https://github.com/SteamRE/DepotDownloader/releases/download/DepotDownloader_2.7.1/DepotDownloader-linux-x64.zip"
RUN curl -sSL ${DepotDownloader_URL} | bsdtar -xvf - -C /usr/local/bin/ \
&& chmod +x /usr/local/bin/DepotDownloader
ENV APPDIR=/opt/hlds
WORKDIR ${APPDIR}
ARG APPID=90
ARG APPBRANCH=steam_legacy
ARG OS=windows
ARG MOD=cstrike
RUN DepotDownloader -os ${OS} -dir ${APPDIR} -app ${APPID} -beta ${APPBRANCH} -depot 1
RUN DepotDownloader -os ${OS} -dir ${APPDIR} -app ${APPID} -beta ${APPBRANCH} -depot 5
RUN DepotDownloader -os ${OS} -dir ${APPDIR} -app ${APPID} -beta ${APPBRANCH} -depot 11
RUN DepotDownloader -os ${OS} -dir ${APPDIR} -app ${APPID} -beta ${APPBRANCH} -depot 1004
SHELL ["/bin/bash", "-c"]
# Fix first run crash and STEAM Validation rejected issue
RUN cp ${APPDIR}/${MOD}/steam_appid.txt ${APPDIR} \
&& touch ${APPDIR}/${MOD}/{banned,listip}.cfg
# Remove unnecessary files
RUN rm -rf linux64 .DepotDownloader utils/ \
&& find . \
\( \
-name '*.so' -o \
-name '*64.dll' -o \
-name '*.dylib' \
\) -exec rm -rf {} \;
# Remove *.bsp
# RUN find . -name '*.bsp' \
# \( \
# -not -name 'rehlds_*' \
# -not -name 'regamedll_*' \
# -not -name 'de_dust2*' \
# -not -name 'crossfire*' \
# \) \
# -delete
FROM debian:stable-slim AS test_runner
RUN dpkg --add-architecture i386 \
&& apt-get update \
&& apt-get install -y \
wine32 \
rsync \
&& rm -rf /var/lib/apt/lists/*
ENV WINEDEBUG=-all
ENV WINEDLLOVERRIDES=mshtml=
COPY --from=download_hlds_windows /opt/hlds /opt/HLDS
WORKDIR /opt/HLDS
# Add test depend files
COPY testdemos_files .
# CMD [ "./test.sh" ]
# CMD wine hlds.exe --rehlds-enable-all-hooks --rehlds-test-play "testdemos/cstrike-basic-1.bin" -game cstrike -console -port 27039 +map regamedll_test_map_v5

Binary file not shown.

View File

@ -0,0 +1,40 @@
// Use this file to configure your DEDICATED server.
// This config file is executed on server start.
// disable autoaim
sv_aim 0
// disable clients' ability to pause the server
pausable 0
// default server name. Change to "Bob's Server", etc.
hostname "Counter-Strike 1.6 Server"
sv_minupdaterate 30
sv_maxupdaterate 101
sv_minrate 10000
sv_maxupdaterate 50000
// maximum client movement speed
sv_maxspeed 320
// 20 minute timelimit
mp_timelimit 20
mp_startmoney 16000
mp_flashlight 1
mp_autoteambalance 1
mp_limitteams 3
mp_roundtime 1.5
mp_c4timer 25
mp_friendlyfire 1
sv_cheats 0
sv_allowupload 0
sv_send_logos 0
// load ban files
exec listip.cfg
exec banned.cfg

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,31 @@
// Use this file to configure your DEDICATED server.
// This config file is executed on server start.
// disable autoaim
sv_aim 0
// disable clients' ability to pause the server
pausable 0
// default server name. Change to "Bob's Server", etc.
hostname "CS Test Server [Steam]"
rcon_password "vH9.ChfusK"
sv_minupdaterate 30
sv_maxupdaterate 101
sv_minrate 10000
sv_maxupdaterate 50000
// maximum client movement speed
sv_maxspeed 320
// 20 minute timelimit
mp_timelimit 20
sv_cheats 0
// load ban files
exec listip.cfg
exec banned.cfg

BIN
testdemos_files/hlds.exe Executable file

Binary file not shown.

BIN
testdemos_files/swds.dll Executable file

Binary file not shown.

52
testdemos_files/test.sh Executable file
View File

@ -0,0 +1,52 @@
#!/bin/bash
chown root ~
# rsync -a deps/regamedll/* .
rsync -a deps/rehlds/* .
# mv $GITHUB_WORKSPACE/tests/swds.dll .
descs=(
# "CS: Testing jumping, scenarios, shooting etc"
"CS: Multiplayer"
# "Half-Life: Physics singleplayer"
# "Half-Life: Multiplayer on crossfire map"
# "Half-Life: Shooting with several weapons"
)
demos=(
# "cstrike-basic-1"
"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

Binary file not shown.

View File

@ -0,0 +1 @@
-console -port 27030 -maxplayers 32 +map crossfire

Binary file not shown.

View File

@ -0,0 +1 @@
-game cstrike -console -port 27039 +map regamedll_test_map_v5

Binary file not shown.

View File

@ -0,0 +1 @@
-game cstrike -console -port 27016 +map de_dust2

Binary file not shown.

View File

@ -0,0 +1 @@
-console -port 27016 +map rehlds_test_map_v2

Binary file not shown.

View File

@ -0,0 +1 @@
-console -port 27016 +map rehlds_test_map_v2

Binary file not shown.