Skip to content

Commit 762cc82

Browse files
committed
Run tests automatically on push
1 parent dc77e39 commit 762cc82

File tree

3 files changed

+143
-1
lines changed

3 files changed

+143
-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: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
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: ubuntu
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: Start editor
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+
67+
- name: Run tests
68+
shell: bash
69+
run: |
70+
./bin/${BIN} --headless --path ./repo/ --script addons/gut/gut_cmdln.gd -gdir=res://test/ -gexit
71+
72+
unit-tests-windows:
73+
name: 🔎 Unit tests - Windows
74+
runs-on: "ubuntu-latest"
75+
container: ubuntu
76+
77+
env:
78+
DONWLOAD_URL: https://github.com/godotengine/godot/releases/download/${{inputs.godot-version}}/Godot_v${{inputs.godot-version}}_win32.exe.zip
79+
BIN: Godot_v${{inputs.godot-version}}_win32.exe
80+
81+
steps:
82+
- name: Setup
83+
shell: bash
84+
run: |
85+
dpkg --add-architecture i386
86+
apt-get update
87+
apt-get install -y wget unzip wine-stable wine32
88+
89+
- name: Download Godot
90+
shell: bash
91+
run: |
92+
echo "Godot version: ${{ github.event.inputs.godot-version }}"
93+
mkdir -p bin
94+
cd bin
95+
wget "${DONWLOAD_URL}" -O godot.zip
96+
unzip godot.zip
97+
chmod u+x ${BIN}
98+
rm godot.zip
99+
ls -l
100+
101+
- name: Clone repository
102+
uses: actions/checkout@v4
103+
with:
104+
path: repo
105+
ref: ${{ inputs.repo-ref }}
106+
107+
- name: Start editor
108+
shell: bash
109+
run: |
110+
: # Run an editor process in background, because we need its LSP server
111+
wine ./bin/${BIN} --headless --path ./repo/ --editor &
112+
sleep 10
113+
114+
- name: Run tests
115+
shell: bash
116+
run: |
117+
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)