Skip to content

Commit

Permalink
Fix CI after safetyhook changes (#41)
Browse files Browse the repository at this point in the history
* Clone recursively for safetyhook submodule

* Update ambuild syntax

* -Wno-register

* Fix HL2DM build

* Don't compile csgo 64bit

* Fix compilation against older pre safetyhook SourceMod

* Fix uploading symbols

* Bump Actions versions

Drop actions-rs/toolchain and actions-rs/cargo actions. rustup and cargo are included in the Runner images and the actions are no longer maintained.

* Format action yaml

* Use preinstalled python version

The action did nothing anyways since there was no python-version specified.
  • Loading branch information
peace-maker authored Dec 15, 2024
1 parent 14609c6 commit 1a877f9
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 66 deletions.
96 changes: 45 additions & 51 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name: build
on:
push:
paths-ignore:
- LICENSE
- README.md
- LICENSE
- README.md
pull_request:
paths-ignore:
- LICENSE
- README.md
- LICENSE
- README.md
workflow_dispatch:
schedule:
- cron: '30 03 01 */3 *' # Artifacts expire every 3 months
- cron: "30 03 01 */3 *" # Artifacts expire every 3 months

jobs:
build:
Expand All @@ -23,63 +23,60 @@ jobs:
os:
- ubuntu-20.04
- windows-latest

sm_version:
- "1.8"
- "1.9"
- "1.10"
- "1.11"
- "1.12"
- "latest"

include:
# Use MM:Source 1.10 as base version
- meta_version: "1.10"
meta_branch: "1.10-dev"

- sm_version: latest
sm_branch: master
meta_version: latest
meta_branch: master

- sm_version: "1.8"
sm_branch: "1.8-dev"


- sm_version: "1.9"
sm_branch: "1.9-dev"

- sm_version: "1.10"
sm_branch: "1.10-dev"

- sm_version: "1.11"
sm_branch: "1.11-dev"
meta_version: "1.11"
meta_branch: "1.11-dev"


- sm_version: "1.12"
sm_branch: "1.12-dev"
meta_version: "1.11"
meta_branch: "1.11-dev"

- os: ubuntu-20.04
os_short: linux

- os: windows-latest
os_short: win

steps:
- name: Preparing to dump debug symbols
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: mozilla/dump_syms
path: dump_syms
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions-rs/cargo@v1
with:
command: install
args: --all-features --path ./dump_syms
- name: Install dump_syms
run: cargo install --all-features --path ./dump_syms

- name: Prepare env
shell: bash
run: |
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Install (Linux)
if: runner.os == 'Linux'
run: |
Expand All @@ -91,8 +88,8 @@ jobs:
- name: Add msbuild to PATH (Windows)
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v1.1.3
uses: microsoft/setup-msbuild@v2

- name: Install (Windows)
if: runner.os == 'Windows'
shell: cmd
Expand All @@ -101,35 +98,32 @@ jobs:
for /f "usebackq delims=*" %%i in (`vswhere -latest -property installationPath`) do (
call "%%i"\Common7\Tools\vsdevcmd.bat -arch=x86 -host_arch=x64
)
:: Loop over all environment variables and make them global.
for /f "delims== tokens=1,2" %%a in ('set') do (
echo>>"%GITHUB_ENV%" %%a=%%b
)
- name: Getting SourceMod ${{ matrix.sm_version }}
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: alliedmodders/sourcemod
ref: ${{ matrix.sm_branch }}
path: sourcemod-${{ matrix.sm_version }}
submodules: recursive

- name: Getting MM:Source ${{ matrix.meta_version }}
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: alliedmodders/metamod-source
ref: ${{ matrix.meta_branch }}
path: metamod-${{ matrix.meta_version }}

- name: Getting Python
uses: actions/setup-python@v4


- name: Getting ambuild
run: |
python -m pip install wheel
pip install git+https://github.com/alliedmodders/ambuild
- name: Getting SDKs
shell: bash
run: |
Expand All @@ -139,35 +133,35 @@ jobs:
do
git clone hl2sdk-proxy-repo -b $sdk hl2sdk-$sdk
done
- name: Getting own repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: sourcetvmanager

submodules: recursive

- name: Compiling SourceTV Manager files
working-directory: sourcetvmanager
run: |
mkdir build
cd build
python ../configure.py --enable-optimize --sdks=present --sm-path="${{ github.workspace }}/sourcemod-${{ matrix.sm_version }}" --mms-path="${{ github.workspace }}/metamod-${{ matrix.meta_version }}"
ambuild
- name: Uploading debug symbols
working-directory: sourcetvmanager/build
shell: bash
run: |
for f in sourcetvmanager.ext.2.*; do
if [ -f "$f/$f.pdb" ]; then
dump_syms.exe $f/$f.pdb > $f.syms
else
dump_syms $f/$f.so > $f.syms
for f in $(find sourcetvmanager.ext.2.* -type f -print | grep \/sourcetvmanager\.ext\.2\.*\.); do
if ! [[ $f == *.so || $f == *.pdb ]]; then
continue
fi
curl --data-binary @$f.syms https://crash.limetech.org/symbols/submit
dump_syms $f > $(basename $f).syms
curl --data-binary @$(basename $f).syms https://crash.limetech.org/symbols/submit
done
- name: Uploading package
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: sourcetvmanager-sm${{ matrix.sm_version }}-${{ matrix.os_short }}-${{ env.GITHUB_SHA_SHORT }}
path: sourcetvmanager/build/package
26 changes: 13 additions & 13 deletions AMBuildScript
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ class SDK(object):

WinOnly = {'windows': ['x86']}
WinLinux = {'windows': ['x86'], 'linux': ['x86']}
CSGO = {
'windows': ['x86'],
'linux': ['x86', 'x86_64'],
}
WinLinux64 = {
'windows': ['x86', 'x86_64'],
'linux': ['x86', 'x86_64'],
Expand All @@ -47,7 +43,7 @@ PossibleSDKs = {
'swarm': SDK('HL2SDK-SWARM', '2.swarm', '16', 'ALIENSWARM', WinOnly, 'swarm'),
'bgt': SDK('HL2SDK-BGT', '2.bgt', '4', 'BLOODYGOODTIME', WinOnly, 'bgt'),
'eye': SDK('HL2SDK-EYE', '2.eye', '5', 'EYE', WinOnly, 'eye'),
'csgo': SDK('HL2SDKCSGO', '2.csgo', '20', 'CSGO', CSGO, 'csgo'),
'csgo': SDK('HL2SDKCSGO', '2.csgo', '20', 'CSGO', WinLinux, 'csgo'),
'dota': SDK('HL2SDKDOTA', '2.dota', '21', 'DOTA', [], 'dota'),
'portal2': SDK('HL2SDKPORTAL2', '2.portal2', '17', 'PORTAL2', [], 'portal2'),
'blade': SDK('HL2SDKBLADE', '2.blade', '18', 'BLADE', WinLinux, 'blade'),
Expand Down Expand Up @@ -219,6 +215,7 @@ class ExtensionConfig(object):
'-fno-threadsafe-statics',
'-Wno-non-virtual-dtor',
'-Wno-overloaded-virtual',
'-Wno-register',
'-fvisibility-inlines-hidden',
]

Expand Down Expand Up @@ -459,6 +456,8 @@ class ExtensionConfig(object):

def AddCDetour(self, binary):
binary.sources += [ os.path.join(self.sm_root, 'public', 'CDetour', 'detours.cpp') ]
if os.path.exists(os.path.join(self.sm_root, 'public', 'asm', 'asm.c')):
binary.sources += [ os.path.join(self.sm_root, 'public', 'asm', 'asm.c') ]
binary.compiler.cxxincludes += [ os.path.join(builder.sourcePath, 'safetyhook', 'include') ]

for task in self.libsafetyhook:
Expand All @@ -476,15 +475,16 @@ Extension = ExtensionConfig()
Extension.detectSDKs()
Extension.configure()

class SafetyHookShim(object):
def __init__(self):
self.all_targets = {}
self.libsafetyhook = {}
if os.path.exists(os.path.join(builder.sourcePath, 'safetyhook', 'AMBuilder')):
class SafetyHookShim(object):
def __init__(self):
self.all_targets = {}
self.libsafetyhook = {}

SafetyHook = SafetyHookShim()
SafetyHook.all_targets = Extension.all_targets
builder.Build('safetyhook/AMBuilder', {'SafetyHook': SafetyHook })
Extension.libsafetyhook = SafetyHook.libsafetyhook
SafetyHook = SafetyHookShim()
SafetyHook.all_targets = Extension.all_targets
builder.Build('safetyhook/AMBuilder', {'SafetyHook': SafetyHook })
Extension.libsafetyhook = SafetyHook.libsafetyhook

# Add additional buildscripts here
BuildScripts = [
Expand Down
2 changes: 1 addition & 1 deletion AMBuilder
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ for sdk_name in ['css', 'tf2', 'dods', 'hl2dm', 'csgo', 'l4d', 'l4d2']:
winFolder = 'win64' if compiler.target.arch == 'x86_64' else 'win32'
config = 'debug' if 'DEBUG' in compiler.defines else 'release'
lib_path = os.path.join(sdk.path, 'lib', winFolder, config, 'vs' + vs_year, 'libprotobuf.lib')
compiler.linkflags.insert(0, binary.Dep(lib_path))
compiler.linkflags.insert(0, lib_path)

binary.sources += [
os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'netmessages.pb.cc'),
Expand Down
2 changes: 1 addition & 1 deletion natives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static cell_t Native_GetServerPort(IPluginContext *pContext, const cell_t *param
if (hltvserver == nullptr)
return 0;

#if SOURCE_ENGINE == SE_TF2
#if SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_HL2DM
return hltvserver->GetBaseServer()->GetLocalUDPPort();
#else
return hltvserver->GetBaseServer()->GetUDPPort();
Expand Down

0 comments on commit 1a877f9

Please sign in to comment.