geode/.github/workflows/build.yml

309 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:
2022-07-30 12:24:03 -04:00
- '**' # every branch
- '!no-build-**' # unless marked as no-build
2023-08-01 15:19:23 -04:00
env:
2023-08-01 19:06:20 -04:00
GEODE_CI: ''
2023-08-01 15:19:23 -04:00
2022-07-30 12:24:03 -04:00
jobs:
build:
strategy:
fail-fast: false
matrix:
config:
2023-08-01 17:11:04 -04:00
- name: Windows
os: windows-latest
id: win
2023-10-15 12:37:34 -04:00
cli_id: win
extra_flags: ''
2022-10-14 14:22:51 -04:00
cli_cmd: ''
ninja_cmd: |
iwr https://github.com/ninja-build/ninja/releases/latest/download/ninja-win.zip -OutFile ninja.zip
7z x ninja.zip -o"$env:GITHUB_WORKSPACE\ninja"
echo ($env:GITHUB_WORKSPACE + "\ninja") | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
llvm_cmd: |
iwr https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/LLVM-17.0.6-win64.exe -OutFile llvm-inst.exe
7z x llvm-inst.exe -ollvm bin/clang.exe bin/clang++.exe bin/lld-link.exe bin/llvm-rc.exe bin/*.dll lib/clang/*/include/*
echo ($env:GITHUB_WORKSPACE + "\llvm\bin") | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
package_cmd: 'makensis -WX -V3 ./installer/windows/installer.nsi'
installer_path: './installer/windows/geode-installer-win.exe'
2022-10-14 14:22:51 -04:00
2024-01-21 12:21:23 -05:00
- name: macOS
os: macos-latest
id: mac
cli_id: mac
extra_flags: -DGEODE_DONT_BUILD_TEST_MODS=1
cli_cmd: 'chmod +x cli/geode'
ninja_cmd: 'brew install ninja'
llvm_cmd: ''
2024-01-21 12:21:23 -05:00
package_cmd: './installer/mac/package.sh ./bin/nightly ./installer/mac/geode-installer-mac.pkg'
installer_path: './installer/mac/geode-installer-mac.pkg'
2024-01-01 16:58:25 -05:00
- name: Android32
2023-10-15 12:37:34 -04:00
os: ubuntu-latest
2024-01-01 16:58:25 -05:00
id: android32
2023-10-15 12:37:34 -04:00
cli_id: linux
extra_flags: >
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake
2023-10-15 13:08:20 -04:00
-DANDROID_ABI=armeabi-v7a
-DANDROID_PLATFORM=android-23
2023-10-15 12:37:34 -04:00
-DGEODE_DONT_BUILD_TEST_MODS=1
cli_cmd: 'chmod +x cli/geode'
ninja_cmd: 'sudo apt install ninja-build'
llvm_cmd: ''
2023-10-15 12:37:34 -04:00
package_cmd: ''
installer_path: ''
2024-01-01 16:58:25 -05:00
- name: Android64
os: ubuntu-latest
id: android64
cli_id: linux
extra_flags: >
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake
2024-01-01 16:58:25 -05:00
-DANDROID_ABI=arm64-v8a
-DANDROID_PLATFORM=android-23
-DGEODE_DONT_BUILD_TEST_MODS=1
cli_cmd: 'chmod +x cli/geode'
ninja_cmd: 'sudo apt install ninja-build'
llvm_cmd: ''
2024-01-01 16:58:25 -05:00
package_cmd: ''
installer_path: ''
2023-07-31 10:49:54 -04:00
name: Build ${{ matrix.config.name }}
2022-07-30 12:24:03 -04:00
runs-on: ${{ matrix.config.os }}
env:
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm-cache
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
shell: bash
run: |
mkdir ./build-debug-info
${{ matrix.config.id == 'win' && 'echo "REAL_BASH=C:/Program Files/Git/bin/bash.exe" >> $GITHUB_ENV' || 'echo "REAL_BASH=$BASH" >> $GITHUB_ENV' }}
echo "SCCACHE_ERROR_LOG=$GITHUB_WORKSPACE/build-debug-info/sccache-log.txt" >> $GITHUB_ENV
echo "SCCACHE_LOG=debug" >> $GITHUB_ENV
echo "RUST_BACKTRACE=1" >> $GITHUB_ENV
if: inputs.build-debug-info
# https://github.com/hendrikmuhs/ccache-action/pull/182
- name: Setup sccache
uses: chirag-droid/ccache-action@main
2023-08-01 16:48:51 -04:00
with:
variant: sccache
key: ${{ matrix.config.id }}-v1
if: ${{ github.event_name != 'workflow_dispatch' || inputs.use-ccache }}
2023-08-01 15:19:23 -04:00
- name: Setup CPM Cache
uses: actions/cache@v4
2022-07-30 12:24:03 -04:00
with:
path: cpm-cache
key: cpm-${{ matrix.config.id }}-v1-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
restore-keys: |
cpm-${{ matrix.config.id }}-v1-
2022-07-30 12:24:03 -04:00
- name: Setup info.rc Cache
uses: actions/cache@v4
2023-10-15 12:37:34 -04:00
with:
path: build/**/info.rc*
key: rc-${{ matrix.config.id }}-v1-${{ hashFiles('VERSION', 'loader/CMakeLists.txt', 'loader/src/platform/windows/info.rc.in') }}
if: matrix.config.id == 'win'
- name: Install Ninja
run: ${{ matrix.config.ninja_cmd }}
if: matrix.config.ninja_cmd != ''
- name: Update LLVM
run: ${{ matrix.config.llvm_cmd }}
if: matrix.config.llvm_cmd != ''
2023-10-15 12:37:34 -04:00
2022-10-14 14:22:51 -04:00
- name: Download CLI
uses: robinraju/release-downloader@v1.9
2022-10-14 14:22:51 -04:00
with:
repository: geode-sdk/cli
latest: true
2023-10-15 12:37:34 -04:00
fileName: '*-${{ matrix.config.cli_id }}.zip'
2022-10-14 14:22:51 -04:00
tarBall: false
zipBall: false
out-file-path: "cli"
2023-07-31 10:49:54 -04:00
- name: Setup CLI
2022-10-14 14:22:51 -04:00
run: |
7z x "cli/*-${{ matrix.config.cli_id }}.zip" -ocli
2022-10-14 14:22:51 -04:00
${{ matrix.config.cli_cmd }}
2023-10-15 12:37:34 -04:00
2024-02-02 18:29:22 -05:00
- name: Setup Breakpad Tools
uses: ./.github/actions/setup-dump-sym
id: breakpad-tools
if: matrix.config.id == 'android32' || matrix.config.id == 'android64'
- name: Checkout ninjatracing
uses: actions/checkout@v4
with:
repository: 'nico/ninjatracing'
path: ninjatracing
submodules: recursive
if: inputs.build-debug-info
2023-08-02 17:56:07 -04:00
- name: Configure
run: >
cmake -B build
-DCLI_PATH=${{ github.workspace }}/cli
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++
-DGEODE_CODEGEN_CMAKE_ARGS="-DCMAKE_C_COMPILER=clang;-DCMAKE_CXX_COMPILER=clang++;-G Ninja"
-G Ninja
2023-08-02 07:01:42 -04:00
${{ matrix.config.extra_flags }}
${{ inputs.build-debug-info && '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON' || '' }}
${{ inputs.build-debug-info && 'cp ./build/compile_commands.json ./build-debug-info/' || '' }}
2022-07-30 12:24:03 -04:00
- name: Build
run: |
cmake --build build --config RelWithDebInfo --parallel
rm bin/nightly/resources/.geode_cache
${{ inputs.build-debug-info && 'python3 ./ninjatracing/ninjatracing ./build/.ninja_log > ./build-debug-info/ninja-trace.json' || '' }}
${{ inputs.build-debug-info && (github.event_name != 'workflow_dispatch' || inputs.use-ccache) && 'sccache --show-adv-stats' || '' }}
2024-02-02 18:29:22 -05:00
2024-02-02 18:53:12 -05:00
# hardcoding toolchain path :(
- name: Post Build
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
2024-02-02 18:53:12 -05:00
if: matrix.config.id == 'android32' || matrix.config.id == 'android64'
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-${{ matrix.config.id }}
path: ./bin/nightly
2023-07-31 10:49:54 -04:00
2023-08-02 06:53:50 -04:00
- name: Package Installer
run: ${{ matrix.config.package_cmd }}
2024-01-01 16:58:25 -05:00
if: matrix.config.installer_path != ''
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-${{ matrix.config.id }}
2023-08-01 11:51:41 -04:00
path: ${{ matrix.config.installer_path }}
2024-01-01 16:58:25 -05:00
if: matrix.config.installer_path != ''
2023-07-31 10:49:54 -04:00
- name: Preprocess
shell: bash
run: |
mkdir build-debug-info-preprocessed
cd build
sed 's/\\\\/\//g' compile_commands.json | sed 's/D:\//\/d\//' > uni_compile_commands.json
pip install compile-commands
compile-commands --file=uni_compile_commands.json --filter_files='.*info\.rc.*' --filter='(.*) -o (.*)((?:/|\\).*)\.(?:obj|o) -c (.*)' --replacement="$REAL_BASH"' --noprofile --norc -c "mkdir -p ../build-debug-info-preprocessed/\g<2> && \g<1> -o ../build-debug-info-preprocessed/\g<2>\g<3>.i -E \g<4>"' -o ../build-debug-info/preprocess_commands.json --run --verbose
if: inputs.build-debug-info
- name: Upload Build Debug Info
uses: actions/upload-artifact@v4
with:
name: geode-build-debug-info-${{ matrix.config.id }}
path: ./build-debug-info/*
if: inputs.build-debug-info
- name: Upload Preprocessed Files
uses: actions/upload-artifact@v4
with:
name: geode-build-debug-info-preprocessed-${{ matrix.config.id }}
path: ./build-debug-info-preprocessed/*
if: inputs.build-debug-info
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
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-06-10 09:06:29 -04:00
shell: bash
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.1
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
2023-08-03 19:09:19 -04:00
uses: vimtor/action-zip@v1.1
2022-07-30 12:24:03 -04:00
with:
2023-08-21 18:31:06 -04:00
files: geode-win/XInput9_1_0.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
2023-10-15 12:37:34 -04:00
uses: vimtor/action-zip@v1.1
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.1
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.1
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