try to use ninja on win actions #967
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Binaries | |
on: | |
workflow_dispatch: | |
inputs: | |
draft: | |
description: Create a draft release | |
required: false | |
type: boolean | |
default: false | |
push: | |
branches: | |
- '**' # every branch | |
- '!no-build-**' # unless marked as no-build | |
env: | |
GEODE_CI: '' | |
CCACHE_ACTION_CI: true | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- name: Windows | |
os: windows-latest | |
os_identifier: win | |
extra_flags: '-G Ninja -T host=x86 -A win32 -DGEODE_DEBUG=On' | |
cli_cmd: '' | |
package_cmd: 'makensis -WX -V3 ./installer/windows/installer.nsi' | |
installer_path: './installer/windows/geode-installer-win.exe' | |
- name: macOS | |
os: macos-latest | |
os_identifier: mac | |
extra_flags: '-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DGEODE_DEBUG=On -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13' | |
cli_cmd: 'chmod +x $GITHUB_WORKSPACE/cli/geode' | |
package_cmd: './installer/mac/package.sh ./bin/nightly ./installer/mac/geode-installer-mac.pkg' | |
installer_path: './installer/mac/geode-installer-mac.pkg' | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: hendrikmuhs/ccache-action@v1 | |
with: | |
key: ${{ matrix.config.os }} | |
- uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: x86 | |
if: matrix.config.os_identifier == 'win' | |
- name: Install ninja | |
shell: bash | |
run: choco install ninja | |
if: matrix.config.os_identifier == 'win' | |
- name: Download CLI | |
uses: robinraju/release-downloader@v1.8 | |
with: | |
repository: geode-sdk/cli | |
latest: true | |
fileName: '*-${{ matrix.config.os_identifier }}.zip' | |
tarBall: false | |
zipBall: false | |
out-file-path: "cli" | |
- name: Setup CLI | |
run: | | |
7z x "${{ github.workspace }}/cli/*-${{ matrix.config.os_identifier }}.zip" -o"${{ github.workspace }}/cli" | |
${{ matrix.config.cli_cmd }} | |
echo "${{ github.workspace }}/cli" >> $GITHUB_PATH | |
- name: Configure CMake | |
run: > | |
cmake -B ${{ github.workspace }}/build | |
${{ matrix.config.extra_flags }} | |
-DCLI_PATH="${{ github.workspace }}/cli" | |
-DCMAKE_C_COMPILER_LAUNCHER=ccache | |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
- name: Build | |
run: | | |
cd ${{ github.workspace }}/build | |
cmake --build . --config RelWithDebInfo --parallel | |
- name: Delete resource cache file | |
run: rm ./bin/nightly/resources/.geode_cache | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: geode-${{ matrix.config.os_identifier }} | |
path: ./bin/nightly | |
- name: Package | |
run: ${{ matrix.config.package_cmd }} | |
- name: Publish Installer | |
uses: actions/upload-artifact@v3 | |
with: | |
name: geode-installer-${{ matrix.config.os_identifier }} | |
path: ${{ matrix.config.installer_path }} | |
publish: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Declare version and commit hash | |
id: ref | |
shell: bash | |
run: | | |
echo "version=$(cat ${{ github.workspace }}/VERSION | xargs)" >> $GITHUB_OUTPUT | |
echo "hash=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: ${{ github.workspace }} | |
- name: Move installers | |
run: | | |
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 | |
- name: Zip MacOS artifacts | |
uses: vimtor/action-zip@v1 | |
with: | |
files: geode-mac/Geode.dylib geode-mac/GeodeBootstrapper.dylib | |
dest: geode-${{ steps.ref.outputs.hash }}-mac.zip | |
- name: Zip Windows artifacts | |
uses: vimtor/action-zip@v1 | |
with: | |
files: geode-win/XInput9_1_0.dll geode-win/Geode.dll geode-win/GeodeUpdater.exe geode-win/Geode.lib | |
dest: geode-${{ steps.ref.outputs.hash }}-win.zip | |
- name: Update Nightly release | |
uses: andelf/nightly-release@main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: nightly | |
name: 'Dev Release' | |
draft: false | |
prerelease: true | |
body: | | |
Dev release of Geode. Will not install the resources automatically, so you should use the installers to install them. | |
files: | | |
./geode-${{ steps.ref.outputs.hash }}-mac.zip | |
./geode-${{ steps.ref.outputs.hash }}-win.zip | |
./geode-installer-${{ steps.ref.outputs.hash }}-mac.pkg | |
./geode-installer-${{ steps.ref.outputs.hash }}-win.exe | |
- name: Create draft release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: ${{ inputs.draft }} | |
with: | |
tag_name: v${{ steps.ref.outputs.version }} | |
name: Geode v${{ steps.ref.outputs.version }} | |
body: | | |
TODO before publishing: | |
- mark if pre-release | |
- add changelog | |
- remove this | |
draft: true | |
files: | | |
./geode-${{ steps.ref.outputs.version }}-mac.zip | |
./geode-${{ steps.ref.outputs.version }}-win.zip | |
./geode-installer-${{ steps.ref.outputs.version }}-mac.pkg | |
./geode-installer-${{ steps.ref.outputs.version }}-win.exe | |