Merge pull request #853 from Faless/build/4.x_ci_cache

[CI] Add concurrency and scons caching.
pull/855/head
Fabio Alessandrelli 2022-09-19 19:03:14 +02:00 committed by GitHub
commit a330342e4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 1 deletions

22
.github/actions/godot-cache/action.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: Setup Godot build cache
description: Setup Godot build cache.
inputs:
cache-name:
description: The cache base name (job name by default).
default: "${{github.job}}"
scons-cache:
description: The scons cache path.
default: "${{github.workspace}}/.scons-cache/"
runs:
using: "composite"
steps:
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
uses: actions/cache@v3
with:
path: ${{inputs.scons-cache}}
key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}

View File

@ -1,6 +1,14 @@
name: Continuous integration name: Continuous integration
on: [push, pull_request] on: [push, pull_request]
env:
# Only used for the cache key. Increment version to force clean build.
GODOT_BASE_BRANCH: master
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}
cancel-in-progress: true
jobs: jobs:
build: build:
name: ${{ matrix.name }} name: ${{ matrix.name }}
@ -14,6 +22,7 @@ jobs:
platform: linux platform: linux
artifact-name: godot-cpp-linux-glibc2.27-x86_64-release artifact-name: godot-cpp-linux-glibc2.27-x86_64-release
artifact-path: bin/libgodot-cpp.linux.release.x86_64.a artifact-path: bin/libgodot-cpp.linux.release.x86_64.a
cache-name: linux-x86_64
- name: 🐧 Linux (GCC, Double Precision) - name: 🐧 Linux (GCC, Double Precision)
os: ubuntu-18.04 os: ubuntu-18.04
@ -21,12 +30,14 @@ jobs:
artifact-name: godot-cpp-linux-glibc2.27-x86_64-double-release artifact-name: godot-cpp-linux-glibc2.27-x86_64-double-release
artifact-path: bin/libgodot-cpp.linux.release.x86_64.a artifact-path: bin/libgodot-cpp.linux.release.x86_64.a
flags: float=64 flags: float=64
cache-name: linux-x86_64-f64
- name: 🏁 Windows (x86_64, MSVC) - name: 🏁 Windows (x86_64, MSVC)
os: windows-2019 os: windows-2019
platform: windows platform: windows
artifact-name: godot-cpp-windows-msvc2019-x86_64-release artifact-name: godot-cpp-windows-msvc2019-x86_64-release
artifact-path: bin/libgodot-cpp.windows.release.x86_64.lib artifact-path: bin/libgodot-cpp.windows.release.x86_64.lib
cache-name: windows-x86_64-msvc
- name: 🏁 Windows (x86_64, MinGW) - name: 🏁 Windows (x86_64, MinGW)
os: windows-2019 os: windows-2019
@ -34,6 +45,7 @@ jobs:
artifact-name: godot-cpp-linux-mingw-x86_64-release artifact-name: godot-cpp-linux-mingw-x86_64-release
artifact-path: bin/libgodot-cpp.windows.release.x86_64.a artifact-path: bin/libgodot-cpp.windows.release.x86_64.a
flags: use_mingw=yes flags: use_mingw=yes
cache-name: windows-x86_64-mingw
- name: 🍎 macOS (universal) - name: 🍎 macOS (universal)
os: macos-11 os: macos-11
@ -41,6 +53,7 @@ jobs:
artifact-name: godot-cpp-macos-universal-release artifact-name: godot-cpp-macos-universal-release
artifact-path: bin/libgodot-cpp.macos.release.universal.a artifact-path: bin/libgodot-cpp.macos.release.universal.a
flags: arch=universal flags: arch=universal
cache-name: macos-universal
- name: 🤖 Android (arm64) - name: 🤖 Android (arm64)
os: ubuntu-18.04 os: ubuntu-18.04
@ -48,6 +61,7 @@ jobs:
artifact-name: godot-cpp-android-arm64-release artifact-name: godot-cpp-android-arm64-release
artifact-path: bin/libgodot-cpp.android.release.arm64.a artifact-path: bin/libgodot-cpp.android.release.arm64.a
flags: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME arch=arm64 flags: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME arch=arm64
cache-name: android-arm64
- name: 🍏 iOS (arm64) - name: 🍏 iOS (arm64)
os: macos-11 os: macos-11
@ -55,6 +69,10 @@ jobs:
artifact-name: godot-cpp-ios-arm64-release artifact-name: godot-cpp-ios-arm64-release
artifact-path: bin/libgodot-cpp.ios.release.arm64.a artifact-path: bin/libgodot-cpp.ios.release.arm64.a
flags: arch=arm64 flags: arch=arm64
cache-name: ios-arm64
env:
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
steps: steps:
- name: Checkout - name: Checkout
@ -62,6 +80,12 @@ jobs:
with: with:
submodules: recursive submodules: recursive
- name: Setup Godot build cache
uses: ./.github/actions/godot-cache
with:
cache-name: ${{ matrix.cache-name }}
continue-on-error: true
- name: Set up Python (for SCons) - name: Set up Python (for SCons)
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
@ -83,7 +107,7 @@ jobs:
- name: Build godot-cpp (debug) - name: Build godot-cpp (debug)
run: | run: |
scons platform=${{ matrix.platform }} target=debug generate_bindings=yes ${{ matrix.flags }} scons platform=${{ matrix.platform }} target=debug ${{ matrix.flags }}
- name: Build test without rebuilding godot-cpp (debug) - name: Build test without rebuilding godot-cpp (debug)
run: | run: |