Skip to content

master-ci-dev

master-ci-dev #119

Workflow file for this run

name: ci-dev
run-name: ${{ github.head_ref || github.ref_name }}-ci-dev
on:
push:
branches:
- master
paths-ignore:
- '**.jpg'
- '**.png'
- '**.md'
workflow_dispatch:
schedule:
- cron: "0 0 * * 6" # At 12:00 AM, only on Saturday
concurrency:
group: ci-dev-${{ github.event.number }}
cancel-in-progress: true
jobs:
unit-tests:
runs-on: ${{ matrix.dotnet-version == 'net7.0' && 'ubuntu-22.04' || 'ubuntu-24.04' }}
strategy:
fail-fast: false
max-parallel: 10
matrix:
godot-version: ['4.2', '4.2.1', '4.2.2', '4.3']
godot-status: ['stable']
dotnet-version: ['', 'net7.0', 'net8.0']
version: ['master', 'latest']
permissions:
actions: read
contents: read
checks: write
pull-requests: write
statuses: write
name: 'GdUnit4 ${{ matrix.version }} on Godot_${{ matrix.godot-version }} ${{ matrix.dotnet-version }}'
steps:
- name: 'Checkout gdUnit4-action'
uses: actions/checkout@v4
with:
lfs: true
- name: 'Install test project'
shell: bash
run: |
mv -f .github/workflows/resources/* .
- name: 'Test gdUnit4-action: GdUnit4 ${{ matrix.version }} - Godot_${{ matrix.godot-version }}'
if: ${{ matrix.dotnet-version == '' }}
id: test-action
continue-on-error: true
timeout-minutes: 5
uses: ./
with:
godot-version: ${{ matrix.godot-version }}
godot-status: ${{ matrix.godot-status }}
version: ${{ matrix.version }}
paths: |
res://tests/
res://tests-2/
timeout: 2
publish-report: false
report-name: gdUnit4_${{ matrix.version }}_Godot${{ matrix.godot-version }}${{ matrix.dotnet-version }}
- name: 'Verify used Godot version if failed'
if: ${{ steps.test-action.outcome == 'failure'}}
shell: bash
run: |
if [[ "${{ matrix.version }}" == "master" && "${{ matrix.godot-version }}" < "4.3" ]]; then
echo "The test should fail for master version on Godot < 4.3, to not report as error"
else
echo "Test gdUnit4-action: GdUnit4 ${{ matrix.version }} - Godot_${{ matrix.godot-version }} failed."
exit 1
fi
- name: 'Test gdUnit4-action: GdUnit4 ${{ matrix.version }} - Godot_${{ matrix.godot-version }}-${{ matrix.dotnet-version }}'
if: ${{ matrix.dotnet-version != '' }}
env:
DOTNET_VERSION: ${{ matrix.dotnet-version }}
timeout-minutes: 5
uses: ./
with:
godot-version: ${{ matrix.godot-version }}
godot-status: ${{ matrix.godot-status }}
godot-net: true
dotnet-version: ${{ matrix.dotnet-version }}
version: ${{ matrix.version }}
paths: 'res://tests/mono'
timeout: 2
retries: 3 # We have set the number of repetitions to 3 because Godot .Net randomly crashes during C# tests
publish-report: false
report-name: gdUnit4_${{ matrix.version }}_Godot${{ matrix.godot-version }}${{ matrix.dotnet-version }}
unit-tests-custom-working-directory:
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
checks: write
pull-requests: write
statuses: write
name: 'action on custom working directory'
steps:
- name: 'Checkout gdUnit4-action'
uses: actions/checkout@v4
with:
lfs: true
- name: 'Install custom test project'
shell: bash
run: |
mv -f .github/workflows/custom_workpath/ ./custom_workpath/
- name: 'Test gdUnit4-action: on custom project directory'
timeout-minutes: 5
uses: ./
with:
godot-version: 4.2.2
project_dir: './custom_workpath/'
paths: |
res://tests/
timeout: 2
publish-report: false
report-name: gdUnit4-custom-working-directory
- name: 'Test gdUnit4-action: on custom project directory C#'
timeout-minutes: 5
uses: ./
with:
godot-version: 4.2.2
godot-net: true
version: 'installed'
project_dir: './custom_workpath/'
paths: 'res://tests/'
timeout: 2
publish-report: false
report-name: gdUnit4-custom-working-directory-net
# run gdscript tests with using Godot Net executable
unit-tests-force-godot-mono:
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
checks: write
pull-requests: write
statuses: write
name: 'action dotnet-version set to NET8.0'
steps:
- name: 'Checkout gdUnit4-action'
uses: actions/checkout@v4
with:
lfs: true
- name: 'Install custom test project'
shell: bash
run: |
mv -f .github/workflows/resources/* .
- name: 'Test gdUnit4-action: force run Godot net8.0'
env:
DOTNET_VERSION: 'net8.0'
id: test-force-mono
timeout-minutes: 5
uses: ./
with:
godot-version: 4.2.2
godot-force-mono : 'true'
dotnet-version: 'net8.0'
paths: |
res://tests/
timeout: 2
report-name: gdUnit4-force-mono
# tests if the action reports test failures the action must fail
action-fail-test:
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
name: 'action failing'
steps:
- name: 'Checkout gdUnit4-action'
uses: actions/checkout@v4
with:
lfs: true
- name: 'Install test project'
shell: bash
run: |
mv -f .github/workflows/resources/* .
- name: 'Run failing failing test'
id: test-fails
continue-on-error: true
timeout-minutes: 3
env:
GDUNIT_FAIL: 'true'
uses: ./
with:
godot-version: 4.2.2
paths: |
res://tests/
timeout: 2
publish-report: false
report-name: action_fail_gdUnit4
- if: ${{ steps.test-fails.outcome != 'failure' }}
shell: bash
run: |
echo "The step 'steps.test-fails' must fail but is ${{ steps.test-fails.outcome}}"
exit 1
# tests do not build the report
action-disable-report:
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
name: 'action without report generation'
steps:
- name: 'Checkout gdUnit4-action'
uses: actions/checkout@v4
with:
lfs: true
- name: 'Install test project'
shell: bash
run: |
mv -f .github/workflows/resources/* .
- name: 'Run failing failing test'
timeout-minutes: 3
uses: ./
with:
godot-version: 4.2.2
paths: |
res://tests/
publish-report: false
report-name: action_create-report_false
# tests report warning
action-ends-with-warnings:
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
name: 'action report warning'
steps:
- name: 'Checkout gdUnit4-action'
uses: actions/checkout@v4
with:
lfs: true
- name: 'Install test project'
shell: bash
run: |
mv -f .github/workflows/resources/* .
- name: 'Run tests with produces warnings'
id: test-id
continue-on-error: true
timeout-minutes: 1
uses: ./
with:
godot-version: 4.3
paths: 'res://tests/tests_with_warnings_test.gd'
publish-report: false
report-name: action_ends-with-warnings
- name: 'Verify test results'
shell: bash
run: |
echo 'Verifying test results for warnings (should pass but with warning code)'
echo 'Outcome: ${{ steps.test-id.outcome }}'
echo 'Exit code: ${{ steps.test-id.outputs.exit_code }}'
if [[ '${{ steps.test-id.outcome }}' != 'success' ]]; then
echo 'ERROR: Test with warnings should succeed'
echo 'Expected outcome: success'
echo 'Actual outcome: ${{ steps.test-id.outcome }}'
exit 1
fi
if [[ '${{ steps.test-id.outputs.exit_code }}' != '101' ]]; then
echo 'ERROR: Test with warnings should return warning code'
echo 'Expected exit code: 101 (WARNING)'
echo 'Actual exit code: ${{ steps.test-id.outputs.exit_code }}'
exit 1
fi
# tests report warning as error
action-ends-with-warnings-as-errors:
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
name: 'action report warning as error'
steps:
- name: 'Checkout gdUnit4-action'
uses: actions/checkout@v4
with:
lfs: true
- name: 'Install test project'
shell: bash
run: |
mv -f .github/workflows/resources/* .
- name: 'Run tests with produces warnings but treated as error'
id: test-id
continue-on-error: true
timeout-minutes: 1
uses: ./
with:
godot-version: 4.3
warnings-as-errors: true
paths: 'res://tests/tests_with_warnings_test.gd'
publish-report: false
report-name: action_create-with-warnings-as-errors
- name: 'Verify test results'
shell: bash
run: |
echo 'Verifying test results for warning treated as error (should fail)'
echo 'Outcome: ${{ steps.test-id.outcome }}'
echo 'Exit code: ${{ steps.test-id.outputs.exit_code }}'
if [[ '${{ steps.test-id.outcome }}' != 'failure' ]]; then
echo 'ERROR: Test with warnings-as-errors should fail'
echo 'Expected outcome: failure'
echo 'Actual outcome: ${{ steps.test-id.outcome }}'
exit 1
fi
if [[ '${{ steps.test-id.outputs.exit_code }}' != '101' ]]; then
echo 'ERROR: Test with warnings-as-errors should return warning code'
echo 'Expected exit code: 101 (WARNING)'
echo 'Actual exit code: ${{ steps.test-id.outputs.exit_code }}'
exit 1
fi
finalize:
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
name: 'Final Results'
needs:
- unit-tests
- unit-tests-custom-working-directory
- unit-tests-force-godot-mono
- action-fail-test
- action-disable-report
- action-ends-with-warnings
- action-ends-with-warnings-as-errors
steps:
- run: exit 1
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
}}