Skip to content

Commit

Permalink
CI: Add initial GitHub Actions setup for main platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
YuriSizov committed Apr 11, 2024
1 parent 4e37682 commit ff2d686
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ trim_trailing_whitespace = true
[{*.py,SConstruct,SCsub}]
indent_style = space
indent_size = 4

[*.yml]
indent_style = space
indent_size = 2
25 changes: 25 additions & 0 deletions .github/actions/build-extension/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build GDSiON extension
description: Build the exntesion with provided options.

inputs:
target:
description: The build configuration target (template_release, template_debug).
default: "template_release"
sconsflags:
default: ""

runs:
using: "composite"
steps:
- name: Build with scons
shell: sh
env:
SCONSFLAGS: ${{ inputs.sconsflags }}
run: |
echo "Building with flags:" platform=${{ env.SCONS_PLATFORM }} target=${{ inputs.target }} ${{ env.SCONSFLAGS }}
scons platform=${{ env.SCONS_PLATFORM }} target=${{ inputs.target }} ${{ env.SCONSFLAGS }}
echo "Build results:"
ls -l bin/
echo "Example project build results:"
ls -l example/bin/
29 changes: 29 additions & 0 deletions .github/actions/install-deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Install build dependencies
description: Set up python, install the pip version of scons.

runs:
using: "composite"
steps:
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: "3.x"

- name: Install scons
shell: bash
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons==4.4.0
scons --version
- name: Install Emscripten (Web)
if: ${{ env.SCONS_PLATFORM == 'web' }}
uses: mymindstorm/setup-emsdk@v14
with:
version: 3.1.39

- name: Verify Emscripten (Web)
if: ${{ env.SCONS_PLATFORM == 'web' }}
run: |
emcc -v
30 changes: 30 additions & 0 deletions .github/actions/upload-extension/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Upload GDSiON release
description: Strip and upload the build artifacts.

runs:
using: "composite"
steps:
- name: Prepare the binaries (Linux)
if: ${{ env.SCONS_PLATFORM == 'linux' }}
run: |
strip bin/libgdsion.linux.*
chmod +x bin/libgdsion.linux.*
- name: Prepare the binaries (macOS)
if: ${{ env.SCONS_PLATFORM == 'macos' }}
run: |
strip bin/libgdsion.macos.*
chmod +x bin/libgdsion.macos.*
- name: Prepare the binaries (Windows)
if: ${{ env.SCONS_PLATFORM == 'windows' }}
run: |
Remove-Item bin/* -Include *.exp,*.lib,*.pdb -Force
- name: Upload the binaries
uses: actions/upload-artifact@v4
with:
name: libgdsion-${{ env.SCONS_PLATFORM }}
path: "bin/*"
retention-days: 14

98 changes: 98 additions & 0 deletions .github/workflows/build-unstable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Built Unstable (main branch)

on:
push:
branches:
- 'main'

# Make sure jobs cannot overlap.
concurrency:
group: build-unstable-main
cancel-in-progress: true

jobs:
build-linux:
name: Compile and publish Linux version
runs-on: ubuntu-latest
env:
SCONS_PLATFORM: linux

steps:
- uses: actions/checkout@v4

- name: Install build dependencies
uses: ./.github/actions/install-deps

- name: Setup GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master

- name: Build GDSiON
uses: ./.github/actions/build-extension
with:
target: template_release

- name: Upload release
uses: ./.github/actions/upload-extension

build-macos:
name: Compile and publish macOS version
runs-on: macos-latest
env:
SCONS_PLATFORM: macos

steps:
- uses: actions/checkout@v4

- name: Install build dependencies
uses: ./.github/actions/install-deps

- name: Build GDSiON
uses: ./.github/actions/build-extension
with:
target: template_release

- name: Upload release
uses: ./.github/actions/upload-extension

build-windows:
name: Compile and publish Windows version
runs-on: windows-latest
env:
SCONS_PLATFORM: windows

steps:
- uses: actions/checkout@v4

- name: Install build dependencies
uses: ./.github/actions/install-deps

- name: Setup MSVC problem matcher
uses: ammaraskar/msvc-problem-matcher@master

- name: Build GDSiON
uses: ./.github/actions/build-extension
with:
target: template_release

- name: Upload release
uses: ./.github/actions/upload-extension

build-web:
name: Compile and publish Web version
runs-on: ubuntu-latest
env:
SCONS_PLATFORM: web

steps:
- uses: actions/checkout@v4

- name: Install build dependencies
uses: ./.github/actions/install-deps

- name: Build GDSiON
uses: ./.github/actions/build-extension
with:
target: template_release

- name: Upload release
uses: ./.github/actions/upload-extension
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
bin/*
!bin/*.gdextension
example/bin/
example/export/

### Godot project development ###

Expand Down
18 changes: 8 additions & 10 deletions bin/libgdsion.gdextension
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@ reloadable = true

[libraries]

macos.debug = "res://bin/libgdsion.macos.template_debug.framework"
macos.release = "res://bin/libgdsion.macos.template_release.framework"
windows.debug.x86_32 = "res://bin/libgdsion.windows.template_debug.x86_32.dll"
windows.release.x86_32 = "res://bin/libgdsion.windows.template_release.x86_32.dll"
windows.debug.x86_64 = "res://bin/libgdsion.windows.template_debug.x86_64.dll"
windows.release.x86_64 = "res://bin/libgdsion.windows.template_release.x86_64.dll"
linux.debug.x86_64 = "res://bin/libgdsion.linux.template_debug.x86_64.so"
linux.release.x86_64 = "res://bin/libgdsion.linux.template_release.x86_64.so"
linux.debug.arm64 = "res://bin/libgdsion.linux.template_debug.arm64.so"
linux.release.arm64 = "res://bin/libgdsion.linux.template_release.arm64.so"
linux.debug.rv64 = "res://bin/libgdsion.linux.template_debug.rv64.so"
linux.release.rv64 = "res://bin/libgdsion.linux.template_release.rv64.so"
android.debug.x86_64 = "res://bin/libgdsion.android.template_debug.x86_64.so"
android.release.x86_64 = "res://bin/libgdsion.android.template_release.x86_64.so"
android.debug.arm64 = "res://bin/libgdsion.android.template_debug.arm64.so"
android.release.arm64 = "res://bin/libgdsion.android.template_release.arm64.so"
macos.debug = "res://bin/libgdsion.macos.template_debug.framework"
macos.release = "res://bin/libgdsion.macos.template_release.framework"
windows.debug.x86_32 = "res://bin/libgdsion.windows.template_debug.x86_32.dll"
windows.release.x86_32 = "res://bin/libgdsion.windows.template_release.x86_32.dll"
windows.debug.x86_64 = "res://bin/libgdsion.windows.template_debug.x86_64.dll"
windows.release.x86_64 = "res://bin/libgdsion.windows.template_release.x86_64.dll"
web.debug.wasm32 = "res://bin/libgdsion.web.template_debug.wasm32.wasm"
web.release.wasm32 = "res://bin/libgdsion.web.template_release.wasm32.wasm"

0 comments on commit ff2d686

Please sign in to comment.