Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assorted updates #66

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
fb8aade
WIP improving the runner
brandonsturgeon Oct 27, 2024
f688d0d
WIP runner rework, additional type annotations
brandonsturgeon Oct 27, 2024
123c588
Make map configurable, allow for dynamic startup params
brandonsturgeon Oct 27, 2024
fd911d7
type improvements
brandonsturgeon Oct 27, 2024
de062c1
Refactor Runner, fully LuaLS annotate the project
brandonsturgeon Oct 28, 2024
4dd0266
Extra annotations
brandonsturgeon Oct 28, 2024
1e34655
WIP Refactor, fixes
brandonsturgeon Oct 28, 2024
8b507ba
Fixes expectations, improves output, adds deepEqual, fully typedoc
brandonsturgeon Oct 29, 2024
79bff5d
Add all methods to Loader table
brandonsturgeon Oct 29, 2024
4aaff77
Fix async expect calls not using extra params correctly
brandonsturgeon Oct 29, 2024
5ee40d6
Fix log helper edge cases, fully typedoc log helpers
brandonsturgeon Oct 29, 2024
ce1facf
Add class definition to stubs
brandonsturgeon Oct 29, 2024
679d95a
Wrap runNext calls in timers to break stack
brandonsturgeon Oct 29, 2024
076a1d0
Fix async tests printing multiple failures
brandonsturgeon Oct 29, 2024
9fe0449
Add LLM_PROMPT.md
brandonsturgeon Oct 29, 2024
44ba3a2
Add initial set of self-tests
brandonsturgeon Oct 29, 2024
b8f5838
Additional typedocs
brandonsturgeon Oct 30, 2024
edf5dd2
Add init/colors tests
brandonsturgeon Oct 30, 2024
b5bff7c
Fix all luals warnings, errors, rewrite stubmaker and add annotations
brandonsturgeon Oct 30, 2024
3939425
Update annotations
brandonsturgeon Oct 30, 2024
4a88559
Shorten group name
brandonsturgeon Oct 30, 2024
f2ac58f
Temp: Add custom runnerimprovements workflow
brandonsturgeon Nov 3, 2024
ab6cecf
honor extra startup args
brandonsturgeon Nov 3, 2024
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
169 changes: 169 additions & 0 deletions .github/workflows/run_tests_runnerimprovements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
---
name: GLuaTest Tester


on:
workflow_call:
inputs:
server-cfg:
type: string
required: false
description: "A path (relative to project directory) with extra server config options"
default: "gluatest_custom.cfg"

requirements:
type: string
required: false
description: "A path (relative to project directory) with a list of all requirements to test this project"
default: "gluatest_requirements.txt"

gamemode:
type: string
required: false
description: "The name of the gamemode for the test server to run. (Be sure to list it as a requirement or include it in the test collection, if necessary)"
default: "sandbox"

collection:
type: string
required: false
description: "The workshop ID of the collection for the test server to use"

extra-startup-args:
type: string
required: false
description: "Extra arguments to pass to the test server on startup"
default: ""

ssh-private-key:
type: string
required: false
description: "The Private SSH key to use when cloning the dependencies"

github-token:
type: string
required: false
description: "A GitHub Personal Access Token"

timeout:
type: string
required: false
description: "How many minutes to let the job run before killing the server (small projects shouldn't need more than 2 minutes)"
default: "2"

branch:
type: string
required: false
description: "Which GMod branch to run your tests on. Must be: 'live' or 'x86-64'"
default: "live"

gluatest-ref:
type: string
required: false
description: "With tag/branch of GLuaTest to run"
default: "main"

custom-overrides:
type: string
required: false
description: "An absolute path with custom files to copy to the server directly. Structure should match the contents of `garrysmod/`"

jobs:
test:
name: "Run tests"
runs-on: ubuntu-latest

steps:
- name: "Check out the repo"
uses: actions/checkout@v4
with:
path: project

