Skip to content

Commit

Permalink
ci: add client tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Silverlan committed Jun 20, 2024
1 parent 7327089 commit 189a1a6
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 2 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/pragma-linux-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,20 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
files: "pragma-lin64.tar.gz"

- name: Run Tests
- name: Run Server Tests
uses: benc-uk/workflow-dispatch@v1
timeout-minutes: 10
with:
workflow: pragma-server-tests-ci.yml
inputs: '{ "os": "ubuntu" }'

- name: Run Tests
uses: benc-uk/workflow-dispatch@v1
timeout-minutes: 10
with:
workflow: pragma-tests-ci.yml
inputs: '{ "os": "ubuntu" }'

- name: Generate File Lists
shell: bash
if: always()
Expand Down
105 changes: 105 additions & 0 deletions .github/workflows/pragma-tests-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Run Tests

on:
workflow_dispatch:
inputs:
os:
type: choice
options:
- windows
- ubuntu
required: true

jobs:
test:
name: Tests - ${{ matrix.config.os }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- os: ${{ github.event.inputs.os == 'windows' && 'windows-latest' || 'ubuntu-24.04' }}

steps:
- name: Set Initial Workflow Status
run: echo "WORKFLOW_STATUS=success" >> $GITHUB_ENV

- name: Checkout repository
uses: actions/checkout@v3

- name: Download Pragma (Windows)
if: runner.os == 'Windows'
run: |
$repo = $env:GITHUB_REPOSITORY
Invoke-WebRequest -Uri "https://github.com/$repo/releases/download/nightly/pragma-win64.zip" -OutFile "pragma-win64.zip"
Expand-Archive -Path "pragma-win64.zip" -DestinationPath "pragma"
- name: Download Pragma (Linux)
if: runner.os == 'Linux'
run: |
wget https://github.com/$GITHUB_REPOSITORY/releases/download/nightly/pragma-lin64.tar.gz
mkdir pragma
tar -xzvf pragma-lin64.tar.gz -C pragma
- name: Run Test Scripts
shell: bash
run: |
cd "pragma"
if [ "$RUNNER_OS" == "Linux" ]; then
./pragma -cli -luaext -log 2 2 +map "test_physics" +"lua_exec tests/ci_runner_tests.lua"
else
./pragma.exe -cli -luaext -log 2 2 +map "test_physics" +"lua_exec tests/ci_runner_tests.lua"
fi
EXIT_CODE=$?
# Check the exit code
if [ $EXIT_CODE -eq 0 ]; then
echo "Tests were successful."
else
echo "Tests have failed with exit code $EXIT_CODE."
exit 1 # Exit the step with an error status
fi
- name: Check Result
shell: bash
run: |
CI_CONTENTS=$(cat "pragma/ci.txt")
if [ $exit_code -ne 0 ]; then
exit $exit_code
fi
if [ "$CI_CONTENTS" == "0" ]; then
echo "ci.txt contains '0'. Step failed."
exit 1
fi
- name: Upload Log
uses: actions/upload-artifact@v4
if: always()
with:
name: log
path: "pragma/log.txt"

- name: Upload Crashdumps
uses: actions/upload-artifact@v4
if: always()
with:
name: crashdumps
path: "pragma/crashdumps"

- name: Set Failure Workflow Status
if: failure()
run: echo "WORKFLOW_STATUS=failure" >> $GITHUB_ENV

- name: Set Failure Workflow Status
if: always()
shell: bash
run: |
echo "WORKFLOW_STATUS=failure" >> $GITHUB_ENV
- uses: LouisBrunner/checks-action@v2.0.0
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
conclusion: ${{ env.WORKFLOW_STATUS }}
name: "Tests - ${{ matrix.config.os }}"
output: |
{"summary":"Test result is '${{ env.WORKFLOW_STATUS }}'."}
9 changes: 8 additions & 1 deletion .github/workflows/pragma-windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,20 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
files: "debug_pdb.zip"

- name: Run Tests
- name: Run Server Tests
uses: benc-uk/workflow-dispatch@v1
timeout-minutes: 10
with:
workflow: pragma-server-tests-ci.yml
inputs: '{ "os": "windows" }'

- name: Run Tests
uses: benc-uk/workflow-dispatch@v1
timeout-minutes: 10
with:
workflow: pragma-tests-ci.yml
inputs: '{ "os": "windows" }'

- name: Generate File Lists
shell: bash
if: always()
Expand Down

0 comments on commit 189a1a6

Please sign in to comment.