-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
121 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}'."} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters