-
-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Solve Duplicate Code in GitHub Action Workflows (#2589)
* Move LFS steps to separate action * Rename action.yml and use bash shell in each step * Test new environment setup * Specify Environment Name * Test cache environment key * Modify syntax * Modify update refdata too * Use new environment creation method in build docs and pre release workflow
- Loading branch information
1 parent
215ad61
commit 9b75d3d
Showing
5 changed files
with
159 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: 'Setup LFS' | ||
description: 'Pull LFS repositories and caches them' | ||
|
||
inputs: | ||
refdata-repo: | ||
description: "tardis refdata repository" | ||
required: false | ||
default: 'tardis-sn/tardis-refdata' | ||
regression-data-repo: | ||
description: "tardis regression data repository" | ||
required: false | ||
default: 'tardis-sn/tardis-regression-data' | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Clone Refdata Repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ inputs.refdata-repo }} | ||
path: tardis-refdata | ||
lfs: false | ||
|
||
- name: Create LFS file list | ||
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | ||
working-directory: tardis-refdata | ||
shell: bash | ||
|
||
- name: Restore LFS cache | ||
uses: actions/cache/restore@v3 | ||
id: lfs-cache-refdata | ||
with: | ||
path: tardis-refdata/.git/lfs | ||
key: ${{ runner.os }}-lfs-${{ hashFiles('tardis-refdata/.lfs-assets-id') }}-v1 | ||
|
||
- name: Git LFS Pull | ||
run: git lfs pull | ||
working-directory: tardis-refdata | ||
if: steps.lfs-cache-refdata.outputs.cache-hit != 'true' | ||
shell: bash | ||
|
||
- name: Git LFS Checkout | ||
run: git lfs checkout | ||
working-directory: tardis-refdata | ||
if: steps.lfs-cache-refdata.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-refdata.outputs.cache-hit != 'true' && always() || false }} | ||
uses: actions/cache/save@v3 | ||
id: lfs-cache-refdata-save | ||
with: | ||
path: tardis-refdata/.git/lfs | ||
key: ${{ runner.os }}-lfs-${{ hashFiles('tardis-refdata/.lfs-assets-id') }}-v1 | ||
|
||
- name: Clone tardis-sn/tardis-regression-data | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ inputs.regression-data-repo }} | ||
path: tardis-regression-data | ||
|
||
- name: Create LFS file list | ||
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | ||
working-directory: tardis-regression-data | ||
shell: bash | ||
|
||
- name: Restore LFS cache | ||
uses: actions/cache/restore@v3 | ||
id: lfs-cache-regression-data | ||
with: | ||
path: tardis-regression-data/.git/lfs | ||
key: ${{ runner.os }}-lfs-${{ hashFiles('tardis-regression-data/.lfs-assets-id') }}-v1 | ||
|
||
- name: Git LFS Pull | ||
run: git lfs pull | ||
working-directory: tardis-regression-data | ||
if: steps.lfs-cache-regression-data.outputs.cache-hit != 'true' | ||
shell: bash | ||
|
||
- name: Git LFS Checkout | ||
run: git lfs checkout | ||
working-directory: tardis-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' && always() || false }} | ||
uses: actions/cache/save@v3 | ||
id: lfs-cache-regression-data-save | ||
with: | ||
path: tardis-regression-data/.git/lfs | ||
key: ${{ runner.os }}-lfs-${{ hashFiles('tardis-regression-data/.lfs-assets-id') }}-v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.