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
28 changes: 13 additions & 15 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,33 @@ This repository contains a single SourcePawn plugin for SourceMod that fixes gra

## Technical Environment
- **Language**: SourcePawn
- **Platform**: SourceMod 1.11.0+ (current target: 1.11.0-git6917)
- **Build Tool**: SourceKnight 0.1
- **Compiler**: SourcePawn compiler via SourceKnight
- **Platform**: SourceMod 1.12.x
- **Build Tool**: Native GitHub Actions (rumblefrog/setup-sp)
- **Compiler**: spcomp via rumblefrog/setup-sp
- **Dependencies**: sourcemod, sdktools

## Project Structure
```
├── .github/
│ ├── workflows/ci.yml # CI/CD pipeline using SourceKnight
│ ├── workflows/ci.yml # CI/CD pipeline using native GitHub Actions
│ └── copilot-instructions.md # This file
├── addons/sourcemod/scripting/
│ └── FixSvGravity.sp # Main plugin source code
├── sourceknight.yaml # Build configuration
└── .gitignore # Excludes build artifacts (.smx files)
```

## Build System
This project uses **SourceKnight** as the build tool:
This project uses a native **GitHub Actions** workflow (no external build tool):

- **Configuration**: `sourceknight.yaml`
- **Configuration**: `.github/workflows/ci.yml`
- **Build Target**: `FixSvGravity` (compiles to `FixSvGravity.smx`)
- **Output Directory**: `/addons/sourcemod/plugins`
- **CI/CD**: GitHub Actions workflow builds on Ubuntu 24.04
- **Output Directory**: `addons/sourcemod/plugins`
- **CI/CD**: GitHub Actions workflow builds on ubuntu-latest using rumblefrog/setup-sp (SourceMod 1.12.x)

### Build Commands
The project is built via SourceKnight through GitHub Actions. Manual building requires:
1. SourceKnight installation: `pip install sourceknight`
2. Build command: `sourceknight build`
The project is built via `spcomp` directly through GitHub Actions. Manual building requires:
1. A SourcePawn compiler (`spcomp`) matching SourceMod 1.12.x
2. Build command: `spcomp -i include -o addons/sourcemod/plugins/FixSvGravity.smx addons/sourcemod/scripting/FixSvGravity.sp`

## Code Style & Standards
This project follows SourcePawn best practices:
Expand Down Expand Up @@ -108,8 +107,7 @@ The FixSvGravity plugin addresses several critical issues:

## File Modification Guidelines
- **FixSvGravity.sp**: Main plugin logic - be extremely careful with changes
- **sourceknight.yaml**: Build configuration - update SourceMod version if needed
- **.github/workflows/ci.yml**: CI/CD pipeline - maintains automated building
- **.github/workflows/ci.yml**: CI/CD pipeline - maintains automated building; update the SourceMod version passed to rumblefrog/setup-sp if needed

## Debugging and Troubleshooting
- Use SourceMod's error logging for debugging
Expand All @@ -119,7 +117,7 @@ The FixSvGravity plugin addresses several critical issues:
- Verify gravity reset behavior on map changes

## Dependencies and Compatibility
- **SourceMod**: 1.11.0+ (tested with 1.11.0-git6917)
- **SourceMod**: 1.12.x (compiled via rumblefrog/setup-sp)
- **Game Support**: All Source engine games supported by SourceMod
- **Plugin Conflicts**: May conflict with other gravity-modifying plugins
- **ConVar Dependencies**: Requires `sv_gravity` ConVar access
Expand Down
186 changes: 96 additions & 90 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,90 +1,96 @@
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

- 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: Build sourcemod plugin
working-directory: addons/sourcemod/scripting
run: |
set -euo pipefail
mkdir -p ../plugins
spcomp -i include -o ../plugins/FixSvGravity.smx FixSvGravity.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/

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

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

This file was deleted.