Skip to content

Commit

Permalink
Split the cache/restore phase for test files
Browse files Browse the repository at this point in the history
- Otherwise they'll be saved to the cache twice
  • Loading branch information
JesseTG committed Jan 23, 2025
1 parent 5962cf2 commit 796a82b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 7 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,44 @@ on:
- "*.github/FUNDING.yml"
- "*.github/workflows/**"
jobs:
fetch-testfiles:
name: Fetch Test Files
runs-on: ubuntu-22.04-arm
steps:
- name: Clone Test File Repository
uses: actions/checkout@v4
id: clone-test-file-repo
with:
repository: "${{ secrets.TESTFILE_REPO }}"
token: "${{ secrets.TESTFILE_REPO_TOKEN }}"
path: "testfiles"
persist-credentials: false

- name: Prepare Test Files
working-directory: "${{ github.workspace }}/testfiles"
shell: bash
run: 7z x "${{ secrets.DSI_NAND_ARCHIVE }}"

- name: Cache Test Files
uses: actions/cache/save@v4
with:
path: "${{ github.workspace }}/testfiles"
key: "testfiles-${{ steps.clone-test-file-repo.outputs.commit }}"

outputs:
testfiles-cache-key: "testfiles-${{ steps.clone-test-file-repo.outputs.commit }}"

windows:
name: Windows (x86_64)
uses: ./.github/workflows/pipeline.yaml
needs: fetch-testfiles
with:
archive-name: melondsds_libretro-win32-x86_64
runs-on: windows-latest
info-dir: info
shell: msys2 {0}
test-suite: true
testfiles-cache-key: ${{ needs.fetch-testfiles.outputs.testfiles-cache-key }}
cmake-args: -DENABLE_SCCACHE=ON -DSCCACHE="C:/Users/runneradmin/.cargo/bin/sccache.exe"
secrets:
TESTFILE_REPO_TOKEN: ${{ secrets.TESTFILE_REPO_TOKEN }}
Expand All @@ -49,10 +78,12 @@ jobs:
macos-x86_64:
name: macOS (x86_64)
uses: ./.github/workflows/pipeline.yaml
needs: fetch-testfiles
with:
archive-name: melondsds_libretro-macos-x86_64
runs-on: macos-13
test-suite: true
testfiles-cache-key: ${{ needs.fetch-testfiles.outputs.testfiles-cache-key }}
cmake-args: -DCMAKE_OSX_ARCHITECTURES:STRING="x86_64" -DENABLE_OGLRENDERER=OFF -DCMAKE_APPLE_SILICON_PROCESSOR="x86_64"
# Disabled OpenGL on macOS due to https://github.com/JesseTG/melonds-ds/issues/12
secrets:
Expand All @@ -73,10 +104,12 @@ jobs:
macos-arm64:
name: macOS (arm64)
uses: ./.github/workflows/pipeline.yaml
needs: fetch-testfiles
with:
archive-name: melondsds_libretro-macos-arm64
runs-on: macos-latest
test-suite: true
testfiles-cache-key: ${{ needs.fetch-testfiles.outputs.testfiles-cache-key }}
cmake-args: -DCMAKE_OSX_ARCHITECTURES:STRING="arm64" -DENABLE_OGLRENDERER=OFF -DCMAKE_APPLE_SILICON_PROCESSOR="arm64"
# Disabled OpenGL on macOS due to https://github.com/JesseTG/melonds-ds/issues/12
secrets:
Expand All @@ -97,10 +130,12 @@ jobs:
linux-x86_64:
name: Linux (x86_64)
uses: ./.github/workflows/pipeline.yaml
needs: fetch-testfiles
with:
archive-name: melondsds_libretro-linux-x86_64
runs-on: ubuntu-latest
test-suite: true
testfiles-cache-key: ${{ needs.fetch-testfiles.outputs.testfiles-cache-key }}
secrets:
TESTFILE_REPO_TOKEN: ${{ secrets.TESTFILE_REPO_TOKEN }}
TESTFILE_REPO: ${{ secrets.TESTFILE_REPO }}
Expand All @@ -119,10 +154,12 @@ jobs:
linux-aarch64:
name: Linux (arm64)
uses: ./.github/workflows/pipeline.yaml
needs: fetch-testfiles
with:
archive-name: melondsds_libretro-linux-arm64
runs-on: ubuntu-22.04-arm
test-suite: true
testfiles-cache-key: ${{ needs.fetch-testfiles.outputs.testfiles-cache-key }}
secrets:
TESTFILE_REPO_TOKEN: ${{ secrets.TESTFILE_REPO_TOKEN }}
TESTFILE_REPO: ${{ secrets.TESTFILE_REPO }}
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ on:
type: boolean
required: false
default: false
testfiles-cache-key:
type: string
required: false
env:
BUILD_DIR: "${{ github.workspace }}/${{ inputs.build-dir }}"
DIST_DIR: "${{ github.workspace }}/${{ inputs.dist-dir }}"
Expand Down Expand Up @@ -158,16 +161,17 @@ jobs:
run: |
pip install -v -r "${{ github.workspace }}/test/requirements.txt"
- name: Use Cached Test Files
if: ${{ inputs.test-suite }}
id: cache-test-files
uses: actions/cache@v4
- name: Restore Cached Test Files
if: ${{ inputs.test-suite && inputs.testfiles-cache-key }}
id: restore-test-files
uses: actions/cache/restore@v4
with:
path: "${{ github.workspace }}/testfiles"
key: "testfiles"
key: ${{ inputs.testfiles-cache-key }}
enableCrossOsArchive: true

- name: Download Test Files
if: ${{ inputs.test-suite && steps.cache-test-files.outputs.cache-hit != 'true' }}
if: ${{ inputs.test-suite && steps.restore-test-files.outputs.cache-hit != 'true' }}
uses: actions/checkout@v4
with:
repository: "${{ secrets.TESTFILE_REPO }}"
Expand All @@ -176,7 +180,7 @@ jobs:
persist-credentials: false

- name: Prepare Test Files
if: ${{ inputs.test-suite && steps.cache-test-files.outputs.cache-hit != 'true' }}
if: ${{ inputs.test-suite && steps.restore-test-files.outputs.cache-hit != 'true' }}
working-directory: "${{ github.workspace }}/testfiles"
shell: bash
run: 7z x "${{ secrets.DSI_NAND_ARCHIVE }}"
Expand Down

0 comments on commit 796a82b

Please sign in to comment.