Skip to content

Commit

Permalink
Add a LFS data dedicated job (#850)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwestphal authored Jun 7, 2023
1 parent cf51f90 commit 4b93b63
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 25 deletions.
26 changes: 25 additions & 1 deletion .github/actions/lfs-copy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ inputs:
lfs_sha:
description: 'LFS sha to recover'
required: true
workflow_label:
description: 'Whether this action produce/consume LFS data'
default: 'producer'

runs:
using: "composite"
steps:
Expand All @@ -16,13 +20,33 @@ runs:
key: lfs-data-${{inputs.lfs_sha}}-1

- name: Checkout LFS data
if: steps.cache-lfs.outputs.cache-hit != 'true'
if: |
steps.cache-lfs.outputs.cache-hit != 'true' &&
inputs.workflow_label == 'producer'
uses: actions/checkout@v3
with:
path: 'lfs_data'
fetch-depth: 0
lfs: true

- name: Upload LFS artifact
if: |
steps.cache-lfs.outputs.cache-hit != 'true' &&
inputs.workflow_label == 'producer'
uses: actions/upload-artifact@master
with:
name: lfs-data
path: lfs_data

- name: Download LFS artifact
if: |
steps.cache-lfs.outputs.cache-hit != 'true' &&
inputs.workflow_label == 'consumer'
uses: actions/download-artifact@master
with:
name: lfs-data
path: lfs_data

- name: Setup LFS data
working-directory: ${{github.workspace}}
shell: bash
Expand Down
66 changes: 42 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,42 @@ concurrency:

jobs:

#----------------------------------------------------------------------------
# Cache LFS: Checkout LFS data and update the cache to limit LFS bandwidth
#----------------------------------------------------------------------------

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@v3
with:
path: 'source'
fetch-depth: 0
lfs: false

- name: Set LFS env var
working-directory: ${{github.workspace}}/source
id: lfs_sha_recover
shell: bash
run: echo "lfs_sha=$(git log -n 1 --pretty=format:%H -- testing/data/ testing/baselines/ examples/**/*/data/ examples/**/*/baselines/ .github/baselines/)" >> $GITHUB_OUTPUT

- name: Copy LFS Data
uses: ./source/.github/actions/lfs-copy
with:
lfs_sha: ${{ steps.lfs_sha_recover.outputs.lfs_sha }}
workflow_label: 'producer'

#----------------------------------------------------------------------------
# MAIN CI: Build and test with a cross-platform, cross-vtk build matrix
#----------------------------------------------------------------------------
ci:
if: github.event.pull_request.draft == false
needs: cache_lfs

strategy:
fail-fast: false
Expand Down Expand Up @@ -58,15 +89,11 @@ jobs:
fetch-depth: 0
lfs: false

- name: Set LFS env var
working-directory: ${{github.workspace}}/source
shell: bash
run: echo "LFS_SHA=$(git log -n 1 --pretty=format:%H -- testing/data/ testing/baselines/ examples/**/*/data/ examples/**/*/baselines/ .github/baselines/)" >> $GITHUB_ENV

- name: Copy LFS Data
uses: ./source/.github/actions/lfs-copy
with:
lfs_sha: ${{env.LFS_SHA}}
lfs_sha: ${{ needs.cache_lfs.outputs.lfs_sha}}
workflow_label: 'consumer'

- name: Dependencies Dir
working-directory: ${{github.workspace}}
Expand Down Expand Up @@ -288,6 +315,7 @@ jobs:
# Coverage: Build and test on linux with last VTK with coverage option
#----------------------------------------------------------------------------
coverage:
needs: cache_lfs
if: github.event.pull_request.draft == false

runs-on: ubuntu-latest
Expand All @@ -307,15 +335,11 @@ jobs:
fetch-depth: 0
lfs: false

- name: Set LFS env var
working-directory: ${{github.workspace}}/source
shell: bash
run: echo "LFS_SHA=$(git log -n 1 --pretty=format:%H -- testing/data/ testing/baselines/)" >> $GITHUB_ENV

- name: Copy LFS Data
uses: ./source/.github/actions/lfs-copy
with:
lfs_sha: ${{env.LFS_SHA}}
lfs_sha: ${{ needs.cache_lfs.outputs.lfs_sha}}
workflow_label: 'consumer'

- name: Dependencies Dir
working-directory: ${{github.workspace}}
Expand Down Expand Up @@ -392,6 +416,7 @@ jobs:
# "memory" returns false positives in VTK:
# https://stackoverflow.com/questions/60097307/memory-sanitizer-reports-use-of-uninitialized-value-in-global-object-constructio
sanitizer:
needs: cache_lfs
if: github.event.pull_request.draft == false

strategy:
Expand All @@ -416,15 +441,11 @@ jobs:
fetch-depth: 0
lfs: false

- name: Set LFS env var
working-directory: ${{github.workspace}}/source
shell: bash
run: echo "LFS_SHA=$(git log -n 1 --pretty=format:%H -- testing/data/ testing/baselines/)" >> $GITHUB_ENV

- name: Copy LFS Data
uses: ./source/.github/actions/lfs-copy
with:
lfs_sha: ${{env.LFS_SHA}}
lfs_sha: ${{ needs.cache_lfs.outputs.lfs_sha}}
workflow_label: 'consumer'

- name: Dependencies Dir
working-directory: ${{github.workspace}}
Expand Down Expand Up @@ -491,6 +512,7 @@ jobs:
# static-analysis: Run static analysis on linux
#----------------------------------------------------------------------------
static-analysis:
needs: cache_lfs
if: github.event.pull_request.draft == false

strategy:
Expand All @@ -512,15 +534,11 @@ jobs:
fetch-depth: 0
lfs: false

- name: Set LFS env var
working-directory: ${{github.workspace}}/source
shell: bash
run: echo "LFS_SHA=$(git log -n 1 --pretty=format:%H -- testing/data/ testing/baselines/)" >> $GITHUB_ENV

- name: Copy LFS Data
uses: ./source/.github/actions/lfs-copy
with:
lfs_sha: ${{env.LFS_SHA}}
lfs_sha: ${{ needs.cache_lfs.outputs.lfs_sha}}
workflow_label: 'consumer'

- name: Dependencies Dir
working-directory: ${{github.workspace}}
Expand Down

0 comments on commit 4b93b63

Please sign in to comment.