From ad0fa9320dfad8d990608434a9e5076bc8df42fe Mon Sep 17 00:00:00 2001 From: Rushaway Date: Mon, 17 Aug 2026 10:49:16 +0200 Subject: [PATCH] ci: replace SourceKnight with native GitHub Actions workflow Co-Authored-By: Claude Opus 5 --- .github/copilot-instructions.md | 13 +- .github/workflows/ci.yml | 203 +++++++++++++++++--------------- .gitignore | 1 - sourceknight.yaml | 46 -------- 4 files changed, 117 insertions(+), 146 deletions(-) delete mode 100644 sourceknight.yaml diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 2647b81..9de2844 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -20,16 +20,16 @@ This repository contains the **CustomChatColors** SourcePawn plugin for SourceMo - **Compiler**: Latest SourcePawn compiler (spcomp) - **Database**: MySQL/SQLite support with async operations -### Dependencies (via sourceknight.yaml) -- **sourcemod**: Core SourceMod framework (1.11.0-git6934+) +### Dependencies (declared in .github/workflows/ci.yml) +- **sourcemod**: Core SourceMod framework (1.12.x, via rumblefrog/setup-sp) - **multicolors**: Advanced color handling (`#include `) - **SelfMute**: Self-muting functionality (optional) - **sourcebans-pp**: SourceBans++ integration (optional) - **DynamicChannels**: Multi-channel chat support (optional) ### Build System -- **Tool**: SourceKnight build system (`sourceknight.yaml`) -- **CI**: GitHub Actions using `maxime1907/action-sourceknight@v1` +- **Tool**: Native GitHub Actions workflow (`.github/workflows/ci.yml`) +- **CI**: GitHub Actions using `rumblefrog/setup-sp` and `spcomp` - **Output**: Compiled `.smx` files in `/addons/sourcemod/plugins` ## File Structure & Architecture @@ -127,9 +127,8 @@ g_hStringMap = new StringMap(); ### 3. Build Process ```bash -# The build uses SourceKnight (GitHub Actions handles this) -# Local building requires SourceKnight installation -sourceknight build +# The build uses native GitHub Actions (spcomp via rumblefrog/setup-sp) +# See .github/workflows/ci.yml for the full build steps ``` ### 4. Testing Approach diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 637209f..9ec44a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,92 +1,111 @@ -name: CI - -on: [push, pull_request, workflow_dispatch] - -jobs: - build: - name: "Build" - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-24.04] - include: - - os: ubuntu-24.04 - steps: - - uses: actions/checkout@v7 - - name: Build sourcemod plugin - uses: maxime1907/action-sourceknight@v1 - with: - cmd: build - - - name: Create package - run: | - mkdir -p /tmp/package - cp -R .sourceknight/package/* /tmp/package - cp -R addons/sourcemod/configs /tmp/package/common/addons/sourcemod/ - cp -R addons/sourcemod/translations /tmp/package/common/addons/sourcemod/ - - - name: Upload build archive for test runners - uses: actions/upload-artifact@v7 - with: - name: ${{ runner.os }} - path: /tmp/package - - tag: - name: Tag - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v7 - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' - - - uses: dev-drprasad/delete-tag-and-release@v1.1 - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' - with: - delete_release: true - tag_name: latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - uses: rickstaa/action-create-tag@v1 - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' - with: - tag: "latest" - github_token: ${{ secrets.GITHUB_TOKEN }} - - release: - name: Release - if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' - needs: [build, tag] - runs-on: ubuntu-latest - steps: - - name: Download artifacts - uses: actions/download-artifact@v8 - with: - name: ${{ runner.os }} - path: artifacts - - - name: Versioning - run: | - version="latest" - if [[ "${{ github.ref_type }}" == 'tag' ]]; then - version=`echo $GITHUB_REF | sed "s/refs\/tags\///"`; - fi - echo "RELEASE_VERSION=$version" >> $GITHUB_ENV - - - name: Package - run: | - cd artifacts - ls -Rall - tar -czf ../${{ github.event.repository.name }}-${{ env.RELEASE_VERSION }}.tar.gz . - cd .. - ls -la *.tar.gz - - - name: Release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: '*.tar.gz' - tag: ${{ env.RELEASE_VERSION }} - file_glob: true - overwrite: true +name: CI + +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + + - name: Setup SourcePawn compiler + uses: rumblefrog/setup-sp@v1.3.1 + with: + version: "1.12.x" + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install dependencies + run: | + set -euo pipefail + mkdir -p addons/sourcemod/scripting/include deps + git clone --depth=1 https://github.com/srcdslab/sm-plugin-MultiColors.git deps/multicolors + cp -R deps/multicolors/addons/sourcemod/scripting/include/* addons/sourcemod/scripting/include/ + git clone --depth=1 https://github.com/srcdslab/sm-plugin-SelfMute.git deps/selfmute + cp -R deps/selfmute/addons/sourcemod/scripting/include/* addons/sourcemod/scripting/include/ + git clone --depth=1 https://github.com/srcdslab/sourcebans-pp.git deps/sourcebans-pp + cp -R deps/sourcebans-pp/game/addons/sourcemod/scripting/include/* addons/sourcemod/scripting/include/ + git clone --depth=1 https://github.com/Vauff/DynamicChannels.git deps/dynamicchannels + cp -R deps/dynamicchannels/scripting/include/* addons/sourcemod/scripting/include/ + + - name: Build sourcemod plugin + working-directory: addons/sourcemod/scripting + run: | + set -euo pipefail + mkdir -p ../plugins + spcomp -i include -o ../plugins/CustomChatColors.smx CustomChatColors.sp + + - name: Create package + run: | + set -euo pipefail + mkdir -p /tmp/package/addons/sourcemod/plugins + cp addons/sourcemod/plugins/*.smx /tmp/package/addons/sourcemod/plugins/ + cp -R addons/sourcemod/configs /tmp/package/addons/sourcemod/ + cp -R addons/sourcemod/translations /tmp/package/addons/sourcemod/ + + - name: Upload build archive for test runners + uses: actions/upload-artifact@v7 + with: + name: ${{ runner.os }} + path: /tmp/package + + tag: + name: Tag + needs: build + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + + - uses: dev-drprasad/delete-tag-and-release@v1.1 + with: + delete_release: true + tag_name: latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: rickstaa/action-create-tag@v1 + with: + tag: latest + github_token: ${{ secrets.GITHUB_TOKEN }} + + release: + name: Release + needs: [build, tag] + if: | + always() && + needs.build.result == 'success' && + (needs.tag.result == 'success' || needs.tag.result == 'skipped') && + (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') + runs-on: ubuntu-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v8 + with: + name: ${{ runner.os }} + path: artifacts + + - name: Versioning + run: | + set -euo pipefail + version="latest" + if [[ "${{ github.ref_type }}" == "tag" ]]; then + version="${GITHUB_REF_NAME}" + fi + echo "RELEASE_VERSION=$version" >> "$GITHUB_ENV" + + - name: Package + run: | + set -euo pipefail + cd artifacts + tar -czf "../${{ github.event.repository.name }}-${{ env.RELEASE_VERSION }}.tar.gz" . + cd .. + + - name: Release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: "*.tar.gz" + tag: ${{ env.RELEASE_VERSION }} + file_glob: true + overwrite: true diff --git a/.gitignore b/.gitignore index 40f37f1..8c492ac 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,4 @@ release/ *.smx plugins/ -.sourceknight .venv diff --git a/sourceknight.yaml b/sourceknight.yaml deleted file mode 100644 index c249afe..0000000 --- a/sourceknight.yaml +++ /dev/null @@ -1,46 +0,0 @@ -project: - sourceknight: 0.3 - name: CustomChatColors - - dependencies: - - name: sourcemod - type: tar - version: 1.12.0-git7223 - location: https://sm.alliedmods.net/smdrop/1.12/sourcemod-1.12.0-git7223-linux.tar.gz - unpack: - - source: /addons - dest: /addons - - - name: multicolors - type: git - repo: https://github.com/srcdslab/sm-plugin-MultiColors - unpack: - - source: /addons - dest: /addons - - - name: SelfMute - type: git - repo: https://github.com/srcdslab/sm-plugin-SelfMute - unpack: - - source: /addons - dest: /addons - - - name: sourcebans-pp - type: git - repo: https://github.com/srcdslab/sourcebans-pp - unpack: - - source: /game/addons - dest: /addons - - - name: dynamicchannels - type: git - repo: https://github.com/Vauff/DynamicChannels - unpack: - - source: /scripting/include - dest: /addons/sourcemod/scripting/include - - root: / - output: /addons/sourcemod/plugins - - targets: - - CustomChatColors