Skip to content

Commit 7796fcc

Browse files
authored
Merge pull request #1622 from Repiteo/ci/runner
CI: Add `runner` workflow to call other workflows
2 parents ca5179f + c1524f7 commit 7796fcc

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.
@@ -11,7 +12,7 @@ env:
1112
LC_ALL: en_US.UTF-8
1213

1314
concurrency:
14-
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}
15+
group: ci-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }}
1516
cancel-in-progress: true
1617

1718
jobs:
@@ -94,7 +95,7 @@ jobs:
9495
env:
9596
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
9697
EM_VERSION: 3.1.39
97-
EM_CACHE_FOLDER: "emsdk-cache"
98+
EM_CACHE_FOLDER: emsdk-cache
9899

99100
steps:
100101
- name: Checkout
@@ -111,24 +112,24 @@ jobs:
111112
- name: Set up Python (for SCons)
112113
uses: actions/setup-python@v5
113114
with:
114-
python-version: '3.x'
115+
python-version: 3.x
115116

116117
- name: Android dependencies
117-
if: ${{ matrix.platform == 'android' }}
118+
if: matrix.platform == 'android'
118119
uses: nttld/setup-ndk@v1
119120
with:
120121
ndk-version: r23c
121122
link-to-sdk: true
122123

123124
- name: Web dependencies
124-
if: ${{ matrix.platform == 'web' }}
125+
if: matrix.platform == 'web'
125126
uses: mymindstorm/setup-emsdk@v14
126127
with:
127-
version: ${{env.EM_VERSION}}
128-
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
128+
version: ${{ env.EM_VERSION }}
129+
actions-cache-folder: ${{ env.EM_CACHE_FOLDER }}
129130

130131
- name: Setup MinGW for Windows/MinGW build
131-
if: ${{ matrix.platform == 'windows' && matrix.flags == 'use_mingw=yes' }}
132+
if: matrix.platform == 'windows' && matrix.flags == 'use_mingw=yes'
132133
uses: egor-tensin/setup-mingw@v2
133134
with:
134135
version: 12.2.0
@@ -164,7 +165,7 @@ jobs:
164165

165166
- name: Download latest Godot artifacts
166167
uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9
167-
if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION == 'master' }}
168+
if: matrix.run-tests && env.GODOT_TEST_VERSION == 'master'
168169
with:
169170
repo: godotengine/godot
170171
branch: master
@@ -178,21 +179,21 @@ jobs:
178179
path: godot-artifacts
179180

180181
- name: Prepare Godot artifacts for testing
181-
if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION == 'master' }}
182+
if: matrix.run-tests && env.GODOT_TEST_VERSION == 'master'
182183
run: |
183184
chmod +x ./godot-artifacts/godot.linuxbsd.editor.x86_64.mono
184185
echo "GODOT=$(pwd)/godot-artifacts/godot.linuxbsd.editor.x86_64.mono" >> $GITHUB_ENV
185186
186187
- name: Download requested Godot version for testing
187-
if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION != 'master' }}
188+
if: matrix.run-tests && env.GODOT_TEST_VERSION != 'master'
188189
run: |
189190
wget "https://github.com/godotengine/godot-builds/releases/download/${GODOT_TEST_VERSION}/Godot_v${GODOT_TEST_VERSION}_linux.x86_64.zip" -O Godot.zip
190191
unzip -a Godot.zip
191192
chmod +x "Godot_v${GODOT_TEST_VERSION}_linux.x86_64"
192193
echo "GODOT=$(pwd)/Godot_v${GODOT_TEST_VERSION}_linux.x86_64" >> $GITHUB_ENV
193194
194195
- name: Run tests
195-
if: ${{ matrix.run-tests }}
196+
if: matrix.run-tests
196197
run: |
197198
$GODOT --headless --version
198199
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)