diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index e5f5578..1f68760 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -14,30 +14,22 @@ This repository contains a SourcePawn plugin for SourceMod that implements a VIP ## Technical Environment - **Language**: SourcePawn (.sp files) -- **Platform**: SourceMod 1.11+ (currently using 1.11.0-git6917) -- **Build System**: SourceKnight (configured in `sourceknight.yaml`) +- **Platform**: SourceMod 1.12.x +- **Build System**: Native GitHub Actions (configured in `.github/workflows/ci.yml`) - **Database**: MySQL (preferred) or SQLite fallback - **Dependencies**: VIP Core plugin from srcdslab/sm-plugin-VIP-Core ## Build System & Development Workflow -### SourceKnight Configuration -The project uses SourceKnight for building. Key configuration in `sourceknight.yaml`: -- Dependencies are automatically downloaded (SourceMod + VIP Core) -- Output goes to `/addons/sourcemod/plugins` -- Target: `VIP_Test` (produces VIP_Test.smx) - -### CI/CD Pipeline -- Automated builds on push/PR via GitHub Actions -- Uses `maxime1907/action-sourceknight@v1` +### GitHub Actions CI +The project builds via a native GitHub Actions workflow (`.github/workflows/ci.yml`): +- Sets up the SourcePawn compiler with `rumblefrog/setup-sp@v1.3.1` (SourceMod 1.12.x) +- Clones VIP Core includes and compiles `VIP_Test.sp` with `spcomp` - Creates packages with plugins and translations -- Automatic releases with version tagging +- Automatic releases (tagged `latest`) on pushes to `master`/`main` ### Building Locally ```bash -# If SourceKnight is installed -sourceknight build - # Manual compilation (requires SourceMod compiler and includes) spcomp -i"includes" VIP_Test.sp ``` @@ -302,7 +294,7 @@ if (!GetClientAuthId(iClient, AuthId_Steam2, sAuth, sizeof(sAuth), true)) { ## Dependencies & External Resources - **VIP Core Plugin**: Required dependency from srcdslab/sm-plugin-VIP-Core -- **SourceMod Include Files**: Automatically handled by SourceKnight +- **SourceMod Include Files**: Automatically fetched by the GitHub Actions CI workflow - **Database Configuration**: Uses "vip_test" section in databases.cfg or SQLite fallback - **Translation Files**: Must be present in translations directory diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0301781..cc3c620 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,91 +1,104 @@ -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/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-VIP-Core.git deps/vip_core + cp -R deps/vip_core/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/VIP_Test.smx VIP_Test.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/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 65c38e4..0000000 --- a/sourceknight.yaml +++ /dev/null @@ -1,25 +0,0 @@ -project: - sourceknight: 0.3 - name: VIP_Test - - dependencies: - - name: sourcemod - type: tar - version: 1.12 - location: https://sm.alliedmods.net/smdrop/1.12/sourcemod-1.12.0-git7165-linux.tar.gz - unpack: - - source: /addons - dest: /addons - - - name: vip_core - type: git - repo: https://github.com/srcdslab/sm-plugin-VIP-Core - unpack: - - source: /addons/sourcemod/scripting/include - dest: /addons/sourcemod/scripting/include - - root: / - output: /addons/sourcemod/plugins - - targets: - - VIP_Test