geode/.github/workflows/build.yml

375 lines
11 KiB
YAML
Raw Normal View History

2022-07-30 12:24:03 -04:00
name: Build Binaries
on:
workflow_dispatch:
inputs:
build-debug-info:
description: 'Profile and debug the build process'
required: false
default: false
type: boolean
use-ccache:
description: 'Enable ccache/sccache'
required: false
2024-06-27 10:03:44 -04:00
default: false
type: boolean
2023-11-21 12:25:47 -05:00
pull_request:
2022-07-30 12:24:03 -04:00
push:
branches:
2022-07-30 12:24:03 -04:00
- '**' # every branch
- '!no-build-**' # unless marked as no-build
env:
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm-cache
base-configure-command: >-
cmake -B build
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DGEODE_CODEGEN_CMAKE_ARGS="-DCMAKE_C_COMPILER=clang;-DCMAKE_CXX_COMPILER=clang++;-G Ninja"
-G Ninja
base-build-command: |
cmake --build build --config RelWithDebInfo --parallel
rm bin/nightly/resources/.geode_cache
2022-07-30 12:24:03 -04:00
jobs:
build-windows:
name: Build Windows
runs-on: ubuntu-24.04
2022-07-30 12:24:03 -04:00
steps:
2023-08-02 17:56:07 -04:00
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
2022-07-30 12:24:03 -04:00
- name: Prepare for Build Debug Info
id: build-debug-info
uses: ./.github/actions/build-debug-info
with:
has-sccache: ${{ inputs.use-ccache }}
if: inputs.build-debug-info
- name: Setup caches
uses: ./.github/actions/setup-cache
with:
host: linux
target: win
use-ccache: ${{ github.event_name != 'workflow_dispatch' || inputs.use-ccache }}
- name: Setup Ninja
uses: ./.github/actions/setup-ninja
2023-08-01 16:48:51 -04:00
with:
host: linux
2023-08-01 15:19:23 -04:00
- name: Setup CLI
2024-06-27 09:07:45 -04:00
uses: geode-sdk/cli/.github/actions/setup@main
- name: Download xwin
uses: robinraju/release-downloader@v1.10
with:
repository: Jake-Shadle/xwin
latest: true
fileName: 'xwin-*-x86_64-unknown-linux-musl.tar.gz'
tarBall: false
zipBall: false
out-file-path: "epic-xwin"
2023-10-15 12:37:34 -04:00
- name: Prepare xwin
2024-06-07 06:22:12 -04:00
run: |
tar -xzf epic-xwin/xwin-*-x86_64-unknown-linux-musl.tar.gz -C epic-xwin
mv epic-xwin/xwin-*-x86_64-unknown-linux-musl/xwin ./xwin
./xwin --arch x86_64 --sdk-version 10.0.22621 --accept-license list
# this caches '.xwin-cache/**/*' but that's actually only gonna
# contain the manifest cuz we only ran `xwin list` so far
- name: Setup xwin Cache
id: xwin-cache
uses: actions/cache@v4
with:
path: .xwin-cache
key: xwin-win-v1-${{ hashFiles('.xwin-cache/**/*') }}
- name: Download Windows headers
run: ./xwin --arch x86_64 --sdk-version 10.0.22621 --accept-license splat --include-debug-libs
if: steps.xwin-cache.outputs.cache-hit != 'true'
- name: Download clang-msvc-sdk toolchain
uses: actions/checkout@v4
with:
repository: 'geode-sdk/clang-msvc-sdk'
path: toolchain
submodules: recursive
- name: Configure
run: ${{ env.base-configure-command }} -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN ${{ steps.build-debug-info.outputs.extra-configure }}
env:
SPLAT_DIR: ${{ github.workspace }}/.xwin-cache/splat
TOOLCHAIN: ${{ github.workspace }}/toolchain/clang-cl-msvc.cmake
HOST_ARCH: x86_64
2023-07-31 10:49:54 -04:00
- name: Build
2022-10-14 14:22:51 -04:00
run: |
${{ env.base-build-command }}
${{ steps.build-debug-info.outputs.extra-build }}
2023-10-15 12:37:34 -04:00
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: geode-win
path: ./bin/nightly
- name: Package Installer
2024-05-16 07:22:41 -04:00
run: |
sudo apt install nsis
makensis -WX -V3 ./installer/windows/installer.nsi
- name: Upload Installer
uses: actions/upload-artifact@v4
with:
name: geode-installer-win
path: './installer/windows/geode-installer-win.exe'
- name: Complete Build Debug Info
uses: ./.github/actions/build-debug-info-post
with:
target: win
if: inputs.build-debug-info && (success() || failure())
2024-02-02 18:29:22 -05:00
build-mac:
name: Build macOS
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Prepare for Build Debug Info
id: build-debug-info
uses: ./.github/actions/build-debug-info
with:
has-sccache: ${{ inputs.use-ccache }}
if: inputs.build-debug-info
- name: Setup caches
uses: ./.github/actions/setup-cache
with:
host: mac
target: mac
use-ccache: ${{ github.event_name != 'workflow_dispatch' || inputs.use-ccache }}
- name: Setup Ninja
uses: ./.github/actions/setup-ninja
with:
host: mac
2024-06-27 10:03:44 -04:00
- name: Install LLVM
run: |
brew install llvm
echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH
- name: Setup CLI
uses: geode-sdk/cli/.github/actions/setup@main
- name: Configure
run: >
${{ env.base-configure-command }}
-DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
-DCMAKE_AR='/usr/bin/ar'
-DCMAKE_RANLIB='/usr/bin/ranlib'
-DGEODE_DISABLE_PRECOMPILED_HEADERS=Off
2024-06-27 09:34:00 -04:00
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
${{ steps.build-debug-info.outputs.extra-configure }}
2024-06-27 09:34:00 -04:00
env:
MACOSX_DEPLOYMENT_TARGET: "10.15"
2022-07-30 12:24:03 -04:00
- name: Build
run: |
${{ env.base-build-command }}
${{ steps.build-debug-info.outputs.extra-build }}
2024-06-27 09:34:00 -04:00
env:
MACOSX_DEPLOYMENT_TARGET: "10.15"
2024-02-02 18:53:12 -05:00
2022-07-30 12:24:03 -04:00
- name: Upload Artifacts
uses: actions/upload-artifact@v4
2022-07-30 12:24:03 -04:00
with:
name: geode-mac
path: ./bin/nightly
2023-07-31 10:49:54 -04:00
2023-08-02 06:53:50 -04:00
- name: Package Installer
run: ./installer/mac/package.sh ./bin/nightly ./installer/mac/geode-installer-mac.pkg
2023-07-31 10:49:54 -04:00
2023-08-02 06:53:50 -04:00
- name: Upload Installer
uses: actions/upload-artifact@v4
2023-07-31 10:49:54 -04:00
with:
name: geode-installer-mac
path: './installer/mac/geode-installer-mac.pkg'
2023-07-31 10:49:54 -04:00
- name: Complete Build Debug Info
uses: ./.github/actions/build-debug-info-post
with:
target: mac
if: inputs.build-debug-info && (success() || failure())
build-android:
strategy:
fail-fast: false
matrix:
config:
- name: Android (32-bit)
id: android32
extra-configure: -DANDROID_ABI=armeabi-v7a
- name: Android (64-bit)
id: android64
extra-configure: -DANDROID_ABI=arm64-v8a
name: Build ${{ matrix.config.name }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Prepare for Build Debug Info
id: build-debug-info
uses: ./.github/actions/build-debug-info
with:
has-sccache: ${{ inputs.use-ccache }}
if: inputs.build-debug-info
- name: Setup caches
uses: ./.github/actions/setup-cache
with:
host: linux
target: ${{ matrix.config.id }}
use-ccache: ${{ github.event_name != 'workflow_dispatch' || inputs.use-ccache }}
- name: Setup Ninja
uses: ./.github/actions/setup-ninja
with:
host: linux
- name: Setup CLI
uses: geode-sdk/cli/.github/actions/setup@main
- name: Setup Breakpad Tools
uses: ./.github/actions/setup-dump-sym
id: breakpad-tools
- name: Fix Ubuntu libcstd++
run: |
sudo apt install ninja-build &&
sudo add-apt-repository ppa:ubuntu-toolchain-r/test &&
sudo apt-get update &&
sudo apt-get install --only-upgrade libstdc++6
- name: Configure
run: >
${{ env.base-configure-command }}
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake
-DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++
-DANDROID_PLATFORM=android-23
-DANDROID_STL=c++_shared
${{ matrix.config.extra-configure }}
${{ steps.build-debug-info.outputs.extra-configure }}
- name: Build
run: |
${{ env.base-build-command }}
${{ steps.build-debug-info.outputs.extra-build }}
# hardcoding toolchain path :(
- name: Dump Symbols
run: |
${{ steps.breakpad-tools.outputs.binary-path }} ./bin/nightly/Geode.${{ matrix.config.id }}.so -o ./bin/nightly/Geode.${{ matrix.config.id }}.so.sym
$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip ./bin/nightly/Geode.${{ matrix.config.id }}.so
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: geode-${{ matrix.config.id }}
path: ./bin/nightly
- name: Complete Build Debug Info
uses: ./.github/actions/build-debug-info-post
with:
target: ${{ matrix.config.id }}
if: inputs.build-debug-info && (success() || failure())
2022-07-30 12:24:03 -04:00
publish:
2023-08-03 20:29:17 -04:00
name: Publish
2022-07-30 12:24:03 -04:00
runs-on: ubuntu-latest
needs: [ build-windows, build-mac, build-android ]
if: github.ref == 'refs/heads/main'
2022-07-30 12:24:03 -04:00
steps:
2023-08-02 17:56:07 -04:00
- name: Checkout
uses: actions/checkout@v4
2023-08-02 06:53:50 -04:00
- name: Declare Version Variables
id: ref
2023-08-01 11:51:41 -04:00
run: |
echo "version=$(cat VERSION | xargs)" >> $GITHUB_OUTPUT
echo "hash=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT
2022-07-30 12:24:03 -04:00
2023-08-02 06:53:50 -04:00
- name: Download Artifacts
uses: actions/download-artifact@v4
2023-08-03 20:21:28 -04:00
- name: Move Installers
2023-08-01 11:08:17 -04:00
run: |
2024-01-21 12:48:57 -05:00
mv geode-installer-mac/geode-installer-mac.pkg geode-installer-${{ steps.ref.outputs.hash }}-mac.pkg
mv geode-installer-win/geode-installer-win.exe geode-installer-${{ steps.ref.outputs.hash }}-win.exe
2022-07-30 12:24:03 -04:00
2024-01-21 12:21:23 -05:00
- name: Zip MacOS Artifacts
uses: vimtor/action-zip@v1.2
2024-01-21 12:21:23 -05:00
with:
files: geode-mac/Geode.dylib geode-mac/GeodeBootstrapper.dylib
dest: geode-${{ steps.ref.outputs.hash }}-mac.zip
2022-07-30 12:24:03 -04:00
2023-08-02 06:53:50 -04:00
- name: Zip Windows Artifacts
uses: vimtor/action-zip@v1.2
2022-07-30 12:24:03 -04:00
with:
files: geode-win/XInput1_4.dll geode-win/Geode.dll geode-win/GeodeUpdater.exe geode-win/Geode.lib geode-win/Geode.pdb
dest: geode-${{ steps.ref.outputs.hash }}-win.zip
2024-01-01 16:58:25 -05:00
- name: Zip Android32 Artifacts
uses: vimtor/action-zip@v1.2
2023-10-15 12:37:34 -04:00
with:
2024-02-02 18:38:16 -05:00
files: geode-android32/Geode.android32.so geode-android32/Geode.android32.so.sym
2024-01-01 07:24:51 -05:00
dest: geode-${{ steps.ref.outputs.hash }}-android32.zip
2023-10-15 12:37:34 -04:00
2024-01-01 16:58:25 -05:00
- name: Zip Android64 Artifacts
uses: vimtor/action-zip@v1.2
2024-01-01 16:58:25 -05:00
with:
2024-02-02 18:38:16 -05:00
files: geode-android64/Geode.android64.so geode-android64/Geode.android64.so.sym
2024-01-01 16:58:25 -05:00
dest: geode-${{ steps.ref.outputs.hash }}-android64.zip
2023-09-16 07:19:31 -04:00
- name: Zip Resources
uses: vimtor/action-zip@v1.2
with:
2024-01-19 11:46:33 -05:00
files: geode-android64/resources
2023-09-16 07:09:05 -04:00
dest: resources.zip
2023-08-03 20:21:28 -04:00
2023-09-16 07:19:31 -04:00
- name: Update Development Release
2023-08-01 11:08:17 -04:00
uses: andelf/nightly-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2022-07-30 12:24:03 -04:00
with:
2023-08-01 11:08:17 -04:00
tag_name: nightly
2023-08-03 20:34:27 -04:00
name: 'Development Release'
2023-08-01 11:08:17 -04:00
body: |
2023-08-03 20:34:27 -04:00
Geode development release for commit ${{ github.sha }}. Since this is not a regular release, Geode will not install the resources automatically, so you should use the installer if you want them.
2023-08-01 11:08:17 -04:00
files: |
./geode-installer-${{ steps.ref.outputs.hash }}-win.exe
2024-01-21 12:21:23 -05:00
./geode-installer-${{ steps.ref.outputs.hash }}-mac.pkg
2023-08-03 20:21:28 -04:00
./geode-${{ steps.ref.outputs.hash }}-win.zip
2024-01-21 12:21:23 -05:00
./geode-${{ steps.ref.outputs.hash }}-mac.zip
2024-01-01 07:24:51 -05:00
./geode-${{ steps.ref.outputs.hash }}-android32.zip
2024-01-01 16:58:25 -05:00
./geode-${{ steps.ref.outputs.hash }}-android64.zip
2023-09-16 07:09:05 -04:00
./resources.zip