Tests in CI with GitHub Actions
gdt test runs the project’s existing test framework headless with the project’s Godot version. It imports a fresh
clone first, judges the result from the JUnit report and not from the exit code alone, and exits with 10 when tests
fail (0 when they pass), so a CI step fails the way you expect.
Locally
Section titled “Locally”gdt test # the runner found from addons/, or [test] in gdt.tomlgdt test test/unit # only some folders or filesgdt test --report junit.xml # also copy the JUnit fileGUT has been run for real with gdt. gdUnit4 support follows its documentation and has not been run against a real
project yet; plain script suites work ([test] runner = "script").
On GitHub Actions
Section titled “On GitHub Actions”name: Tests
on: push: branches: [main] pull_request:
permissions: contents: read
jobs: test: runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{ github.token }} # raises the GitHub API rate limit for downloads steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install gdt run: | curl -fsSL https://gdt.roxguel.dev/install.sh | sh -s -- --version 0.1.0 echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Install Godot and the addons run: gdt sync
- name: Run the tests run: gdt test --report junit.xml
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 if: always() with: name: junit path: junit.xmlNotes:
- Pin the
gdtversion (--version) so a new release never changes your CI by surprise, and pin third-party actions to a full commit SHA, as above. gdt syncreads the Godot version and the addons fromgdt.tomlandgdt.lock. The project needs no other CI configuration.- On a Windows runner use
irm https://gdt.roxguel.dev/install.ps1 | iexin apwshstep and add$env:LOCALAPPDATA\Programs\gdtto$env:GITHUB_PATH. - Do not give a workflow that runs pull requests from forks any secret.
Details: testing spec, exit codes.
Independent community project. Not affiliated with, endorsed by or sponsored by the Godot Foundation or the Godot Engine project. “Godot” is a trademark of the Godot Foundation; this site does not use the Godot logo.