Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite build scripts. Add web build #512

Merged
merged 1 commit into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 36 additions & 15 deletions .github/actions/base-deps/action.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,48 @@
name: Setup Base Dependencies
description: Setup python and scons
description: Setup base dependencies
inputs:
python-version:
description: The python version to use.
default: "3.x"
python-arch:
description: The python architecture.
default: "x64"
platform:
required: true
description: Target platform.
runs:
using: "composite"
steps:
# Use python 3.x release (works cross platform)
- name: Setup python 3.x
- name: Setup Python 3.x
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: ${{ inputs.python-version }}
# Optional - x64 or x86 architecture, defaults to x64
architecture: ${{ inputs.python-arch }}
python-version: 3.x

- name: Setup scons 4.4
- name: Setup SCons 4.4
shell: bash
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons==4.4.0
scons --version
scons --version

- name: Setup Android Dependencies
if: inputs.platform == 'android'
uses: nttld/setup-ndk@v1
with:
ndk-version: r23c
link-to-sdk: true

- name: Setup Windows Dependencies
if: inputs.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: Setup Web Dependencies
if: inputs.platform == 'web'
uses: mymindstorm/setup-emsdk@v14
with:
version: 3.1.64
no-cache: true

- name: Verify Emscripten setup
if: inputs.platform == 'web'
shell: bash
run: |
emcc -v
12 changes: 0 additions & 12 deletions .github/actions/windows-deps/action.yml

This file was deleted.

10 changes: 3 additions & 7 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [ workflow_call, workflow_dispatch ]
jobs:
build:
name: 🤖 Android ${{ matrix.arch }} ${{ matrix.target }}
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
Expand All @@ -18,14 +18,10 @@ jobs:
with:
submodules: recursive

- name: Setup Android Dependencies
uses: nttld/setup-ndk@v1
with:
ndk-version: r23c
link-to-sdk: true

- name: Setup Base Dependencies
uses: ./.github/actions/base-deps
with:
platform: ${{ matrix.platform }}

- name: Setup Build Cache
uses: ./.github/actions/build-cache
Expand Down
54 changes: 26 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Modeled off of godot-cpp https://github.com/godotengine/godot-cpp/blob/master/.github/workflows/ci.yml

name: 🛠️ Build All
on:
push:
Expand All @@ -17,64 +19,61 @@ jobs:
strategy:
fail-fast: false
matrix:
identifier: [linux, windows, macos, ios, android-arm32, android-arm64]
identifier: [linux, windows, macos, ios, android-arm32, android-arm64, web-nothreads]
target: [debug, release]
include:
- identifier: linux
platform: linux
name: 🐧 Linux
runner: ubuntu-20.04
arch: x86_64
runner: ubuntu-22.04
flags: arch=x86_64

- identifier: windows
platform: windows
name: 🪟 Windows
runner: ubuntu-20.04
arch: x86_64
runner: ubuntu-22.04
flags: arch=x86_64

- identifier: macos
platform: macos
name: 🍎 macOS
runner: macos-latest
arch: universal
flags: arch=universal

- identifier: ios
platform: ios
name: 🍏 iOS
runner: macos-latest
arch: universal
flags: arch=universal

- identifier: android-arm32
platform: android
name: 🤖 Android Arm32
runner: ubuntu-22.04
flags: arch=arm32

- identifier: android-arm64
platform: android
name: 🤖 Android Arm64
runner: ubuntu-20.04
arch: arm64
runner: ubuntu-22.04
flags: arch=arm64

- identifier: android-arm32
platform: android
name: 🤖 Android Arm32
runner: ubuntu-20.04
arch: arm32
- identifier: web-nothreads
platform: web
name: 🌐 Web No-threads
runner: ubuntu-22.04
flags: threads=no

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

- name: Setup Windows Dependencies
if: ${{ matrix.platform == 'windows' }}
uses: ./.github/actions/windows-deps

- name: Setup Android Dependencies
if: ${{ matrix.platform == 'android' }}
uses: nttld/setup-ndk@v1
with:
ndk-version: r23c
link-to-sdk: true

- name: Setup Base Dependencies
uses: ./.github/actions/base-deps
with:
platform: ${{ matrix.platform }}

- name: Setup Build Cache
uses: ./.github/actions/build-cache
Expand All @@ -86,10 +85,9 @@ jobs:
env:
SCONS_CACHE: "${{ github.workspace }}/.scons-cache/"
TARGET: 'template_${{ matrix.target }}'
ARCH: '${{ matrix.arch }}'
shell: sh
run: |
scons target=$TARGET platform='${{ matrix.platform }}' arch=$ARCH debug_symbols=no -j2
scons target=$TARGET platform='${{ matrix.platform }}' ${{ matrix.flags }} debug_symbols=no -j2

