feat: update sdks, builders, ci, proper secure data (#10)

This commit is contained in:
Maxime Leroy
2025-02-21 00:47:09 +01:00
committed by GitHub
parent 05149c6656
commit 25286e2f04
9 changed files with 460 additions and 270 deletions
+125 -59
View File
@@ -1,81 +1,147 @@
name: CI
name: Extension builder
on: [push, pull_request, workflow_dispatch]
on:
push:
branches:
- master
tags:
- "*"
pull_request:
branches:
- master
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
sourcemod-version: [1.11-dev]
include:
- os: ubuntu-20.04
target-archs: x86,x86_64
sdks: sdk2013,csgo
cc: clang-10
cxx: clang++-10
fail-fast: false
name: ${{ matrix.os }} - ${{ matrix.cc }}
runs-on: ${{ matrix.os }}
env:
PROJECT: 'a2sqcache'
SDKS: 'css'
MMSOURCE_VERSION: '1.12'
SOURCEMOD_VERSION: '1.12'
CACHE_PATH: ${{ github.workspace }}/cache
steps:
- name: Install Linux packages
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -yq --no-install-recommends g++-multilib
- name: Set up Python
uses: actions/setup-python@v5
- name: Checkout
uses: actions/checkout@v4
with:
path: extension
- name: Checkout SourceMod
uses: actions/checkout@v4
with:
repository: alliedmodders/sourcemod
ref: ${{ matrix.sourcemod-version }}
path: sourcemod
submodules: recursive
- name: Checkout AMBuild
uses: actions/checkout@v4
with:
repository: alliedmodders/ambuild
path: ambuild
- name: Checkout sm-ext-common
uses: actions/checkout@v4
with:
repository: srcdslab/sm-ext-common
path: sourcemod/extensions/sm-ext-common
- name: Install sourcemod dependencies
run: |
bash sourcemod/tools/checkout-deps.sh -m -s ${{ matrix.sdks }}
- name: Install AMBuild
uses: BSFishy/pip-action@v1
with:
packages: ./ambuild
- name: Build
working-directory: extension
- name: Concatenate SDK Names
shell: bash
env:
BREAKPAD_SYMBOL_SERVER: ${{ secrets.BREAKPAD_SYMBOL_SERVER }}
run: |
mkdir build && cd build
python ../configure.py --enable-optimize --targets=${{ matrix.target-archs }} --sdks=${{ matrix.sdks }}
# Paranoia
SDKS_VAR="${{env.SDKS}}"
# This will be used in our cache key
echo "SDKS_KEY=${SDKS_VAR//[[:blank:]]/}" >> $GITHUB_ENV
- name: Linux dependencies
if: startsWith(runner.os, 'Linux')
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
gcc-multilib g++-multilib libstdc++6 lib32stdc++6 \
libc6-dev libc6-dev-i386 linux-libc-dev \
linux-libc-dev:i386 lib32z1-dev ${{ matrix.cc }}
- uses: actions/setup-python@v4
name: Setup Python 3.9
with:
python-version: 3.9
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
- uses: actions/checkout@v3
name: Repository checkout
with:
fetch-depth: 0
path: extension
- uses: actions/cache@v3
name: Cache dependencies
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
env:
cache-name: cache
with:
path: ${{ env.CACHE_PATH }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-sm${{ env.SOURCEMOD_VERSION }}-mmsource${{ env.MMSOURCE_VERSION }}-${{ env.SDKS_KEY }}
- shell: bash
name: Install dependencies
run: |
mkdir -p "${{ env.CACHE_PATH }}"
cd "${{ env.CACHE_PATH }}"
shallow_checkout () {
# Param 1 is origin
# Param 2 is branch
# Param 3 is name
if [ ! -d "$3" ]; then
git clone "$1" --depth 1 --branch "$2" "$3"
fi
cd "$3"
git remote set-url origin "$1"
git fetch --depth 1 origin "$2"
git checkout --force --recurse-submodules FETCH_HEAD
git submodule init
git submodule update --depth 1
cd ..
}
# We are aware of what we are doing!
git config --global advice.detachedHead false
# Verify github cache, and see if we don't have the sdks already cloned and update them
for sdk in ${{ env.SDKS }}
do
shallow_checkout "https://github.com/alliedmodders/hl2sdk" "${sdk}" "hl2sdk-${sdk}"
done
shallow_checkout "https://github.com/alliedmodders/ambuild" "master" "ambuild"
shallow_checkout "https://github.com/alliedmodders/sourcemod" "${{env.SOURCEMOD_VERSION}}-dev" "sourcemod"
shallow_checkout "https://github.com/alliedmodders/metamod-source/" "${{env.MMSOURCE_VERSION}}-dev" "metamod-source"
shallow_checkout "https://github.com/srcdslab/sm-ext-common" "master" "sourcemod/public/sm-ext-common"
# But maybe others aren't (also probably unnecessary because git actions but paranoia)
git config --global advice.detachedHead true
- name: Setup AMBuild
shell: bash
run: |
cd "${{ env.CACHE_PATH }}"
python -m pip install ./ambuild
- name: Select clang compiler
if: startsWith(runner.os, 'Linux')
run: |
echo "CC=${{ matrix.cc }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV
${{ matrix.cc }} --version
${{ matrix.cxx }} --version
- name: Build
shell: bash
working-directory: extension
run: |
mkdir build
cd build
python ../configure.py --enable-optimize --sdks="${{ env.SDKS }}" --mms-path="${{ env.CACHE_PATH }}/metamod-source" --hl2sdk-root="${{ env.CACHE_PATH }}" --sm-path="${{ env.CACHE_PATH }}/sourcemod" --targets=x86,x86_64
ambuild
- name: Upload artifact
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
# Artifact name
name: ${{ runner.os }}
# optional, default is artifact
# A file, directory or wildcard pattern that describes what to upload
path: extension/build/package
# The desired behavior if no files are found using the provided path.
if-no-files-found: error
# Duration after which artifact will expire in days. 0 means using default retention.
retention-days: 14
release:
name: Release