-
-
Notifications
You must be signed in to change notification settings - Fork 246
129 lines (109 loc) · 3.84 KB
/
unit_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: unit-test
run-name: ${{ github.head_ref || github.ref_name }}-unit-test
on:
push:
paths-ignore:
- '**.yml'
- '**.md'
pull_request:
paths-ignore:
- '**.yml'
- '**.md'
workflow_dispatch:
concurrency:
group: unit-test${{ github.event.number }}
cancel-in-progress: true
jobs:
unit-test:
strategy:
fail-fast: false
matrix:
# Insert here the Godot version you want to run your tests with.
godot-version: ['4.2.1']
name: "CI Unit Test v${{ matrix.godot-version }}"
runs-on: 'ubuntu-22.04'
# The overall timeout.
timeout-minutes: 10
steps:
- name: "Checkout your Repository"
uses: actions/checkout@v3
with:
lfs: true
- name: "Download and Install Godot ${{ matrix.godot-version }}"
continue-on-error: false
shell: bash
run: |
GODOT_HOME=$HOME/bin
GODOT_BIN=$GODOT_HOME/godot
mkdir -p $GODOT_HOME
chmod 770 $GODOT_HOME
GODOT_CONF_PATH=$HOME/.config/godot
if [ ! -d $GODOT_CONF_PATH ]; then
mkdir -p $GODOT_CONF_PATH
chmod 770 $GODOT_CONF_PATH
fi
GODOT_PACKAGE=Godot_v${{ matrix.godot-version }}-stable_linux.x86_64
wget https://github.com/godotengine/godot/releases/download/${{ matrix.godot-version }}-stable/$GODOT_PACKAGE.zip -P ${{ runner.temp }}
unzip ${{ runner.temp }}/$GODOT_PACKAGE.zip -d $GODOT_HOME
mv $GODOT_HOME/$GODOT_PACKAGE $GODOT_BIN
chmod u+x $GODOT_BIN
echo "GODOT_HOME=$GODOT_HOME" >> "$GITHUB_ENV"
echo "GODOT_BIN=$GODOT_BIN" >> "$GITHUB_ENV"
- name: "Copy `project.godot`"
run: cp .github/workflows/resources/project.godot .
- name: "Clone the gdUnit4 repository"
run: |
git clone --branch v4.2.0 --single-branch https://github.com/MikeSchulze/gdUnit4
rsync -av gdUnit4/addons/ ./addons/
rm -rf ./gdUnit4
- name: Print Directory Structure
run: |
ls -R
# We need to update the project before running tests, Godot has actually issues with loading the plugin.
- name: "Update Project"
if: ${{ !cancelled() }}
timeout-minutes: 1
# We still ignore the timeout, the script is not quit and we run into a timeout.
continue-on-error: true
shell: bash
run: |
xvfb-run --auto-servernum ${{ env.GODOT_BIN }} -e --path . -s res://addons/gdUnit4/bin/ProjectScanner.gd --headless --audio-driver Dummy
- name: "Run Unit Tests"
if: ${{ !cancelled() }}
# Set your expected test timeout.
timeout-minutes: 8
env:
GODOT_BIN: ${{ env.GODOT_BIN }}
shell: bash
run: |
chmod +x ./addons/gdUnit4/runtest.sh
xvfb-run --auto-servernum ./addons/gdUnit4/runtest.sh --add "res://addons/dialogic/Tests/" --audio-driver Dummy --display-driver x11 --rendering-driver opengl3 --screen 0 --continue
- name: "Publish Test Report"
if: ${{ always() }}
uses: dorny/[email protected]
with:
name: "test_report_${{ matrix.godot-version }}"
path: "reports/**/results.xml"
reporter: java-junit
fail-on-error: 'false'
- name: "Upload Unit Test Reports"
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: "test_report_${{ matrix.godot-version }}"
path: |
reports/**
/var/lib/systemd/coredump/**
/var/log/syslog
finalize:
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
name: Final Results
needs: [unit-test]
steps:
- run: exit 1
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
}}