Skip to content

Commit

Permalink
Improve LFS usage in CI (#197)
Browse files Browse the repository at this point in the history
- Use LFS data cache
 - Disable LFS during build
  • Loading branch information
mwestphal authored Sep 5, 2024
1 parent d49fff3 commit 0af9634
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 3 deletions.
20 changes: 20 additions & 0 deletions .github/actions/f3d-superbuild/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,26 @@ inputs:
description: 'CPU architecture to build for'
required: false
default: 'x86_64'
lfs_sha:
description: 'Cache LFS sha'
required: true

runs:
using: "composite"
steps:

- name: Check required inputs
shell: bash
run: |
[[ "${{ inputs.lfs_sha }}" ]] || { echo "lfs_sha input is empty" ; exit 1; }
- name: Recover LFS Data
uses: f3d-app/lfs-data-cache-action@v1
with:
type: 'consumer'
lfs_sha: ${{inputs.lfs_sha}}
cache_postfix: cache-0

- name: Install ninja Windows
if: runner.os == 'Windows'
shell: cmd
Expand Down Expand Up @@ -85,6 +100,11 @@ runs:
${{ runner.os == 'Windows' && '-G Ninja' || null }}
${{ runner.os == 'macOS' && '-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15' || null }}
- name: Disable LFS during the build
working-directory: ${{github.workspace}}
shell: bash
run: echo GIT_LFS_SKIP_SMUDGE=1 >> $GITHUB_ENV

# Rerun the build as ispc can sometimes segfault on Windows
- name: Build
working-directory: ${{github.workspace}}/build
Expand Down
33 changes: 30 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,29 @@ concurrency:
cancel-in-progress: true

jobs:

cache_lfs:
runs-on: ubuntu-latest
name: Update LFS data cache
outputs:
lfs_sha: ${{ steps.lfs_sha_recover.outputs.lfs_sha }}
steps:

- name: Checkout
uses: actions/checkout@v4
with:
path: 'source'
fetch-depth: 1
lfs: false

- name: Cache LFS Data
id: lfs_sha_recover
uses: f3d-app/lfs-data-cache-action@v1
with:
cache_postfix: cache-0

windows:
needs: cache_lfs
strategy:
fail-fast: false
matrix:
Expand All @@ -26,15 +48,17 @@ jobs:
with:
path: 'source'
submodules: true
lfs: true
lfs: false

- name: Build and package F3D
uses: ./source/.github/actions/f3d-superbuild/
with:
f3d_version: origin/master
raytracing_label: ${{matrix.raytracing_label}}
lfs_sha: ${{ needs.cache_lfs.outputs.lfs_sha}}

linux:
needs: cache_lfs
strategy:
fail-fast: false
matrix:
Expand All @@ -54,16 +78,18 @@ jobs:
with:
path: 'source'
submodules: true
lfs: true
lfs: false

- name: Build and package F3D
uses: ./source/.github/actions/f3d-superbuild/
with:
f3d_version: origin/master
raytracing_label: ${{matrix.raytracing_label}}
egl_label: ${{matrix.egl_label}}
lfs_sha: ${{ needs.cache_lfs.outputs.lfs_sha}}

macos:
needs: cache_lfs
strategy:
fail-fast: false
matrix:
Expand All @@ -84,14 +110,15 @@ jobs:
with:
path: 'source'
submodules: true
lfs: true
lfs: false

- name: Build and package F3D
uses: ./source/.github/actions/f3d-superbuild/
with:
f3d_version: origin/master
raytracing_label: ${{matrix.raytracing_label}}
cpu: ${{matrix.cpu}}
lfs_sha: ${{ needs.cache_lfs.outputs.lfs_sha}}

python_wheels:
strategy:
Expand Down

0 comments on commit 0af9634

Please sign in to comment.