geode/.github/workflows/build.yml

364 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
default: true
type: boolean
2023-11-21 12:25:47 -05:00
pull_request:
2022-07-30 12:24:03 -04:00
push:
branches:
2024-11-07 08:04:39 -05:00
- '**' # every branch
- '!no-build-**' # unless marked as no-build
2022-07-30 12:24:03 -04:00
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
2024-11-07 08:04:39 -05:00
runs-on: ubuntu-latest
2022-07-30 12:24:03 -04:00
steps:
2024-11-07 08:04:39 -05:00
- name: Checkout repository
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: win
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: Download xwin
uses: robinraju/release-downloader@v1
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"
- name: Prepare xwin
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
- 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-msvc.cmake
HOST_ARCH: x86_64
- name: Build
run: |
${{ env.base-build-command }}
${{ steps.build-debug-info.outputs.extra-build }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: geode-win
path: ./bin/nightly
- name: Package installer
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
2024-06-27 12:55:11 -04:00
env:
SCCACHE_CACHE_MULTIARCH: 1
steps:
2024-11-07 08:04:39 -05:00
- name: Checkout repository
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
# macOS does not currently support sccache due to performance issues
# - 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
- 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_OSX_ARCHITECTURES="arm64;x86_64"
-DGEODE_DISABLE_PRECOMPILED_HEADERS=OFF
${{ steps.build-debug-info.outputs.extra-configure }}
- name: Build
run: |
${{ env.base-build-command }}
${{ steps.build-debug-info.outputs.extra-build }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: geode-mac
path: ./bin/nightly
- name: Package installer
run: ./installer/mac/package.sh ./bin/nightly ./installer/mac/geode-installer-mac.pkg
- name: Upload installer
uses: actions/upload-artifact@v4
with:
name: geode-installer-mac
path: './installer/mac/geode-installer-mac.pkg'
- 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:
2024-11-07 08:04:39 -05:00
- 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:
2024-11-07 08:04:39 -05:00
- name: Checkout repository
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 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 }}
- 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'
2024-11-07 08:04:39 -05:00
2022-07-30 12:24:03 -04:00
steps:
2024-11-07 08:04:39 -05:00
- name: Checkout repository
uses: actions/checkout@v4
2024-11-07 08:04:39 -05: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
2024-11-07 08:04:39 -05:00
- name: Download artifacts
uses: actions/download-artifact@v4
2024-11-07 08:04:39 -05: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-11-07 08:04:39 -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
2024-11-07 08:04:39 -05: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-11-07 08:04:39 -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-11-07 08:04:39 -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
2024-11-07 08:04:39 -05: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
2024-11-07 08:04:39 -05: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