Skip to content

Commit

Permalink
Update build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
TokisanGames committed Aug 31, 2023
1 parent 8d71a43 commit 8b6842d
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 85 deletions.
4 changes: 2 additions & 2 deletions .github/actions/base-deps/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Setup python and scons
description: Setup python, install the pip version of scons.
name: Setup Base Dependencies
description: Setup python and scons
inputs:
python-version:
description: The python version to use.
Expand Down
18 changes: 9 additions & 9 deletions .github/actions/build-cache/action.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
name: Setup build cache
name: Setup Build Cache
description: Setup build cache.
inputs:
cache-name:
description: The cache base name (job name by default).
default: "${{github.job}}"
default: "${{ github.job }}"
scons-cache:
description: The scons cache path.
default: "${{github.workspace}}/.scons-cache/"
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}}-main-${{github.ref}}-${{github.sha}}
path: ${{ inputs.scons-cache }}
key: ${{ inputs.cache-name }}-main-${{ github.ref }}-${{ github.sha }}

# We try to match an existing cache to restore from it. Each potential key is checked against
# all existing caches as a prefix. E.g. 'linux-template-minimal' would match any cache that
Expand All @@ -29,7 +29,7 @@ runs:
# 4. A partial match for the same base branch only (not ideal, matches any PR with the same base branch).

