Skip to content

Commit d24c999

Browse files
authored
New build system (#101)
1 parent dd736fa commit d24c999

File tree

140 files changed

+1102
-2537
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+1102
-2537
lines changed

.cargo/config.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# make the default target the lib target
2-
[alias]
3-
b = "post build"
42
[target.armv7-unknown-linux-gnueabihf]
53
linker = "arm-linux-gnueabihf-gcc"
64
[target.aarch64-unknown-linux-gnu]

.github/actions/build-plugin/action.yml

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,11 @@ inputs:
66
required: true
77
default: ''
88
description: Rust target platform.
9-
extra_flags:
10-
required: false
11-
default: ''
12-
description: Rust extra flags.
13-
features:
14-
required: false
15-
default: ''
16-
description: simd-nightly,simd-stable,parallel,enhanced-determinism
179

1810
runs:
1911
using: composite
2012
steps:
13+
- uses: extractions/setup-just@v3
2114
- name: Update Rust
2215
shell: sh
2316
run: |
@@ -26,33 +19,28 @@ runs:
2619
shell: sh
2720
run: |
2821
rustc --print=target-list
29-
- name: Rust Add target
22+
- name: Add additional arm64 target for macOS
3023
shell: sh
24+
if: ${{ inputs.arch == 'x86_64-apple-darwin'}}
3125
run: |
32-
rustup target add ${{ inputs.arch }}
33-
#--features="${{ inputs.features }}" --no-default-features
34-
- name: Build
26+
rustup target add aarch64-apple-darwin
27+
- name: Rust add current target
3528
shell: sh
3629
run: |
37-
cargo build --target=${{ inputs.arch }} --release ${{ inputs.extra_flags}}
38-
- name: Copy to release
30+
rustup target add ${{ inputs.arch }}
31+
- name: Build for Windows and Linux
3932
shell: sh
33+
if: ${{ inputs.arch != 'x86_64-apple-darwin'}}
4034
run: |
41-
mkdir -p target/release
42-
rm -rf target/release
43-
cp -rf target/${{ inputs.arch }}/release target/release
44-
- name: Build Rapier Macos Universal
35+
just build-patchwork release ${{ inputs.arch }}
36+
- name: Build for Mac
4537
shell: sh
46-
# we already built for x86_64-apple-darwin for mac, now build arm64
4738
if: ${{ inputs.arch == 'x86_64-apple-darwin'}}
4839
run: |
49-
mkdir -p target/release
50-
rustup target add aarch64-apple-darwin
51-
cargo build --target=aarch64-apple-darwin --release
52-
lipo -create -output target/release/libpatchwork_rust_core.dylib target/aarch64-apple-darwin/release/libpatchwork_rust_core.dylib target/x86_64-apple-darwin/release/libpatchwork_rust_core.dylib
53-
- name: Move Static Libs macOS
40+
just build-patchwork release "all-apple-darwin"
41+
- name: Copy to release
5442
shell: sh
55-
if: ${{ inputs.arch == 'x86_64-apple-darwin'}}
5643
run: |
57-
mv target/x86_64-apple-darwin/release/libpatchwork_rust_core.a target/release/libpatchwork_rust_core.x86_64.a
58-
mv target/aarch64-apple-darwin/release/libpatchwork_rust_core.a target/release/libpatchwork_rust_core.arm64.a
44+
mkdir -p target/release
45+
rm -rf target/release
46+
cp -rf target/${{ inputs.arch }}/release target/release
Lines changed: 33 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,33 @@
1-
name: Build Editor All Platforms
1+
name: 🤖 Build Godot for All Platforms
22
on:
33
workflow_call:
44

55
# Global Settings
66
# SCONS_CACHE for windows must be set in the build environment
77
env:
8-
GODOT_REPOSITORY: godotengine/godot
9-
GODOT_BASE_BRANCH: master
10-
# Change Developers.md too
11-
GODOT_MAIN_SYNC_REF: bb92a4c8e27e30cdec05ab6d540d724b9b3cfb72
128
SCONSFLAGS: verbose=yes warnings=all werror=no module_text_server_fb_enabled=yes minizip=yes deprecated=yes module_patchwork_editor_enabled=yes
13-
SCONSFLAGS_TEMPLATE: no_editor_splash=yes module_camera_enabled=no module_mobile_vr_enabled=no module_upnp_enabled=no module_websocket_enabled=no module_csg_enabled=yes module_gridmap_enabled=yes use_static_cpp=yes builtin_freetype=yes builtin_libpng=yes builtin_zlib=yes builtin_libwebp=yes builtin_libvorbis=yes builtin_libogg=yes disable_3d=no
14-
SCONS_CACHE_MSVC_CONFIG: true
159

1610
concurrency:
1711
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}
1812
cancel-in-progress: true
1913

