Skip to content

Commit

Permalink
Run tests automatically on push
Browse files Browse the repository at this point in the history
  • Loading branch information
mphe committed May 18, 2024
1 parent dc77e39 commit 3d6d270
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: ⚙️ CI
on:
push:
# branches: [ master ]
paths-ignore:
- "README.md"
- "LICENSE"
- "**/*.png"
- "**/*.svg"

pull_request:
# branches: [ master ]
paths-ignore:
- "README.md"
- "LICENSE"
- "**/*.png"
- "**/*.svg"

jobs:
ci-unit-tests:
name: "⚙️ CI: Unit tests"
uses: ./.github/workflows/unit_tests.yml
with:
repo-ref: ${{ github.ref }}

111 changes: 111 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: 🔎 Unit tests
on:
workflow_call:
inputs:
godot-version:
description: Godot Engine version to use for testing.
type: string
default: 4.2.1-stable
repo-ref:
description: A commit, branch or tag to use for testing.
type: string
required: true

workflow_dispatch:
inputs:
godot-version:
description: Godot Engine version to use for testing.
type: string
default: 4.2.1-stable
repo-ref:
description: A commit, branch or tag to use for testing.
type: string
required: true

jobs:
unit-tests-linux:
name: 🔎 Unit tests - Linux
runs-on: "ubuntu-latest"

env:
DONWLOAD_URL: https://github.com/godotengine/godot/releases/download/${{inputs.godot-version}}/Godot_v${{inputs.godot-version}}_linux.x86_64.zip
BIN: Godot_v${{inputs.godot-version}}_linux.x86_64

steps:
- name: Download Godot
shell: bash
run: |
echo "Godot version: ${{ github.event.inputs.godot-version }}"
mkdir -p bin
cd bin
wget "${DONWLOAD_URL}" -O godot.zip
unzip godot.zip
chmod u+x ${BIN}
rm godot.zip
ls -l
- name: Verify Godot binary
shell: bash
run: |
ls -l ./bin/
./bin/${BIN} --version
- name: Clone repository
uses: actions/checkout@v4
with:
path: repo
ref: ${{ inputs.repo-ref }}

- name: Run tests
shell: bash
run: |
: # Run an editor process in background, because we need its LSP server
./bin/${BIN} --headless --path ./repo/ --editor &
sleep 5
./bin/${BIN} --headless --path ./repo/ --script addons/gut/gut_cmdln.gd -gdir=res://test/ -gexit
unit-tests-windows:
name: 🔎 Unit tests - Windows
runs-on: "ubuntu-latest"

env:
DONWLOAD_URL: https://github.com/godotengine/godot/releases/download/${{inputs.godot-version}}/Godot_v${{inputs.godot-version}}_win64.exe.zip
BIN: Godot_v${{inputs.godot-version}}_win64.exe

steps:
- name: Download Godot
shell: bash
run: |
echo "Godot version: ${{ github.event.inputs.godot-version }}"
mkdir -p bin
cd bin
wget "${DONWLOAD_URL}" -O godot.zip
unzip godot.zip
chmod u+x ${BIN}
rm godot.zip
ls -l
- name: Install wine
shell: bash
run: |
apt-get install wine-stable
- name: Verify Godot binary
shell: bash
run: |
ls -l ./bin/
./bin/${BIN} --version
- name: Clone repository
uses: actions/checkout@v4
with:
path: repo
ref: ${{ inputs.repo-ref }}

- name: Run tests
shell: bash
run: |
: # Run an editor process in background, because we need its LSP server
wine ./bin/${BIN} --headless --path ./repo/ --editor &
sleep 5
wine ./bin/${BIN} --headless --path ./repo/ --script addons/gut/gut_cmdln.gd -gdir=res://test/ -gexit

0 comments on commit 3d6d270

Please sign in to comment.