restore-keys: |
${{inputs.cache-name}}-main-${{github.ref}}-${{github.sha}}
${{inputs.cache-name}}-main-${{github.ref}}
${{inputs.cache-name}}-main-refs/heads/main
${{inputs.cache-name}}-main
${{ inputs.cache-name }}-main-${{ github.ref }}-${{ github.sha }}
${{ inputs.cache-name }}-main-${{ github.ref }}
${{ inputs.cache-name }}-main-refs/heads/main
${{ inputs.cache-name }}-main
12 changes: 12 additions & 0 deletions .github/actions/windows-deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Setup Windows Dependencies
description: Setup mingw-64
runs:
using: "composite"
steps:
- name: (Windows) Install mingw64
if: startsWith(matrix.identifier, '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
28 changes: 15 additions & 13 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,59 @@
name: 🤖 Android Builds
on: [ workflow_call, workflow_dispatch ]

env:
SCONSFLAGS: verbose=yes

jobs:
build:
runs-on: ${{ matrix.runner }}
name: ${{ matrix.name }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- identifier: android-debug
name: Android Debug
runner: ubuntu-20.04
target: template_debug
platform: android
arch: arm64
- identifier: android-release
name: Android Release
runner: ubuntu-20.04
target: template_release
platform: android
arch: arm64

steps:
- name: Checkout project
- name: Checkout Terrain3D
uses: actions/checkout@v3
with:
submodules: recursive

- name: (Android) Set up Android dependencies
- name: Setup Android Dependencies
uses: ./.github/actions/android-deps

- name: Setup python & scons
- name: Setup Base Dependencies
uses: ./.github/actions/base-deps

- name: Compile extension
- name: Setup Build Cache
uses: ./.github/actions/build-cache
with:
cache-name: ${{ matrix.identifier }}
continue-on-error: true

- name: Build Terrain3D
shell: sh
env:
SCONSFLAGS: verbose=yes
SCONS_CACHE: "${{ github.workspace }}/.scons-cache/"
SCONS_CACHE_LIMIT: 7168
run: |
scons target='${{ matrix.target }}' platform='${{ matrix.platform }}' arch='${{ matrix.arch }}' ${{ env.SCONSFLAGS }} -j2
scons target='${{ matrix.target }}' platform='${{ matrix.platform }}' arch='${{ matrix.arch }}' debug_symbols=no -j2
- name: Prepare artifact
- name: Include Files
shell: sh
run: |
ls -l project/addons/terrain_3d/bin/
cp '${{ github.workspace }}/README.md' '${{ github.workspace }}/LICENSE' ${{ github.workspace }}/project/addons/terrain_3d/
- name: Upload artifact
- name: Upload Package
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
name: 🛠️ Build All
on: workflow_dispatch

env:
SCONSFLAGS: verbose=yes

jobs:
build:
runs-on: ${{ matrix.runner }}
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -60,48 +57,51 @@ jobs:
arch: arm64

steps:
- name: Checkout project
- name: Checkout Terrain3D
uses: actions/checkout@v3
with:
submodules: recursive

- name: (Windows) Install mingw64
- name: Setup Windows Dependencies
if: startsWith(matrix.identifier, '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
uses: ./.github/actions/windows-deps

- name: (Android) Set up Android dependencies
- name: Setup Android Dependencies
if: startsWith(matrix.identifier, 'android-')
uses: ./.github/actions/android-deps

- name: Setup python & scons
- name: Setup Base Dependencies
uses: ./.github/actions/base-deps

- name: Compile extension
- name: Setup Build Cache
uses: ./.github/actions/build-cache
with:
cache-name: ${{ matrix.identifier }}
continue-on-error: true

- name: Build Terrain3D
shell: sh
env:
SCONSFLAGS: verbose=yes
SCONS_CACHE: "${{ github.workspace }}/.scons-cache/"
SCONS_CACHE_LIMIT: 7168
run: |
scons target='${{ matrix.target }}' platform='${{ matrix.platform }}' arch='${{ matrix.arch }}' ${{ env.SCONSFLAGS }} -j2
scons target='${{ matrix.target }}' platform='${{ matrix.platform }}' arch='${{ matrix.arch }}' debug_symbols=no -j2
- name: Strip libraries
- name: Strip Libraries (Windows/Linux)
if: startsWith(matrix.identifier, 'windows-') || startsWith(matrix.identifier, 'linux-')
shell: sh
run: |
ls -l project/addons/terrain_3d/bin/
strip project/addons/terrain_3d/bin/libterrain.*
ls -l project/addons/terrain_3d/bin/
- name: Prepare artifact
- name: Include Files
shell: sh
run: |
cp '${{ github.workspace }}/README.md' '${{ github.workspace }}/LICENSE' ${{ github.workspace }}/project/addons/terrain_3d/
- name: Upload artifact
- name: Upload Package
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
name: 🐧 Linux Builds
on: [ workflow_call, workflow_dispatch ]

env:
SCONSFLAGS: verbose=yes

jobs:
build-linux:
runs-on: "ubuntu-20.04"
name: ${{ matrix.name }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
Expand All @@ -24,37 +21,38 @@ jobs:
arch: x86_64

steps:
- name: Checkout project
- name: Checkout Terrain3D
uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup python & scons
- name: Setup Base Dependencies
uses: ./.github/actions/base-deps

- name: Setup build cache
- name: Setup Build Cache
uses: ./.github/actions/build-cache
with:
cache-name: ${{ matrix.identifier }}
continue-on-error: true

- name: Compile extension
- name: Build Terrain3D
shell: sh
env:
SCONSFLAGS: verbose=yes
SCONS_CACHE: "${{ github.workspace }}/.scons-cache/"
SCONS_CACHE_LIMIT: 7168
run: |
scons target='${{ matrix.target }}' platform='${{ matrix.platform }}' arch='${{ matrix.arch }}' ${{ env.SCONSFLAGS }} -j2
scons target='${{ matrix.target }}' platform='${{ matrix.platform }}' arch='${{ matrix.arch }}' debug_symbols=no -j2
- name: Prepare artifact
- name: Prepare Files
shell: sh
run: |
ls -l project/addons/terrain_3d/bin/
strip project/addons/terrain_3d/bin/libterrain.*
ls -l project/addons/terrain_3d/bin/
cp '${{ github.workspace }}/README.md' '${{ github.workspace }}/LICENSE' ${{ github.workspace }}/project/addons/terrain_3d/
- name: Upload artifact
- name: Upload Package
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}
Expand Down
30 changes: 18 additions & 12 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,54 @@
name: 🍎 macOS Builds
on: [ workflow_call, workflow_dispatch ]

env:
SCONSFLAGS: verbose=yes

jobs:
build-macos:
runs-on: "macos-latest"
name: ${{ matrix.name }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
include:
- name: macOS Debug
- identifier: macos-debug
name: macOS Debug
target: template_debug
platform: macos
- name: macOS Release
- identifier: macos-release
name: macOS Release
target: template_release
platform: macos

steps:
- name: Checkout project
- name: Checkout Terrain3D
uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup python & scons
- name: Setup Base Dependencies
uses: ./.github/actions/base-deps

- name: Compile extension
- name: Setup Build Cache
uses: ./.github/actions/build-cache
with:
cache-name: ${{ matrix.identifier }}
continue-on-error: true

- name: Build Terrain3D
shell: sh
env:
SCONSFLAGS: verbose=yes
SCONS_CACHE: "${{ github.workspace }}/.scons-cache/"
SCONS_CACHE_LIMIT: 7168
run: |
scons target='${{ matrix.target }}' platform='${{ matrix.platform }}' arch='${{ matrix.arch }}' ${{ env.SCONSFLAGS }} -j2
scons target='${{ matrix.target }}' platform='${{ matrix.platform }}' arch='${{ matrix.arch }}' debug_symbols=no -j2
- name: Prepare artifact
- name: Include Files
shell: sh
run: |
ls -l project/addons/terrain_3d/bin/*/
cp '${{ github.workspace }}/README.md' '${{ github.workspace }}/LICENSE' ${{ github.workspace }}/project/addons/terrain_3d/
- name: Upload artifact
- name: Upload Package
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}
Expand Down
Loading

0 comments on commit 8b6842d

Please sign in to comment.