2014
jobs:
2115
build:
22-
# Windows 10 with latest image
2316
runs-on: ${{ matrix.os }}
2417
name: ${{ matrix.name }}
2518
strategy:
2619
fail-fast: false
2720
matrix:
2821
include:
29-
- name: "Windows Editor"
22+
- name: "🪟 Build Godot for Windows"
3023
os: "windows-latest"
3124
id: windows-editor
3225
platform: windows
3326
target: editor
3427
sconsflags: tests=yes debug_symbols=yes
3528
bin: ./bin/godot.windows.editor.x86_64.exe
3629

37-
- name: "🐧 Linux Editor"
30+
- name: "🐧 Build Godot for Linux"
3831
os: "ubuntu-22.04"
3932
id: linux-editor
4033
platform: linux
@@ -43,7 +36,7 @@ jobs:
4336
sconsflags-template: optimize=size use_lto=yes debug_symbols=no
4437
bin: ./bin/godot.linuxbsd.editor.x86_64
4538

46-
- name: "🍎 macOS Editor"
39+
- name: "🍎 Build Godot for macOS"
4740
os: "macos-14"
4841
id: macos-editor
4942
platform: macos
@@ -52,22 +45,38 @@ jobs:
5245
bin: ./bin/godot.macos.editor.arm64
5346

5447
steps:
55-
- name: checkout-godot
48+
# Checkout patchwork to tmp/
49+
- name: Checkout patchwork-godot-plugin
5650
uses: actions/checkout@v4
5751
with:
58-
repository: ${{env.GODOT_REPOSITORY}}
59-
ref: ${{env.GODOT_MAIN_SYNC_REF}}
52+
fetch-depth: 0
53+
path: tmp/patchwork-tmp
54+
55+
# We must move patchwork to a higher directory than our CWD,
56+
# because if we don't, cloning godot will overwrite patchwork.
57+
# (And Godot's actions expect Godot to be our CWD.)
58+
- name: Move to higher directory
59+
shell: sh
60+
run: mv tmp/patchwork-tmp ../patchwork-tmp
6061

61-
- name: checkout-patchwork_editor
62+
# Grab the environment variables from build.env and output them
63+
- name: Fetch env variables
64+
id: dotenv
65+
uses: falti/[email protected]
66+
with:
67+
path: ../patchwork-tmp/build.env
68+
keys-case: bypass
69+
70+
- name: Checkout Godot
6271
uses: actions/checkout@v4
6372
with:
64-
path: modules/patchwork_editor
65-
fetch-depth: 0
73+
repository: ${{ steps.dotenv.outputs.GODOT_REPO }}
74+
ref: ${{ steps.dotenv.outputs.GODOT_REF }}
6675

