Skip to content

Commit 48e201b

Browse files
committed
Run tests automatically on push
1 parent dc77e39 commit 48e201b

File tree

3 files changed

+135
-1
lines changed

3 files changed

+135
-1
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: ⚙️ CI
2+
on:
3+
push:
4+
# branches: [ master ]
5+
paths-ignore:
6+
- "README.md"
7+
- "LICENSE"
8+
- "**/*.png"
9+
- "**/*.svg"
10+
11+
pull_request:
12+
# branches: [ master ]
13+
paths-ignore:
14+
- "README.md"
15+
- "LICENSE"
16+
- "**/*.png"
17+
- "**/*.svg"
18+
19+
jobs:
20+
ci-unit-tests:
21+
name: "⚙️ CI: Unit tests"
22+
uses: ./.github/workflows/unit_tests.yml
23+
with:
24+
repo-ref: ${{ github.ref }}
25+

.github/workflows/unit_tests.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: 🔎 Unit tests
2+
on:
3+
workflow_call:
4+
inputs:
5+
godot-version:
6+
description: Godot Engine version to use for testing.
7+
type: string
8+
default: 4.2.1-stable
9+
repo-ref:
10+
description: A commit, branch or tag to use for testing.
11+
type: string
12+
required: true
13+
14+
workflow_dispatch:
15+
inputs:
16+
godot-version:
17+
description: Godot Engine version to use for testing.
18+
type: string
19+
default: 4.2.1-stable
20+
repo-ref:
21+
description: A commit, branch or tag to use for testing.
22+
type: string
23+
required: true
24+
25+
jobs:
26+
unit-tests-linux:
27+
name: 🔎 Unit tests - Linux
28+
runs-on: "ubuntu-latest"
29+
container: ghcr.io/catthehacker/ubuntu:act-latest
30+
31+
env:
32+
DONWLOAD_URL: https://github.com/godotengine/godot/releases/download/${{inputs.godot-version}}/Godot_v${{inputs.godot-version}}_linux.x86_64.zip
33+
BIN: Godot_v${{inputs.godot-version}}_linux.x86_64
34+
35+
steps:
36+
- name: Setup
37+
shell: bash
38+
run: |
39+
apt-get update
40+
apt-get install -y wget unzip
41+
42+
- name: Download Godot
43+
shell: bash
44+
run: |
45+
echo "Godot version: ${{ github.event.inputs.godot-version }}"
46+
mkdir -p bin
47+
cd bin
48+
wget "${DONWLOAD_URL}" -O godot.zip
49+
unzip godot.zip
50+
chmod u+x ${BIN}
51+
rm godot.zip
52+
ls -l
53+
54+
- name: Clone repository
55+
uses: actions/checkout@v4
56+
with:
57+
path: repo
58+
ref: ${{ inputs.repo-ref }}
59+
60+
- name: Run tests
61+
shell: bash
62+
run: |
63+
: # Run an editor process in background, because we need its LSP server
64+
./bin/${BIN} --headless --path ./repo/ --editor &
65+
sleep 10
66+
./bin/${BIN} --headless --path ./repo/ --script addons/gut/gut_cmdln.gd -gdir=res://test/ -gexit
67+
68+
unit-tests-windows:
69+
name: 🔎 Unit tests - Windows
70+
runs-on: "ubuntu-latest"
71+
container: ghcr.io/catthehacker/ubuntu:act-latest
72+
73+
env:
74+
DONWLOAD_URL: https://github.com/godotengine/godot/releases/download/${{inputs.godot-version}}/Godot_v${{inputs.godot-version}}_win32.exe.zip
75+
BIN: Godot_v${{inputs.godot-version}}_win32.exe
76+
77+
steps:
78+
- name: Setup
79+
shell: bash
80+
run: |
81+
dpkg --add-architecture i386
82+
apt-get update
83+
apt-get install -y wget unzip wine-stable wine32
84+
85+
- name: Download Godot
86+
shell: bash
87+
run: |
88+
echo "Godot version: ${{ github.event.inputs.godot-version }}"
89+
mkdir -p bin
90+
cd bin
91+
wget "${DONWLOAD_URL}" -O godot.zip
92+
unzip godot.zip
93+
chmod u+x ${BIN}
94+
rm godot.zip
95+
ls -l
96+
97+
- name: Clone repository
98+
uses: actions/checkout@v4
99+
with:
100+
path: repo
101+
ref: ${{ inputs.repo-ref }}
102+
103+
- name: Run tests
104+
shell: bash
105+
run: |
106+
: # Run an editor process in background, because we need its LSP server
107+
wine ./bin/${BIN} --headless --path ./repo/ --editor &
108+
sleep 10
109+
wine ./bin/${BIN} --headless --path ./repo/ --script addons/gut/gut_cmdln.gd -gdir=res://test/ -gexit

test/BaseTest.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func _get_diagnostics(client: DiagnosticList_LSPClient, res_path: String) -> Dia
2626
client.on_publish_diagnostics.connect(_on_publish_diagnostics)
2727

2828
client.update_diagnostics(res_path, FileAccess.get_file_as_string(res_path))
29-
await client.on_publish_diagnostics
29+
await wait_for_signal(client.on_publish_diagnostics, 3)
3030

3131
client.on_publish_diagnostics.disconnect(_on_publish_diagnostics)
3232

0 commit comments

Comments
 (0)