From a3330e21c2e7193bf71f693becda9fa879fb4c64 Mon Sep 17 00:00:00 2001 From: Rushaway Date: Mon, 17 Aug 2026 10:59:22 +0200 Subject: [PATCH] ci: replace SourceKnight with native GitHub Actions workflow Co-Authored-By: Claude Opus 5 --- .github/copilot-instructions.md | 28 +++-- .github/workflows/ci.yml | 186 ++++++++++++++++---------------- .gitignore | 2 - sourceknight.yaml | 16 --- 4 files changed, 109 insertions(+), 123 deletions(-) delete mode 100644 sourceknight.yaml diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 6ec8adf..e7af6b6 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -10,34 +10,33 @@ This repository contains a single SourcePawn plugin for SourceMod that fixes gra ## Technical Environment - **Language**: SourcePawn -- **Platform**: SourceMod 1.11.0+ (current target: 1.11.0-git6917) -- **Build Tool**: SourceKnight 0.1 -- **Compiler**: SourcePawn compiler via SourceKnight +- **Platform**: SourceMod 1.12.x +- **Build Tool**: Native GitHub Actions (rumblefrog/setup-sp) +- **Compiler**: spcomp via rumblefrog/setup-sp - **Dependencies**: sourcemod, sdktools ## Project Structure ``` ├── .github/ -│ ├── workflows/ci.yml # CI/CD pipeline using SourceKnight +│ ├── workflows/ci.yml # CI/CD pipeline using native GitHub Actions │ └── copilot-instructions.md # This file ├── addons/sourcemod/scripting/ │ └── FixSvGravity.sp # Main plugin source code -├── sourceknight.yaml # Build configuration └── .gitignore # Excludes build artifacts (.smx files) ``` ## Build System -This project uses **SourceKnight** as the build tool: +This project uses a native **GitHub Actions** workflow (no external build tool): -- **Configuration**: `sourceknight.yaml` +- **Configuration**: `.github/workflows/ci.yml` - **Build Target**: `FixSvGravity` (compiles to `FixSvGravity.smx`) -- **Output Directory**: `/addons/sourcemod/plugins` -- **CI/CD**: GitHub Actions workflow builds on Ubuntu 24.04 +- **Output Directory**: `addons/sourcemod/plugins` +- **CI/CD**: GitHub Actions workflow builds on ubuntu-latest using rumblefrog/setup-sp (SourceMod 1.12.x) ### Build Commands -The project is built via SourceKnight through GitHub Actions. Manual building requires: -1. SourceKnight installation: `pip install sourceknight` -2. Build command: `sourceknight build` +The project is built via `spcomp` directly through GitHub Actions. Manual building requires: +1. A SourcePawn compiler (`spcomp`) matching SourceMod 1.12.x +2. Build command: `spcomp -i include -o addons/sourcemod/plugins/FixSvGravity.smx addons/sourcemod/scripting/FixSvGravity.sp` ## Code Style & Standards This project follows SourcePawn best practices: @@ -108,8 +107,7 @@ The FixSvGravity plugin addresses several critical issues: ## File Modification Guidelines - **FixSvGravity.sp**: Main plugin logic - be extremely careful with changes -- **sourceknight.yaml**: Build configuration - update SourceMod version if needed -- **.github/workflows/ci.yml**: CI/CD pipeline - maintains automated building +- **.github/workflows/ci.yml**: CI/CD pipeline - maintains automated building; update the SourceMod version passed to rumblefrog/setup-sp if needed ## Debugging and Troubleshooting - Use SourceMod's error logging for debugging @@ -119,7 +117,7 @@ The FixSvGravity plugin addresses several critical issues: - Verify gravity reset behavior on map changes ## Dependencies and Compatibility -- **SourceMod**: 1.11.0+ (tested with 1.11.0-git6917) +- **SourceMod**: 1.12.x (compiled via rumblefrog/setup-sp) - **Game Support**: All Source engine games supported by SourceMod - **Plugin Conflicts**: May conflict with other gravity-modifying plugins - **ConVar Dependencies**: Requires `sv_gravity` ConVar access diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ecdd53a..12bba83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,90 +1,96 @@ -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 - - - 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: Build sourcemod plugin + working-directory: addons/sourcemod/scripting + run: | + set -euo pipefail + mkdir -p ../plugins + spcomp -i include -o ../plugins/FixSvGravity.smx FixSvGravity.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/ + + - 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..1bfa151 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,3 @@ release/ *.smx plugins/ -.sourceknight -.venv diff --git a/sourceknight.yaml b/sourceknight.yaml deleted file mode 100644 index 901740e..0000000 --- a/sourceknight.yaml +++ /dev/null @@ -1,16 +0,0 @@ -project: - sourceknight: 0.1 - name: FixSvGravity - dependencies: - - name: sourcemod - type: tar - version: 1.11.0-git6917 - location: https://sm.alliedmods.net/smdrop/1.11/sourcemod-1.11.0-git6917-linux.tar.gz - unpack: - - source: /addons - dest: /addons - - root: / - output: /addons/sourcemod/plugins - targets: - - FixSvGravity