Skip to content

Commit

Permalink
ci: Cache Studio builds
Browse files Browse the repository at this point in the history
  • Loading branch information
psyGamer committed Jan 24, 2025
1 parent f39d129 commit 9137eef
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/Build.CelesteStudio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,79 @@ on:
default: Release

jobs:
cache:
runs-on: ubuntu-latest
outputs:
windows_cache_hit: ${{ steps.check-windows.outputs.cache-hit }}
linux_cache_hit: ${{ steps.check-linux.outputs.cache-hit }}
macos_cache_hit: ${{ steps.check-macos.outputs.cache-hit }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Compute cache keys
id: compute-key
run: |
windows_cache_key=CelesteStudioCache-Windows-${{ inputs.build-cfg }}-$(git log -1 --format='%H' -- StudioCommunication Studio/CelesteStudio Studio/CelesteStudio.WPF)
linux_cache_key=CelesteStudioCache-Linux-${{ inputs.build-cfg }}-$(git log -1 --format='%H' -- StudioCommunication Studio/CelesteStudio Studio/CelesteStudio.GTK)
macos_cache_key=CelesteStudioCache-macOS-${{ inputs.build-cfg }}-$(git log -1 --format='%H' -- StudioCommunication Studio/CelesteStudio Studio/CelesteStudio.Mac)
echo "::set-output name=windows_key::$windows_cache_key"
echo "::set-output name=linux_key::$linux_cache_key"
echo "::set-output name=macos_key::$macos_cache_key"
- name: Check Windows cache
id: check-windows
uses: actions/cache@v4
with:
path: CelesteStudio-windows-x64.zip
key: ${{ steps.compute-key.outputs.windows_key }}
- name: Check Linux cache
id: check-linux
uses: actions/cache@v4
with:
path: CelesteStudio-linux-x64.zip
key: ${{ steps.compute-key.outputs.linux_key }}
- name: Check macOS cache
id: check-macos
uses: actions/cache@v4
with:
path: |
CelesteStudio-macos-x64.zip
CelesteStudio-macos-arm64.zip
key: ${{ steps.compute-key.outputs.macos_key }}

- name: Upload Windows x64
uses: actions/upload-artifact@v4
if: steps.check-windows.outputs.cache-hit == 'true'
with:
name: CelesteStudio-windows-x64
path: CelesteStudio-windows-x64.zip
- name: Upload Linux x64
uses: actions/upload-artifact@v4
if: steps.check-linux.outputs.cache-hit == 'true'
with:
name: CelesteStudio-linux-x64
path: CelesteStudio-linux-x64.zip
- name: Upload macOS x64
uses: actions/upload-artifact@v4
if: steps.check-macos.outputs.cache-hit == 'true'
with:
name: CelesteStudio-macos-x64
path: CelesteStudio-macos-x64.zip
- name: Upload macOS ARM64
uses: actions/upload-artifact@v4
if: steps.check-macos.outputs.cache-hit == 'true'
with:
name: CelesteStudio-macos-arm64
path: CelesteStudio-macos-arm64.zip

build-windows:
runs-on: windows-latest

needs: cache
if: needs.cache.outputs.windows_cache_hit == 'false'

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -61,6 +131,9 @@ jobs:
build-linux:
runs-on: ubuntu-latest

needs: cache
if: needs.cache.outputs.linux_cache_hit == 'false'

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -110,6 +183,9 @@ jobs:
build-mac:
runs-on: macos-13

needs: cache
if: needs.cache.outputs.macos_cache_hit == 'false'

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down

0 comments on commit 9137eef

Please sign in to comment.