Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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
```

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
4. Update dependency clone references in `.github/workflows/ci.yml` if needed
205 changes: 104 additions & 101 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ release/

*.smx
plugins/
.sourceknight
.venv
23 changes: 0 additions & 23 deletions sourceknight.yaml

This file was deleted.