Only build BizHawk from scratch if it can't be downloaded #137
Workflow file for this run
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 | |
on: | |
push: | |
branches: [ master ] | |
tags: | |
- '*' | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: windows-2022 | |
env: | |
bizhawk_required_files: | | |
lib/BizHawk/output/dll/BizHawk.*.dll | |
lib/BizHawk/output/EmuHawk.exe | |
skip_benchmarks: | | |
${{ contains(github.event.head_commit.message, '[skip benchmarks]') }} || | |
${{ contains(github.event.head_commit.message, '[skip benchmark]') }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Get BizHawk submodule SHA | |
run: echo "bizhawk_hash=$(git rev-parse HEAD:lib/BizHawk)" >> $env:GITHUB_ENV | |
- name: Restore BizHawk binaries from cache | |
id: bizhawk-binaries-cache-restore | |
uses: martijnhols/actions-cache/restore@v3 | |
with: | |
path: ${{ env.bizhawk_required_files }} | |
key: bizhawk-binaries-${{ env.bizhawk_hash }} | |
- name: Check out BizHawk | |
if: ${{ hashFiles(env.bizhawk_required_files) == '' }} | |
run: git submodule update --init | |
- name: Build BizHawk | |
if: ${{ hashFiles(env.bizhawk_required_files) == '' }} | |
run: QuickTestBuildAndPackage_Release.bat | |
shell: cmd | |
working-directory: lib/BizHawk/Dist | |
- name: Save BizHawk binaries to cache | |
if: ${{ steps.bizhawk-binaries-cache-restore.outputs.cache-hit != 'true' }} | |
uses: martijnhols/actions-cache/save@v3 | |
with: | |
path: ${{ env.bizhawk_required_files }} | |
key: ${{ steps.bizhawk-binaries-cache-restore.outputs.primary-key }} | |
- name: Build external tool | |
run: dotnet build -c:Release -t:CreateZip | |
working-directory: src/SHME.ExternalTool | |
- name: Run benchmarks | |
if: ${{ env.skip_benchmarks != 'true' }} | |
run: dotnet run -c Release -- -f * -e json -a ../../artifacts/test/benchmark | |
working-directory: test/Benchmark | |
- name: Rename benchmark results | |
if: ${{ env.skip_benchmarks != 'true' }} | |
run: Rename-Item -Path BenchmarkRun*.json -NewName benchmark-results.json | |
working-directory: artifacts/test/benchmark/results | |
- name: Upload benchmark results | |
if: ${{ github.event_name != 'pull_request' && env.skip_benchmarks != 'true' }} | |
uses: benchmark-action/github-action-benchmark@v1 | |
with: | |
name: SHME BenchmarkDotNet results | |
tool: 'benchmarkdotnet' | |
output-file-path: artifacts/test/benchmark/results/benchmark-results.json | |
gh-repository: github.com/ItEndsWithTens/PerfTrendsWithTens | |
benchmark-data-dir-path: SHME/bench | |
github-token: ${{ secrets.PERF_REPO_WRITE_TOKEN }} | |
auto-push: true | |
- name: Upload .zip | |
uses: actions/upload-artifact@v4 | |
with: | |
name: zip | |
path: artifacts/dist/*.zip | |
compression-level: 0 | |
create-release: | |
needs: build | |
if: ${{ github.event_name != 'pull_request' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download zip file | |
uses: actions/download-artifact@v4 | |
with: | |
name: zip | |
- name: Release latest dev build | |
if: ${{ !startsWith(github.ref, 'refs/tags/v') }} | |
uses: dciborow/[email protected] | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: 'latest' | |
title: 'Latest dev build' | |
prerelease: false | |
generate_release_notes: true | |
files: | | |
*.zip | |
- name: Prepare draft release of tag | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
uses: dciborow/[email protected] | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
draft: true | |
prerelease: false | |
generate_release_notes: true | |
files: | | |
*.zip |