geode/.github/workflows/build.yml

190 lines
5.9 KiB
YAML
Raw Normal View History

2022-07-30 12:24:03 -04:00
name: Build Binaries
on:
workflow_dispatch:
push:
branches:
2022-07-30 12:24:03 -04:00
- '**' # every branch
- '!no-build-**' # unless marked as no-build
jobs:
build:
strategy:
fail-fast: false
matrix:
config:
- name: "Windows"
os_identifier: "win"
2022-07-30 12:24:03 -04:00
os: windows-2019
prefixes: ''
2023-03-06 12:34:47 -05:00
extra_flags: '-T host=x86 -A win32 -DGEODE_DEBUG=On'
2023-06-09 20:34:15 -04:00
out_paths: './bin/nightly/Geode.pdb ./bin/nightly/Geode.dll ./bin/nightly/GeodeUpdater.exe ./bin/nightly/Geode.lib ./bin/nightly/XInput9_1_0.dll'
2022-10-14 14:22:51 -04:00
cli_cmd: ''
2022-07-30 12:24:03 -04:00
- name: "macOS"
os_identifier: "mac"
2022-07-30 12:24:03 -04:00
os: macos-latest
prefixes: 'PATH="/usr/local/opt/ccache/libexec:$PATH"'
2023-01-28 04:19:16 -05:00
extra_flags: "-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DGEODE_DEBUG=On -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13"
out_paths: './bin/nightly/Geode.dylib ./bin/nightly/GeodeBootstrapper.dylib ./loader/include/link/libfmod.dylib'
2022-10-14 14:22:51 -04:00
cli_cmd: 'chmod +x $GITHUB_WORKSPACE/cli/geode'
2023-07-31 10:49:54 -04:00
2022-07-30 12:24:03 -04:00
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
2022-07-30 12:24:03 -04:00
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86
if: matrix.config.os_identifier == 'win'
2022-07-30 12:24:03 -04:00
- name: Configure ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ matrix.config.os }}
2022-10-14 14:22:51 -04:00
- name: Download CLI
uses: robinraju/release-downloader@v1.5
with:
repository: geode-sdk/cli
latest: true
fileName: "*-${{ matrix.config.os_identifier }}.zip"
2022-10-14 14:22:51 -04:00
tarBall: false
zipBall: false
2022-10-16 13:12:05 -04:00
out-file-path: "cli"
2023-07-31 10:49:54 -04:00
2022-10-14 14:22:51 -04:00
- name: Unzip CLI
run: |
7z x "${{ github.workspace }}/cli/*-${{ matrix.config.os_identifier }}.zip" -o"${{ github.workspace }}/cli"
2023-07-31 10:49:54 -04:00
2022-10-14 14:22:51 -04:00
- name: Add CLI to Path
run: |
${{ matrix.config.cli_cmd }}
echo "${{ github.workspace }}/cli" >> $GITHUB_PATH
2022-07-30 12:24:03 -04:00
- name: Configure CMake
run: >
${{ matrix.config.prefixes }} cmake -B
${{ github.workspace }}/build
${{ matrix.config.extra_flags }}
-DCLI_PATH="${{ github.workspace }}/cli"
2022-11-28 14:08:21 -05:00
-D CMAKE_C_COMPILER_LAUNCHER=ccache
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache
2022-07-30 12:24:03 -04:00
- name: Build
run: |
cd build
2022-11-28 13:24:30 -05:00
cmake --build . --config RelWithDebInfo --parallel
2022-07-30 12:24:03 -04:00
- name: Move to output folder
shell: bash
working-directory: ${{ github.workspace }}
run: |
mkdir ./out
mv ${{ matrix.config.out_paths }} ./out
2023-07-31 10:49:54 -04:00
- name: Get version
uses: juliangruber/read-file-action@v1.1.6
with:
path: ${{ github.workspace }}/VERSION
id: version
2023-07-31 10:49:54 -04:00
2023-06-10 06:45:13 -04:00
- name: Trim whitespace from version
2023-06-10 09:06:29 -04:00
shell: bash
2023-06-10 06:45:13 -04:00
run: echo "VERSION_TRIM=$(echo '${{ steps.version.outputs.content }}' | xargs)" >> $GITHUB_ENV
- name: Delete resource cache file
run: |
rm ./bin/nightly/resources/.geode_cache
- name: Upload resources
uses: actions/upload-artifact@v2
with:
name: resources
path: ./bin/nightly/resources
if: matrix.config.os_identifier == 'win'
2022-07-30 12:24:03 -04:00
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
2023-06-10 06:45:13 -04:00
name: geode-v${{ env.VERSION_TRIM }}-${{ matrix.config.os_identifier }}
2022-07-30 12:24:03 -04:00
path: ./out
2023-07-31 10:49:54 -04:00
- name: Package MacOS
run: |
2023-06-28 08:56:25 -04:00
cp -R ./bin/nightly/resources ./out/resources
2023-06-28 08:54:38 -04:00
./installer/mac/package.sh ./out ./out/geode-installer-v${{ env.VERSION_TRIM }}-${{ matrix.config.os_identifier }}.pkg
if: matrix.config.os_identifier == 'mac'
2023-07-31 10:49:54 -04:00
- name: Publish MacOS Installer
uses: actions/upload-artifact@v2
with:
name: geode-installer-v${{ env.VERSION_TRIM }}-${{ matrix.config.os_identifier }}
path: ./out/geode-installer-v${{ env.VERSION_TRIM }}-${{ matrix.config.os_identifier }}.pkg
if: matrix.config.os_identifier == 'mac'
2022-07-30 12:24:03 -04:00
2023-07-31 10:49:54 -04:00
- name: Install NSIS
run: |
iwr -useb get.scoop.sh -outfile 'install.ps1'
.\install.ps1 -RunAsAdmin
scoop update
scoop bucket add extras
scoop install nsis
if: matrix.config.os_identifier == 'win'
- name: Package Windows
run: |
cd ./installer/windows
makensis -WX -V3 installer.nsi
if: matrix.config.os_identifier == 'win'
- name: Publish Windows Installer
uses: actions/upload-artifact@v2
with:
name: GeodeInstaller_v${{ env.VERSION_TRIM }}-${{ matrix.config.os_identifier }}
path: ./installer/windows/GeodeInstaller.exe
if: matrix.config.os_identifier == 'win'
2022-07-30 12:24:03 -04:00
publish:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
2022-07-30 12:24:03 -04:00
steps:
- uses: actions/checkout@v2
2023-07-31 10:49:54 -04:00
2022-11-19 21:19:59 -05:00
- name: Get version
uses: juliangruber/read-file-action@v1.1.6
with:
path: ${{ github.workspace }}/VERSION
id: version
2023-07-31 10:49:54 -04:00
2023-06-10 06:45:13 -04:00
- name: Trim whitespace from version
2023-06-10 09:06:29 -04:00
shell: bash
2023-06-10 06:45:13 -04:00
run: echo "VERSION_TRIM=$(echo '${{ steps.version.outputs.content }}' | xargs)" >> $GITHUB_ENV
2022-07-30 12:24:03 -04:00
- uses: actions/download-artifact@v3
with:
path: ${{ github.workspace }}
- uses: vimtor/action-zip@v1
with:
2023-06-10 06:45:13 -04:00
files: geode-v${{ env.VERSION_TRIM }}-mac/Geode.dylib geode-v${{ env.VERSION_TRIM }}-mac/GeodeBootstrapper.dylib
2022-11-19 21:19:59 -05:00
dest: geode-nightly-mac.zip
2022-07-30 12:24:03 -04:00
- uses: vimtor/action-zip@v1
with:
2023-06-10 06:45:13 -04:00
files: geode-v${{ env.VERSION_TRIM }}-win/XInput9_1_0.dll geode-v${{ env.VERSION_TRIM }}-win/Geode.dll geode-v${{ env.VERSION_TRIM }}-win/GeodeUpdater.exe geode-v${{ env.VERSION_TRIM }}-win/Geode.lib
2022-11-19 21:19:59 -05:00
dest: geode-nightly-win.zip
2022-07-30 12:24:03 -04:00
- name: Update release
uses: IsaacShelton/update-existing-release@v1.3.2
2022-07-30 12:24:03 -04:00
with:
token: ${{ secrets.GITHUB_TOKEN }}
2022-11-19 21:19:59 -05:00
files: ./geode-nightly-mac.zip ./geode-nightly-win.zip
2023-03-06 12:34:47 -05:00
release: nightly
tag: nightly
prerelease: true