67-
- name: copy actions
76+
- name: Copy editor directory
6877
shell: bash
6978
run: |
70-
cp -R modules/patchwork_editor/.github/actions/* .github/actions/
79+
cp -R ../patchwork-tmp/editor modules/patchwork_editor
7180
7281
- name: Select Xcode 16
7382
if: matrix.platform == 'macos'
@@ -138,7 +147,7 @@ jobs:
138147
- name: Prepare artifact
139148
# Stripping the debug symbols screws up lipo'd binaries on macos, so don't do it
140149
if: matrix.platform != 'macos'
141-
uses: ./.github/actions/godot-prepare-artifact
150+
uses: ./../patchwork-tmp/.github/actions/godot-prepare-artifact
142151

143152
- name: Save Godot build cache
144153
# if: success() || (steps.restore-cache.outputs.cache-hit == 'false' && (steps.compile-editor.outcome != 'skipped' || steps.compile-template.outcome != 'skipped'))
@@ -152,11 +161,11 @@ jobs:
152161
if: matrix.platform == 'macos' && matrix.target == 'editor'
153162
shell: bash
154163
run: |
155-
chmod +x ${{ github.workspace }}/bin/godot_macos_editor.app/Contents/MacOS/Godot
164+
chmod +x bin/godot_macos_editor.app/Contents/MacOS/Godot
156165
157166
- name: Mac Sign
158167
if: matrix.platform == 'macos' && matrix.target == 'editor'
159-
uses: ./.github/actions/macos-sign
168+
uses: ./../patchwork-tmp/.github/actions/macos-sign
160169
with:
161170
FRAMEWORK_PATH: ${{ github.workspace }}/bin/godot_macos_editor.app
162171
SIGN_FLAGS: "--deep --force --options=runtime --entitlements ${{ github.workspace }}/misc/dist/macos/editor.entitlements"
@@ -171,106 +180,6 @@ jobs:
171180
- uses: actions/upload-artifact@v4
172181
if: matrix.id != 'linux-sanitizers'
173182
with:
174-
name: patchwork_editor-${{ matrix.platform }}
175-
path: ${{github.workspace}}/bin/*
183+
name: godot-with-patchwork-${{ matrix.platform }}
184+
path: ${{ github.workspace }}/bin/*
176185
retention-days: 90
177-
178-
# test:
179-
# needs: build
180-
# runs-on: ${{ matrix.os }}
181-
# name: ${{ matrix.name }} test
182-
# strategy:
183-
# fail-fast: false
184-
# matrix:
185-
# include:
186-
# - name: "Windows"
187-
# os: "windows-latest"
188-
# platform: windows
189-
# bin: ./bin/godot.windows.editor.x86_64.exe
190-
191-
# - name: "🐧 Linux"
192-
# os: "ubuntu-24.04"
193-
# platform: linux
194-
# bin: ./bin/godot.linuxbsd.editor.x86_64
195-
196-
# - name: "🍎 macOS"
197-
# os: "macos-14"
198-
# platform: macos
199-
# bin: ./bin/godot.macos.editor.arm64
200-
201-
# steps:
202-
# - name: checkout-godot
203-
# uses: actions/checkout@v4
204-
# with:
205-
# repository: GODOT_REPOSITORY
206-
# ref: ${{env.GODOT_MAIN_SYNC_REF}}
207-
208-
# - name: checkout-patchwork_editor
209-
# uses: actions/checkout@v4
210-
# with:
211-
# path: modules/patchwork_editor
212-
# fetch-depth: 0
213-
214-
# - name: copy actions
215-
# shell: bash
216-
# run: |
217-
# cp -R modules/patchwork_editor/.github/actions/* .github/actions/
218-
219-
# - name: Download patchwork_editor artifacts
220-
# uses: actions/download-artifact@v4
221-
# with:
222-
# name: patchwork_editor-editor-${{ matrix.platform }}
223-
# path: bin
224-
225-
# - name: set permissions
226-
# shell: bash
227-
# run: |
228-
# chmod a+x bin/godot*
229-
230-
# - name: run tests
231-
# shell: bash
232-
# run: |
233-
# ${{matrix.bin}} --headless --test --force-colors "--test-case=[patchwork_editor]*"
234-
235-
release:
236-
if: startsWith(github.ref, 'refs/tags/')
237-
runs-on: "ubuntu-latest"
238-
permissions:
239-
contents: write
240-
needs: [build]
241-
steps:
242-
- name: Download Linux artifact
243-
uses: actions/download-artifact@v4
244-
with:
245-
name: patchwork_editor-linux
246-
path: artifacts/linux
247-
- name: Download MacOS artifact
248-
uses: actions/download-artifact@v4
249-
with:
250-
name: patchwork_editor-macos
251-
path: artifacts/macos
252-
- name: Download Windows artifact
253-
uses: actions/download-artifact@v4
254-
with:
255-
name: patchwork_editor-windows
256-
path: artifacts/windows
257-
- name: Zip artifacts
258-
run: |
259-
ls -la artifacts/*
260-
cd artifacts/windows
261-
zip -r9 "../patchwork_editor-${{ github.ref_name }}-windows.zip" *
262-
cd ../..
263-
cd artifacts/macos
264-
chmod a+x godot_macos_editor.app/Contents/MacOS/Godot
265-
zip -r9 "../patchwork_editor-${{ github.ref_name }}-macos.zip" *
266-
cd ../..
267-
cd artifacts/linux
268-
chmod a+x *
269-
zip -r9 "../patchwork_editor-${{ github.ref_name }}-linux.zip" *
270-
- name: Release
271-
uses: nikitalita/[email protected]
272-
with:
273-
files: |
274-
artifacts/patchwork_editor-${{ github.ref_name }}-windows.zip
275-
artifacts/patchwork_editor-${{ github.ref_name }}-macos.zip
276-
artifacts/patchwork_editor-${{ github.ref_name }}-linux.zip
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: 🧵 Compose Projects
2+
on:
3+
workflow_call:
4+
5+
jobs:
6+
# Grab the environment variables from build.env and output them
7+
load-env:
8+
name: 🔍 Load Environment variables
9+
runs-on: "ubuntu-latest"
10+
outputs:
11+
THREADBARE_REPO: ${{ steps.dotenv.outputs.THREADBARE_REPO }}
12+
THREADBARE_REF: ${{ steps.dotenv.outputs.THREADBARE_REF }}
13+
MODDABLE_PLATFORMER_REPO: ${{ steps.dotenv.outputs.MODDABLE_PLATFORMER_REPO }}
14+
MODDABLE_PLATFORMER_REF: ${{ steps.dotenv.outputs.MODDABLE_PLATFORMER_REF }}
15+
steps:
16+
- uses: actions/checkout@v4
17+
- id: dotenv
18+
uses: falti/[email protected]
19+
with:
20+
path: build.env
21+
keys-case: bypass
22+
23+
compose-projects:
24+
needs: [load-env]
25+
runs-on: "ubuntu-latest"
26+
name: 🪡 Compose ${{ matrix.project.name }}
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
project:
31+
- name: threadbare
32+
repo: ${{ needs.load-env.outputs.THREADBARE_REPO }}
33+
ref: ${{ needs.load-env.outputs.THREADBARE_REF }}
34+
- name: moddable-platformer
35+
repo: ${{ needs.load-env.outputs.MODDABLE_PLATFORMER_REPO }}
36+
ref: ${{ needs.load-env.outputs.MODDABLE_PLATFORMER_REF }}
37+
steps:
38+
- name: Checkout project
39+
uses: actions/checkout@v4
40+
with:
41+
repository: ${{ matrix.project.repo }}
42+
ref: ${{ matrix.project.ref }}
43+
path: ${{ matrix.project.name }}
44+
fetch-depth: 0
45+
persist-credentials: false
46+
- name: Download Patchwork
47+
uses: actions/download-artifact@v7
48+
with:
49+
pattern: patchwork-godot-plugin
50+
path: patchwork-godot-plugin
51+
- name: Copy to addons
52+
shell: sh
53+
run: |
54+
mkdir -p ${{ matrix.project.name }}/addons/patchwork
55+
cp -r patchwork-godot-plugin/* ${{ matrix.project.name }}/addons/patchwork
56+
- name: Upload
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: ${{ matrix.project.name }}-with-patchwork
60+
path: |
61+
${{ matrix.project.name }}
62+
if-no-files-found: error
63+

0 commit comments

Comments
 (0)