- name: Set up output files
run: |
cd $GITHUB_WORKSPACE
touch $GITHUB_WORKSPACE/project/${{ inputs.requirements }}
echo "gluatest_github_output 1" >> $GITHUB_WORKSPACE/project/${{ inputs.server-cfg }}

- name: Get latest GLuaTest version
id: latest-tag-getter
run: |
cd $GITHUB_WORKSPACE

git clone --single-branch --branch ${{ inputs.gluatest-ref }} --depth 1 https://github.com/CFC-Servers/GLuaTest.git gluatest

git fetch --quiet --tags
latest="$(git describe --tags `git rev-list --tags --max-count=1`)"
echo "Latest Tag: $latest"
echo "LATEST_TAG=$latest" >> $GITHUB_OUTPUT

cd $GITHUB_WORKSPACE

- name: Prepare the override directory
run: |
cd $GITHUB_WORKSPACE/project

get_gamemode_name () {
gamemode_file=$(grep --recursive --word-regexp --files-with-matches '"base"')
gamemode_name=$(head --quiet --lines 1 "$gamemode_file" | tr --delete '"')

echo "$gamemode_name"
}

source="$GITHUB_WORKSPACE/project"
dest="$GITHUB_WORKSPACE/garrysmod_override/"

if [ -d "garrysmod" ]; then
# The repo contains a full server
source="$GITHUB_WORKSPACE/project/garrysmod"
elif [ -d "gamemodes" ]; then
# The repo is the contents of a garrysmod/ dir - we can copy its contents directly
:
elif [ -d "gamemode" ]; then
# The repo is the contents of a gamemode
gamemode_name=$(get_gamemode_name)
dest="$GITHUB_WORKSPACE/garrysmod_override/gamemodes/$gamemode_name/"
elif [ -d "lua" ]; then
# The repo is likely an addon
dest="$GITHUB_WORKSPACE/garrysmod_override/addons/project/"
else
echo "::error title=Unknown project structure!::Please report this: https://github.com/CFC-Servers/GLuaTest/issues"
exit 1
fi

mkdir --verbose --parents "$dest"
cp --recursive --verbose $source/* "$dest/"

- name: Sync custom overrides
if: ${{ inputs.custom-overrides }}
run: |
rsync --verbose --archive ${{ inputs.custom-overrides }} $GITHUB_WORKSPACE/garrysmod_override/

- name: Build GLuaTest
env:
REQUIREMENTS: "${{ github.workspace }}/project/${{ inputs.requirements }}"
CUSTOM_SERVER_CONFIG: "${{ github.workspace }}/project/${{ inputs.server-cfg }}"
PROJECT_DIR: "${{ github.workspace }}/garrysmod_override"

run: |
cd $GITHUB_WORKSPACE/gluatest/docker
docker build --build-arg="GMOD_BRANCH=${{ inputs.branch }}" --build-arg="GLUATEST_REF=${{ inputs.gluatest-ref }}" --tag ghcr.io/cfc-servers/gluatest:latest .

- name: Run GLuaTest
env:
REQUIREMENTS: "${{ github.workspace }}/project/${{ inputs.requirements }}"
CUSTOM_SERVER_CONFIG: "${{ github.workspace }}/project/${{ inputs.server-cfg }}"
PROJECT_DIR: "${{ github.workspace }}/garrysmod_override"
EXTRA_STARTUP_ARGS: "${{ inputs.extra-startup-args }}"
GAMEMODE: "${{ inputs.gamemode }}"
COLLECTION_ID: "${{ inputs.collection }}"
SSH_PRIVATE_KEY: "${{ inputs.ssh-private-key }}"
GITHUB_TOKEN: "${{ inputs.github-token }}"
TIMEOUT: "${{ inputs.timeout }}"

run: |
docker compose up --pull never --no-log-prefix --exit-code-from runner
exitstatus=$?

if [ $exitstatus -ne 0 ]; then
exit $exitstatus
fi
Loading
Loading