From 321c6d4dc8ec69752b72aa97c1405027a8c8aff9 Mon Sep 17 00:00:00 2001 From: Atharva Arya Date: Fri, 27 Sep 2024 18:28:55 +0530 Subject: [PATCH] Update test pipeline with carsus regression data --- .github/actions/setup_lfs/action.yml | 52 ++++++++++++++++++++++++++++ .github/workflows/tests.yml | 5 ++- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .github/actions/setup_lfs/action.yml diff --git a/.github/actions/setup_lfs/action.yml b/.github/actions/setup_lfs/action.yml new file mode 100644 index 000000000..9689b0604 --- /dev/null +++ b/.github/actions/setup_lfs/action.yml @@ -0,0 +1,52 @@ +name: "Setup LFS" +description: "Pull LFS repositories and caches them" + + +inputs: + regression-data-repo: + description: "carsus regression data repository" + required: false + default: "tardis-sn/carsus-regression-data" + +runs: + using: "composite" + steps: + - name: Clone tardis-sn/carsus-regression-data + uses: actions/checkout@v4 + with: + repository: ${{ inputs.regression-data-repo }} + path: carsus-regression-data + + - name: Create LFS file list + run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id + working-directory: carsus-regression-data + shell: bash + + - name: Restore LFS cache + uses: actions/cache/restore@v4 + id: lfs-cache-regression-data + with: + path: carsus-regression-data/.git/lfs + key: ${{ runner.os }}-lfs-${{ hashFiles('carsus-regression-data/.lfs-assets-id') }}-v1 + + - name: Git LFS Pull + run: git lfs pull + working-directory: carsus-regression-data + if: steps.lfs-cache-regression-data.outputs.cache-hit != 'true' + shell: bash + + - name: Git LFS Checkout + run: git lfs checkout + working-directory: carsus-regression-data + if: steps.lfs-cache-regression-data.outputs.cache-hit == 'true' + shell: bash + + - name: Save LFS cache if not found + # uses fake ternary + # for reference: https://github.com/orgs/community/discussions/26738#discussioncomment-3253176 + if: ${{ steps.lfs-cache-regression-data.outputs.cache-hit != 'true' && !contains(github.ref, 'merge') && always() || false }} + uses: actions/cache/save@v4 + id: lfs-cache-regression-data-save + with: + path: carsus-regression-data/.git/lfs + key: ${{ runner.os }}-lfs-${{ hashFiles('carsus-regression-data/.lfs-assets-id') }}-v1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0b73eeccc..538a0bdf0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,7 +27,7 @@ env: CHIANTI_DL_URL: https://download.chiantidatabase.org CHIANTI_DB_VER: CHIANTI_v9.0.1_database.tar.gz PYTEST_FLAGS: --remote-data --refdata=carsus-refdata - --cov=carsus --cov-report=xml --cov-report=html + --cov=carsus --cov-report=xml --cov-report=html --carsus-regression-data=${{ github.workspace }}/carsus-regression-data NBCONVERT_CMD: jupyter nbconvert --execute --ExecutePreprocessor.timeout=600 --to html CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} CMFGEN_DL_URL: http://kookaburra.phyast.pitt.edu/hillier/cmfgen_files @@ -51,6 +51,9 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Setup LFS + uses: ./.github/actions/setup_lfs + - name: Clone tardis-sn/carsus-refdata uses: actions/checkout@v4 with: