Skip to content

Commit c1524f7

Browse files
committed
CI: Add runner workflow to call other workflows
1 parent 6facde3 commit c1524f7

File tree

5 files changed

+58
-31
lines changed

5 files changed

+58
-31
lines changed

.github/actions/godot-cache-restore/action.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@ description: Restore Godot build cache.
33
inputs:
44
cache-name:
55
description: The cache base name (job name by default).
6-
default: "${{github.job}}"
6+
default: ${{ github.job }}
77
scons-cache:
8-
description: The scons cache path.
9-
default: "${{github.workspace}}/.scons-cache/"
8+
description: The SCons cache path.
9+
default: ${{ github.workspace }}/.scons-cache/
10+
1011
runs:
11-
using: "composite"
12+
using: composite
1213
steps:
13-
- name: Restore .scons_cache directory
14-
uses: actions/cache/restore@v3
14+
- name: Restore SCons cache directory
15+
uses: actions/cache/restore@v4
1516
with:
16-
path: ${{inputs.scons-cache}}
17-
key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
17+
path: ${{ inputs.scons-cache }}
18+
key: ${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}
19+
1820
restore-keys: |
19-
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
20-
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
21-
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}
21+
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}
22+
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}
23+
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-refs/heads/${{ env.GODOT_BASE_BRANCH }}
24+
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}

.github/actions/godot-cache-save/action.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ description: Save Godot build cache.
33
inputs:
44
cache-name:
55
description: The cache base name (job name by default).
6-
default: "${{github.job}}"
6+
default: ${{ github.job }}
77
scons-cache:
88
description: The SCons cache path.
9-
default: "${{github.workspace}}/.scons-cache/"
9+
default: ${{ github.workspace }}/.scons-cache/
10+
1011
runs:
11-
using: "composite"
12+
using: composite
1213
steps:
1314
- name: Save SCons cache directory
1415
uses: actions/cache/save@v4
1516
with:
16-
path: ${{inputs.scons-cache}}
17-
key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
17+
path: ${{ inputs.scons-cache }}
18+
key: ${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}

.github/workflows/ci.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Continuous integration
2-
on: [push, pull_request]
2+
on:
3+
workflow_call:
34

45
env:
56
# Only used for the cache key. Increment version to force clean build.
@@ -8,7 +9,7 @@ env:
89
GODOT_TEST_VERSION: master
910

1011
concurrency:
11-
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}
12+
group: ci-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }}
1213
cancel-in-progress: true
1314

1415
jobs:
@@ -91,7 +92,7 @@ jobs:
9192
env:
9293
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
9394
EM_VERSION: 3.1.39
94-
EM_CACHE_FOLDER: "emsdk-cache"
95+
EM_CACHE_FOLDER: emsdk-cache
9596

9697
steps:
9798
- name: Checkout
@@ -108,24 +109,24 @@ jobs:
108109
- name: Set up Python (for SCons)
109110
uses: actions/setup-python@v5
110111
with:
111-
python-version: '3.x'
112+
python-version: 3.x
112113

113114
- name: Android dependencies
114-
if: ${{ matrix.platform == 'android' }}
115+
if: matrix.platform == 'android'
115116
uses: nttld/setup-ndk@v1
116117
with:
117118
ndk-version: r23c
118119
link-to-sdk: true
119120

120121
- name: Web dependencies
121-
if: ${{ matrix.platform == 'web' }}
122+
if: matrix.platform == 'web'
122123
uses: mymindstorm/setup-emsdk@v14
123124
with:
124-
version: ${{env.EM_VERSION}}
125-
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
125+
version: ${{ env.EM_VERSION }}
126+
actions-cache-folder: ${{ env.EM_CACHE_FOLDER }}
126127

127128
- name: Setup MinGW for Windows/MinGW build
128-
if: ${{ matrix.platform == 'windows' && matrix.flags == 'use_mingw=yes' }}
129+
if: matrix.platform == 'windows' && matrix.flags == 'use_mingw=yes'
129130
uses: egor-tensin/setup-mingw@v2
130131
with:
131132
version: 12.2.0
@@ -161,7 +162,7 @@ jobs:
161162

162163
- name: Download latest Godot artifacts
163164
uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9
164-
if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION == 'master' }}
165+
if: matrix.run-tests && env.GODOT_TEST_VERSION == 'master'
165166
with:
166167
repo: godotengine/godot
167168
branch: master
@@ -175,21 +176,21 @@ jobs:
175176
path: godot-artifacts
176177

177178
- name: Prepare Godot artifacts for testing
178-
if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION == 'master' }}
179+
if: matrix.run-tests && env.GODOT_TEST_VERSION == 'master'
179180
run: |
180181
chmod +x ./godot-artifacts/godot.linuxbsd.editor.x86_64.mono
181182
echo "GODOT=$(pwd)/godot-artifacts/godot.linuxbsd.editor.x86_64.mono" >> $GITHUB_ENV
182183
183184
- name: Download requested Godot version for testing
184-
if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION != 'master' }}
185+
if: matrix.run-tests && env.GODOT_TEST_VERSION != 'master'
185186
run: |
186187
wget "https://github.com/godotengine/godot-builds/releases/download/${GODOT_TEST_VERSION}/Godot_v${GODOT_TEST_VERSION}_linux.x86_64.zip" -O Godot.zip
187188
unzip -a Godot.zip
188189
chmod +x "Godot_v${GODOT_TEST_VERSION}_linux.x86_64"
189190
echo "GODOT=$(pwd)/Godot_v${GODOT_TEST_VERSION}_linux.x86_64" >> $GITHUB_ENV
190191
191192
- name: Run tests
192-
if: ${{ matrix.run-tests }}
193+
if: matrix.run-tests
193194
run: |
194195
$GODOT --headless --version
195196
cd test

.github/workflows/runner.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: 🔗 GHA
2+
on: [push, pull_request, merge_group]
3+
4+
concurrency:
5+
group: ci-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }}-runner
6+
cancel-in-progress: true
7+
8+
jobs:
9+
# First stage: Only static checks, fast and prevent expensive builds from running.
10+
11+
static-checks:
12+
if: '!vars.DISABLE_GODOT_CI'
13+
name: 📊 Static Checks
14+
uses: ./.github/workflows/static_checks.yml
15+
16+
# Second stage: Run all the builds and some of the tests.
17+
18+
ci:
19+
name: 🛠️ Continuous Integration
20+
needs: static-checks
21+
uses: ./.github/workflows/ci.yml

.github/workflows/static_checks.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: 📊 Static Checks
2-
on: [push, pull_request]
2+
on:
3+
workflow_call:
34

45
concurrency:
5-
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-static
6+
group: ci-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }}-static
67
cancel-in-progress: true
78

89
jobs:

0 commit comments

Comments
 (0)