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
24 changes: 11 additions & 13 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ This repository contains **BossHP**, a SourceMod plugin for Source engine games

- **Language**: SourcePawn (.sp files)
- **Platform**: SourceMod 1.11.0+ (latest stable release)
- **Build System**: SourceKnight (sourceknight.yaml)
- **Compiler**: SourcePawn compiler (spcomp) via SourceKnight
- **Build System**: Native GitHub Actions (.github/workflows/ci.yml)
- **Compiler**: SourcePawn compiler (spcomp) via rumblefrog/setup-sp
- **Dependencies**: outputinfo extension, smlib, basic plugin, multicolors
Comment on lines 16 to 20

## Project Structure
Expand All @@ -40,7 +40,7 @@ addons/sourcemod/
- **BossHP.inc**: Public API with natives and forwards for other plugins
- **CBoss.inc**: Methodmap classes for different boss types (CBoss, CBossBreakable, CBossCounter, CBossHPBar)
- **CConfig.inc**: Methodmap classes for configuration management
- **sourceknight.yaml**: Build system configuration and dependencies
- **.github/workflows/ci.yml**: Build system configuration and dependencies

## Code Style & Standards

Expand Down Expand Up @@ -153,22 +153,20 @@ boss.bShow // Should display to players
boss.dConfig // Associated configuration
```

## Build System (SourceKnight)
## Build System (GitHub Actions)

### Build Commands:
```bash
# Install SourceKnight (if not available)
pip install sourceknight

# Build the plugin
sourceknight build

# Clean build artifacts
sourceknight clean
# Compile locally with spcomp (from addons/sourcemod/scripting, with
# dependency includes placed under include/)
spcomp -i include -o ../plugins/BossHP.smx BossHP.sp
```

CI builds automatically via `.github/workflows/ci.yml` on every push, pull
request, and manual dispatch — no local toolchain installation required.

### Development Dependencies:
- SourceMod 1.11.0-git6934 (auto-downloaded)
- SourceMod 1.12.0-git7223 (auto-downloaded via rumblefrog/setup-sp)
- ext-outputinfo extension
- smlib include library
- basic plugin methodmap library
Expand Down
201 changes: 110 additions & 91 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,91 +1,110 @@
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/configs /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'

- 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: ${{ 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-ext-outputinfo.git deps/outputinfo
cp -R deps/outputinfo/package/addons/sourcemod/scripting/include/* addons/sourcemod/scripting/include/
git clone --depth=1 https://github.com/srcdslab/sm-plugin-smlib.git deps/smlib
cp -R deps/smlib/addons/sourcemod/scripting/include/* addons/sourcemod/scripting/include/
git clone --depth=1 https://github.com/srcdslab/sm-plugin-basic.git deps/basic
cp -R deps/basic/addons/sourcemod/scripting/include/* addons/sourcemod/scripting/include/
git clone --depth=1 https://github.com/srcdslab/sm-plugin-MultiColors.git deps/multicolors
cp -R deps/multicolors/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/BossHP.smx BossHP.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/configs /tmp/package/addons/sourcemod/
Comment on lines +41 to +43

- 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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ release/

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

This file was deleted.