Skip to content

Commit

Permalink
Update build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mphe committed Jul 14, 2024
1 parent 54e550a commit e297b8c
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 88 deletions.
152 changes: 64 additions & 88 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,117 +1,94 @@
# Adapted from https://github.com/nathanfranke/gdextension/blob/main/.github/workflows/build.yml
name: Builds
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
inputs:
git-ref:
description: A commit, branch or tag to build.
type: string
required: true
workflow_call:
inputs:
git-ref:
description: A commit, branch or tag to build.
type: string
required: true

jobs:
build:
runs-on: ${{ matrix.runner }}
name: ${{ matrix.name }}
name: ${{ matrix.platform }} ${{ matrix.target }} ${{ matrix.arch }} ${{ matrix.optimize }}
strategy:
fail-fast: false
matrix:
target: [ template_debug, template_release ]
identifier: [ windows, linux, macos, android, android_arm64 ]
# platform: [ windows, linux, macos, android ]

include:
# Linux
- identifier: linux-debug
name: Linux Debug
runner: ubuntu-20.04
target: template_debug
platform: linux
arch: x86_64

- identifier: linux-release
name: Linux Release
runner: ubuntu-20.04
target: template_release
platform: linux
arch: x86_64

# Windows
- identifier: windows-debug
name: Windows Debug
runner: ubuntu-20.04
target: template_debug
platform: windows
arch: x86_64

- identifier: windows-release
name: Windows Release
runner: ubuntu-20.04
target: template_release
platform: windows
arch: x86_64

# Android Arm64
- identifier: android-release
name: Android Release Arm64
runner: ubuntu-20.04
target: template_release
platform: android
arch: arm64
- runner: ubuntu-latest
- optimize: speed
- arch: x86_64

- identifier: android-debug
name: Android Debug Arm64
runner: ubuntu-20.04
target: template_debug
platform: android
arch: arm64
- target: template_debug
optimize: speed_trace

# Android x86_64
- identifier: android-release
name: Android Release x86_64
runner: ubuntu-20.04
target: template_release
platform: android
arch: x86_64

- identifier: android-debug
name: Android Debug x86_64
runner: ubuntu-20.04
target: template_debug
platform: android
arch: x86_64

# Mac
- identifier: macos-debug
name: macOS (universal) Debug
runner: macos-latest
target: template_debug
platform: macos
arch: universal
- identifier: windows
platform: windows

- identifier: macos-release
name: macOS (universal) Release
- identifier: macos
platform: macos
runner: macos-latest
target: template_release
platform: macos
arch: universal

- identifier: linux
platform: linux

- identifier: android
platform: android

- identifier: android_arm64
platform: android
arch: arm64

# - platform: android
# arch: arm64
#
# - platform: android
# arch: x86_64

# exclude:
# # Do not build these platforms for Arm64
# - platform: windows
# arch: arm64
# # - platform: macos
# # arch: arm64
# - platform: linux
# arch: arm64

steps:
- name: (Windows) Install mingw64
if: ${{ startsWith(matrix.identifier, 'windows-') }}
if: ${{ matrix.platform == 'windows' }}
shell: sh
run: |
sudo apt-get install mingw-w64
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
- name: (Android) Install JDK 17
if: ${{ startsWith(matrix.identifier, 'android-') }}
if: ${{ matrix.platform == 'android' }}
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin

- name: (Android) Install Android SDK
if: ${{ startsWith(matrix.identifier, 'android-') }}
if: ${{ matrix.platform == 'android' }}
uses: android-actions/setup-android@v3

# From Godot docs, might not be necessary.
#- name: (Android) Install Android Tools
# if: ${{ startsWith(matrix.identifier, 'android-') }}
# if: ${{ matrix.platform == 'android' }}
# shell: sh
# run: |
# "$ANDROID_SDK_ROOT"/cmdline-tools/latest/bin/sdkmanager --sdk_root="$ANDROID_SDK_ROOT" "platform-tools" "build-tools;30.0.3" "platforms;android-29" "cmdline-tools;latest" "cmake;3.10.2.4988404"
Expand All @@ -130,13 +107,14 @@ jobs:
shell: bash
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python -m pip install scons==4.7.0
scons --version
- name: Checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ inputs.git-ref }}

# TODO: Cache doesn't work yet. SCons rebuilds the objects even if they already exist. Could be caused by modification dates or extension_api.json.
# fetch-depth: 0 May be needed for cache. See: <https://github.com/actions/checkout/issues/468>.
Expand All @@ -147,11 +125,11 @@ jobs:
# ${{ github.workspace }}/.scons-cache/
# ${{ github.workspace }}/**/.sconsign.dblite
# ${{ github.workspace }}/godot-cpp/gen/
# key: ${{ matrix.identifier }}-${{ github.ref }}-${{ github.sha }}
# key: ${{ matrix.platform }}-${{ github.ref }}-${{ github.sha }}
# restore-keys: |
# ${{ matrix.identifier }}-${{ github.ref }}-${{ github.sha }}
# ${{ matrix.identifier }}-${{ github.ref }}
# ${{ matrix.identifier }}
# ${{ matrix.platform }}-${{ github.ref }}-${{ github.sha }}
# ${{ matrix.platform }}-${{ github.ref }}
# ${{ matrix.platform }}

- name: Compile extension
shell: sh
Expand All @@ -162,12 +140,10 @@ jobs:
scons target='${{ matrix.target }}' platform='${{ matrix.platform }}' arch='${{ matrix.arch }}' -j2
ls -l demo/addons/*/bin/
- name: Copy extra files to addon
- name: Prepare files for publish
shell: sh
run: |
for addon in ${{ github.workspace }}/demo/addons/*/; do
cp -n '${{ github.workspace }}/README.md' '${{ github.workspace }}/LICENSE' "$addon"
done
cp -n '${{ github.workspace }}/README.md' '${{ github.workspace }}/LICENSE' '${{ github.workspace }}/demo/addons/ropesim/'
- name: Upload artifact
uses: actions/upload-artifact@v2
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: CI
on:
push:
# branches: [ master ]
pull_request:
# branches: [ master ]

jobs:
ci:
name: "CI"
uses: ./.github/workflows/build.yml
with:
git-ref: ${{ github.ref }}

0 comments on commit e297b8c

Please sign in to comment.