Skip to content

Commit

Permalink
Add atom data sparse flag to cache atom data
Browse files Browse the repository at this point in the history
  • Loading branch information
atharva-2001 committed Jan 23, 2025
1 parent 85a9377 commit cc8d872
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
18 changes: 15 additions & 3 deletions .github/actions/setup_lfs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ inputs:
description: "tardis regression data repository"
required: false
default: "tardis-sn/tardis-regression-data"
atom-data-sparse:
description: "Only download atom data files"
required: false
default: 'false'

runs:
using: "composite"
Expand All @@ -16,9 +20,17 @@ runs:
with:
repository: ${{ inputs.regression-data-repo }}
path: tardis-regression-data
sparse-checkout: ${{ inputs.atom-data-sparse == 'true' && 'atom_data/kurucz_cd23_chianti_H_He.h5' || '' }}

- name: Create LFS file list
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
run: |
if [ "${{ inputs.atom-data-sparse }}" == "true" ]; then
echo "Using atom data sparse checkout"
echo "atom_data/kurucz_cd23_chianti_H_He.h5" > .lfs-files-list
else
echo "Using full repository checkout"
git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-files-list
fi
working-directory: tardis-regression-data
shell: bash

Expand All @@ -27,7 +39,7 @@ runs:
id: lfs-cache-regression-data
with:
path: tardis-regression-data/.git/lfs
key: lfs-${{ hashFiles('tardis-regression-data/.lfs-assets-id') }}-v1
key: ${{ inputs.atom-data-sparse == 'true' && 'lfs-atom-' || 'lfs-full-' }}${{ hashFiles('tardis-regression-data/.lfs-files-list') }}-v1

- name: Git LFS Pull
run: git lfs pull
Expand All @@ -49,4 +61,4 @@ runs:
id: lfs-cache-regression-data-save
with:
path: tardis-regression-data/.git/lfs
key: lfs-${{ hashFiles('tardis-regression-data/.lfs-assets-id') }}-v1
key: ${{ inputs.atom-data-sparse == 'true' && 'lfs-atom-' || 'lfs-full-' }}${{ hashFiles('tardis-regression-data/.lfs-files-list') }}-v1
9 changes: 3 additions & 6 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,10 @@ jobs:
run: git fetch origin master:master
if: github.event_name == 'pull_request_target'

- uses: actions/checkout@v4
- name: Setup LFS
uses: ./.github/actions/setup_lfs
with:
repository: tardis-sn/tardis-regression-data
path: tardis-regression-data
lfs: true
sparse-checkout: |
atom_data/kurucz_cd23_chianti_H_He.h5
atom-data-sparse: true

- name: Setup Mamba
uses: mamba-org/setup-micromamba@v1
Expand Down

0 comments on commit cc8d872

Please sign in to comment.