Skip to content

Commit

Permalink
Fix download action
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanwweber committed Jul 18, 2024
1 parent 794dc61 commit 8725750
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions .github/actions/download-cantera-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,41 @@ inputs:
outputs:
test-root:
description: The root folder where the tests are located
value: ${{ runner.temp }}
value: ${{ steps.sanitize.outputs.DESTINATION_PATH }}

runs:
using: "composite"
steps:
- name: Sanitize the destination path
id: sanitize
run: |
$DESTINATION_PATH = "${{ steps.sanitize.outputs.DESTINATION_PATH }}" -replace "\\", "/"
echo "DESTINATION_PATH=$DESTINATION_PATH" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
if: runner.os == 'Windows'
shell: pwsh
- name: Sanitize the destination path
id: sanitize
run: echo "DESTINATION_PATH=${{ steps.sanitize.outputs.DESTINATION_PATH }}" >> $GITHUB_OUTPUT
shell: bash
if: runner.os != 'Windows'
- name: Restore cached the test files
uses: actions/cache/restore@v4
id: restore-cache
with:
path: ${{ runner.temp }}/test
path: ${{ steps.sanitize.outputs.DESTINATION_PATH }}/test
# Bump the integer to bust the cache
key: ${{ inputs.incoming-sha }}-0
key: ${{ inputs.incoming-sha }}-${{ runner.os }}-0
- name: Download and unpack the tarball
if: steps.restore-cache.outputs.cache-hit != 'true'
run: |
curl -fsSL "https://github.com/cantera/cantera/archive/${{ inputs.incoming-sha }}.tar.gz" -o ${{ runner.temp }}/cantera.tar.gz
tar -xzf ${{ runner.temp }}/cantera.tar.gz --strip-components=1 -C ${{ runner.temp }} "cantera-${{ inputs.incoming-sha }}/test"
rm ${{ runner.temp }}/cantera.tar.gz
curl -fsSL "https://github.com/cantera/cantera/archive/${{ inputs.incoming-sha }}.tar.gz" -o ${{ steps.sanitize.outputs.DESTINATION_PATH }}/cantera.tar.gz
tar -xzf ${{ steps.sanitize.outputs.DESTINATION_PATH }}/cantera.tar.gz --strip-components=1 -C ${{ steps.sanitize.outputs.DESTINATION_PATH }} "cantera-${{ inputs.incoming-sha }}/test"
rm ${{ steps.sanitize.outputs.DESTINATION_PATH }}/cantera.tar.gz
shell: bash
- name: Save the test file cache
uses: actions/cache/save@v4
if: always() && steps.restore-cache.outputs.cache-hit != true
id: save-cache
with:
path: ${{ runner.temp }}/test
path: ${{ steps.sanitize.outputs.DESTINATION_PATH }}/test
key: ${{ steps.restore-cache.outputs.cache-primary-key }}

0 comments on commit 8725750

Please sign in to comment.