diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 56eb56f..7a86f67 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -4,7 +4,7 @@ This repository contains a single SourcePawn plugin **FixFuncRotating** that fixes issues with `func_rotating` entities in Source engine games. The plugin specifically addresses problems with the `StartForward` and `StopAtStartPos` inputs by using DHooks to detour engine functions and modify entity behavior. **Target Environment:** -- SourceMod 1.11.0+ (currently targeting 1.11.0-git6917) +- SourceMod 1.12.x - Source engine games (primarily Counter-Strike series) - Linux servers (gamedata includes Linux signatures) @@ -19,25 +19,22 @@ This repository contains a single SourcePawn plugin **FixFuncRotating** that fix │ │ └── FixFuncRotating.games.txt # Function signatures for DHooks │ └── scripting/ │ └── FixFuncRotating.sp # Main plugin source code -├── sourceknight.yaml # Build configuration └── .gitignore ``` ## Build System & CI/CD -### SourceKnight Build Tool -This project uses **SourceKnight** as its build system: -- Configuration: `sourceknight.yaml` -- Automatic dependency management (downloads SourceMod 1.11.0-git6917) -- Compiles `.sp` files to `.smx` plugins +### Native GitHub Actions Build +This project builds with a native GitHub Actions workflow (no external build tool): +- Compiler: `rumblefrog/setup-sp` (SourceMod 1.12.x) +- Compiles `.sp` files to `.smx` plugins via `spcomp` - Packages plugins with gamedata for distribution ### GitHub Actions Pipeline The CI/CD pipeline (`.github/workflows/ci.yml`): -1. **Build**: Compiles plugin using SourceKnight action -2. **Package**: Creates distribution with plugins and gamedata -3. **Tag**: Auto-tags builds from main/master branch as "latest" -4. **Release**: Creates GitHub releases with tar.gz packages +1. **Build**: Compiles plugin with `spcomp` and packages plugins + gamedata +2. **Tag**: Auto-tags builds from main/master branch as "latest" +3. **Release**: Creates GitHub releases with tar.gz packages To trigger builds: - Push to any branch triggers build @@ -140,7 +137,7 @@ Currently only includes Linux signatures - Windows support would require additio 3. Test function address resolution ### Updating SourceMod Version -1. Modify `sourceknight.yaml` dependency version +1. Modify the `version` input for `rumblefrog/setup-sp` in `.github/workflows/ci.yml` 2. Test for any API compatibility issues 3. Update backward compatibility code if needed @@ -158,7 +155,7 @@ Currently only includes Linux signatures - Windows support would require additio ## Testing & Validation ### Local Testing -Since SourceKnight isn't available in all environments: +Since a full build toolchain isn't available in all environments: 1. Use a SourceMod development server 2. Load the plugin and test with `func_rotating` entities 3. Verify both StartForward and StopAtStartPos behaviors work correctly diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00f66b4..94fc261 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,26 +4,30 @@ 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 + name: Build + runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - - name: Build sourcemod plugin - uses: maxime1907/action-sourceknight@v1 + + - name: Setup SourcePawn compiler + uses: rumblefrog/setup-sp@v1.3.1 with: - cmd: build + 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 -o ../plugins/FixFuncRotating.smx FixFuncRotating.sp - name: Create package run: | - mkdir -p /tmp/package - cp -R .sourceknight/package/* /tmp/package - cp -R addons/sourcemod/gamedata /tmp/package/common/addons/sourcemod/ + set -euo pipefail + mkdir -p /tmp/package/addons/sourcemod/plugins + cp addons/sourcemod/plugins/*.smx /tmp/package/addons/sourcemod/plugins/ + cp -R addons/sourcemod/gamedata /tmp/package/addons/sourcemod/ - name: Upload build archive for test runners uses: actions/upload-artifact@v7 @@ -34,13 +38,12 @@ jobs: 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 - 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 @@ -48,15 +51,18 @@ jobs: 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" + 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] + 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 @@ -67,25 +73,25 @@ jobs: - name: Versioning run: | + set -euo pipefail version="latest" - if [[ "${{ github.ref_type }}" == 'tag' ]]; then - version=`echo $GITHUB_REF | sed "s/refs\/tags\///"`; + if [[ "${{ github.ref_type }}" == "tag" ]]; then + version="${GITHUB_REF_NAME}" fi - echo "RELEASE_VERSION=$version" >> $GITHUB_ENV + echo "RELEASE_VERSION=$version" >> "$GITHUB_ENV" - name: Package run: | + set -euo pipefail cd artifacts - ls -Rall - tar -czf ../${{ github.event.repository.name }}-${{ env.RELEASE_VERSION }}.tar.gz . + 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' + file: "*.tar.gz" tag: ${{ env.RELEASE_VERSION }} file_glob: true overwrite: true diff --git a/.gitignore b/.gitignore index c77c74b..f17f085 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,4 @@ release/ *.smx plugins/ -.sourceknight .venv diff --git a/sourceknight.yaml b/sourceknight.yaml deleted file mode 100644 index 98ee6c9..0000000 --- a/sourceknight.yaml +++ /dev/null @@ -1,18 +0,0 @@ -project: - sourceknight: 0.3 - name: FixFuncRotating - - 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 - - root: / - output: /addons/sourcemod/plugins - - targets: - - FixFuncRotating