diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index ac98e50..172ac27 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -14,9 +14,9 @@ This repository contains **Status Fixer**, a SourceMod plugin that enhances the ## Technical Environment ### Core Dependencies -- **SourceMod**: 1.11.0+ (specified in sourceknight.yaml) +- **SourceMod**: 1.12.x - **Language**: SourcePawn -- **Compiler**: SourceMod Compiler (spcomp) via SourceKnight build system +- **Compiler**: SourceMod Compiler (spcomp) via GitHub Actions (rumblefrog/setup-sp) - **Minimum SourceMod API**: 1.12+ for production deployment ### Optional Dependencies @@ -25,9 +25,9 @@ This repository contains **Status Fixer**, a SourceMod plugin that enhances the - **ServerFPS Extension**: For accurate server performance monitoring ### Build System -- **Primary**: SourceKnight build tool (configured in `sourceknight.yaml`) +- **Primary**: Native GitHub Actions workflow (`.github/workflows/ci.yml`), using `rumblefrog/setup-sp` and `spcomp` directly - **CI/CD**: GitHub Actions workflow (`.github/workflows/ci.yml`) -- **Package Management**: Automated dependency resolution and packaging +- **Package Management**: Dependencies cloned directly from their git repos during the CI build step ## Project Structure @@ -45,7 +45,7 @@ addons/sourcemod/ - **Status.sp**: Main plugin implementing the enhanced status command - **serverfps.inc**: Custom include for server performance monitoring - **serverfps.games.txt**: GameData file containing memory signatures -- **sourceknight.yaml**: Build configuration and dependency management +- **.github/workflows/ci.yml**: Build configuration and dependency management ## Code Standards & Style @@ -88,10 +88,9 @@ if (!GetClientAuthId(player, authType, sPlayerAuth, sizeof(sPlayerAuth))) ### Building the Plugin ```bash -# Using SourceKnight (preferred method) -sourceknight build +# CI builds automatically via .github/workflows/ci.yml (GitHub Actions) -# Manual compilation (if SourceKnight unavailable) +# Manual local compilation spcomp -i"addons/sourcemod/scripting/include" addons/sourcemod/scripting/Status.sp ``` @@ -164,7 +163,7 @@ if (hHandle == null) ## CI/CD Pipeline ### Automated Processes -- **Build**: Compiles plugin using SourceKnight action +- **Build**: Compiles plugin natively via `rumblefrog/setup-sp` + `spcomp` in GitHub Actions - **Package**: Creates distribution-ready archive with gamedata - **Release**: Generates tagged releases with downloadable assets - **Versioning**: Automatic latest tag management @@ -220,4 +219,4 @@ When updating: 1. Increment version in plugin info 2. Update any breaking changes in this documentation 3. Test with minimum required SourceMod version -4. Update dependency versions in sourceknight.yaml if needed \ No newline at end of file +4. Update dependency clone references in `.github/workflows/ci.yml` if needed \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d55134..4137c8d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,101 +1,104 @@ -name: CI - -on: - push: - branches: - - main - - master - tags: - - '*' - pull_request: - branches: - - main - - master - -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/gamedata /tmp/package/common/addons/sourcemod/ - - - name: Upload build archive for test runners - uses: actions/upload-artifact@v7 - with: - name: package - 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' - - - name: Delete existing "latest" release and tag - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' - run: | - set -euo pipefail - gh release delete latest --cleanup-tag --yes || true - 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: package - 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-PlayerManager.git deps/PlayerManager + cp -R deps/PlayerManager/addons/sourcemod/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/Status.smx Status.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/gamedata /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 + + - name: Delete existing "latest" release and tag + run: | + set -euo pipefail + gh release delete latest --cleanup-tag --yes || true + 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 a8b3bf1..0000000 --- a/sourceknight.yaml +++ /dev/null @@ -1,23 +0,0 @@ -project: - sourceknight: 0.2 - name: Status - dependencies: - - name: sourcemod - type: tar - version: 1.11.0-git6934 - location: https://sm.alliedmods.net/smdrop/1.11/sourcemod-1.11.0-git6934-linux.tar.gz - unpack: - - source: /addons - dest: /addons - - - name: PlayerManager - type: git - repo: https://github.com/srcdslab/sm-plugin-PlayerManager - unpack: - - source: /addons - dest: /addons - - root: / - output: /addons/sourcemod/plugins - targets: - - Status