- name: Strip Libraries (Windows/Linux)
if: ${{ matrix.platform == 'windows' || matrix.platform == 'linux' }}
Expand All @@ -108,7 +106,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: t3d-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.target }}
name: t3d-${{ matrix.identifier }}-${{ matrix.target }}
path: |
${{ github.workspace }}/project/

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:

- name: Setup Base Dependencies
uses: ./.github/actions/base-deps
with:
platform: ${{ matrix.platform }}

- name: Setup Build Cache
uses: ./.github/actions/build-cache
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [ workflow_call, workflow_dispatch ]
jobs:
build:
name: 🐧 Linux ${{ matrix.arch }} ${{ matrix.target }}
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
Expand All @@ -20,6 +20,8 @@ jobs:

- name: Setup Base Dependencies
uses: ./.github/actions/base-deps
with:
platform: ${{ matrix.platform }}

- name: Setup Build Cache
uses: ./.github/actions/build-cache
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:

- name: Setup Base Dependencies
uses: ./.github/actions/base-deps
with:
platform: ${{ matrix.platform }}

- name: Setup Build Cache
uses: ./.github/actions/build-cache
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: 🌐 Web Builds
on: [ workflow_call, workflow_dispatch ]

jobs:
build:
name: 🌐 Web ${{ matrix.arch }} ${{ matrix.target }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
platform: [web]
target: [debug, release]
#threads: [yes, no]

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

- name: Setup Base Dependencies
uses: ./.github/actions/base-deps
with:
platform: ${{ matrix.platform }}

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

- name: Build Terrain3D
env:
SCONS_CACHE: "${{ github.workspace }}/.scons-cache/"
TARGET: 'template_${{ matrix.target }}'
shell: sh
run: |
scons target=$TARGET platform='${{ matrix.platform }}' threads=no debug_symbols=no -j2

- name: Prepare Files
shell: sh
run: |
ls -l project/addons/terrain_3d/bin/
cp '${{ github.workspace }}/README.md' '${{ github.workspace }}/LICENSE.txt' ${{ github.workspace }}/project/addons/terrain_3d/

- name: Upload Package
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: t3d-${{ matrix.platform }}-nothreads-${{ matrix.target }}
path: |
${{ github.workspace }}/project/

merge:
runs-on: ubuntu-latest
needs: build
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
include-hidden-files: true
name: ${{ github.event.repository.name }}
pattern: t3d-*
delete-merged: true
7 changes: 3 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [ workflow_call, workflow_dispatch ]
jobs:
build:
name: 🪟 Windows ${{ matrix.arch }} ${{ matrix.target }}
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
Expand All @@ -18,11 +18,10 @@ jobs:
with:
submodules: recursive

- name: Setup Windows Dependencies
uses: ./.github/actions/windows-deps

- name: Setup Base Dependencies
uses: ./.github/actions/base-deps
with:
platform: ${{ matrix.platform }}

- name: Setup Build Cache
uses: ./.github/actions/build-cache
Expand Down
2 changes: 1 addition & 1 deletion Terrain3D.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@
<ItemGroup>
<None Include=".github\actions\base-deps\action.yml" />
<None Include=".github\actions\build-cache\action.yml" />
<None Include=".github\actions\windows-deps\action.yml" />
<None Include=".github\ISSUE_TEMPLATE\bug_report.yml" />
<None Include=".github\ISSUE_TEMPLATE\config.yml" />
<None Include=".github\ISSUE_TEMPLATE\feature_request.yml" />
Expand All @@ -183,6 +182,7 @@
<None Include=".github\workflows\ios.yml" />
<None Include=".github\workflows\linux.yml" />
<None Include=".github\workflows\macos.yml" />
<None Include=".github\workflows\web.yml" />
<None Include=".github\workflows\windows.yml" />
<None Include=".gitignore" />
<None Include="AUTHORS.md" />
Expand Down
6 changes: 3 additions & 3 deletions Terrain3D.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include=".github\actions\windows-deps\action.yml">
<Filter>1. Project Files</Filter>
</None>
<None Include=".github\actions\build-cache\action.yml">
<Filter>1. Project Files</Filter>
</None>
Expand Down Expand Up @@ -235,6 +232,9 @@
<None Include="doc\docs\introduction.md">
<Filter>2. Docs</Filter>
</None>
<None Include=".github\workflows\web.yml">
<Filter>1. Project Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Text Include=".readthedocs.yaml">
Expand Down
Loading
Loading