Skip to content

Commit

Permalink
Set PTAXSIM_DB_PATH explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
dfsnow committed May 3, 2024
1 parent 7187651 commit 07ee0d0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
21 changes: 15 additions & 6 deletions .github/actions/prepare-ptaxsim/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ inputs:
ASSUMED_ROLE:
description: AWS role used for S3 actions
outputs:
PTAXSIM_DB_PATH:
description: "PTAXSIM database path on runner"
value: ${{ steps.set_db_path.outputs.PTAXSIM_DB_PATH }}
PTAXSIM_VERSION:
description: "PTAXSIM database version"
value: ${{ steps.version_db.outputs.PTAXSIM_VERSION }}
Expand All @@ -18,11 +21,17 @@ runs:
- name: Checkout
uses: actions/checkout@v4

- name: Set database path
id: set_db_path
run: |
echo "PTAXSIM_DB_PATH=$RUNNER_TEMP" >> $GITHUB_ENV
echo "PTAXSIM_DB_PATH=$RUNNER_TEMP" >> $GITHUB_OUTPUT
shell: bash

- name: Get database version
id: version_db
run: |
DESCRIPTION_PATH=$(echo "${{ github.workspace }}/DESCRIPTION" | sed 's/\\/\//g')
echo "PTAXSIM_DB_PATH=$RUNNER_TEMP" >> $GITHUB_ENV
echo "PTAXSIM_VERSION=$(sed -n 's/.*Wants_DB_Version: \([0-9]*\.[0-9]*\.[0-9]\).*/\1/p' $DESCRIPTION_PATH)" >> $GITHUB_ENV
echo "PTAXSIM_VERSION=${{ env.PTAXSIM_VERSION }}" >> $GITHUB_OUTPUT
shell: bash
Expand All @@ -31,7 +40,7 @@ runs:
uses: actions/[email protected]
id: cache_db
with:
path: $RUNNER_TEMP/ptaxsim.db.bz2
path: ${{ env.PTAXSIM_DB_PATH}}/ptaxsim.db.bz2
key: ${{ format('{0}-{1}', env.PTAXSIM_VERSION, hashFiles('DESCRIPTION')) }}
enableCrossOsArchive: true

Expand All @@ -46,25 +55,25 @@ runs:
id: fetch_db
if: steps.cache_db.outputs.cache-hit != 'true'
run: |
aws s3 cp ${{ inputs.PTAXSIM_DB_BASE_URI }}/ptaxsim-${{ env.PTAXSIM_VERSION }}.db.bz2 $RUNNER_TEMP/ptaxsim.db.bz2 --quiet
aws s3 cp ${{ inputs.PTAXSIM_DB_BASE_URI }}/ptaxsim-${{ env.PTAXSIM_VERSION }}.db.bz2 ${{ env.PTAXSIM_DB_PATH }}/ptaxsim.db.bz2 --quiet
shell: bash

- name: Unpack database (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get install -y pbzip2
pbzip2 -dk $RUNNER_TEMP/ptaxsim.db.bz2
pbzip2 -dk ${{ env.PTAXSIM_DB_PATH }}/ptaxsim.db.bz2
shell: bash

- name: Unpack database (macOS)
if: runner.os == 'macOS'
run: |
brew install pbzip2
pbzip2 -dk $RUNNER_TEMP/ptaxsim.db.bz2
pbzip2 -dk ${{ env.PTAXSIM_DB_PATH }}/ptaxsim.db.bz2
shell: bash

- name: Unpack database (Windows)
if: runner.os == 'Windows'
run: |
7z x $RUNNER_TEMP\ptaxsim.db.bz2
7z x ${{ env.PTAXSIM_DB_PATH }}\ptaxsim.db.bz2
shell: cmd
5 changes: 5 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,15 @@ jobs:
needs: website

- name: Prepare PTAXSIM database
id: prep_ptaxsim_db
uses: ./.github/actions/prepare-ptaxsim
with:
ASSUMED_ROLE: ${{ secrets.AWS_IAM_ROLE_TO_ASSUME_ARN }}

- name: Set PTAXSIM database path
run: echo "PTAXSIM_DB_PATH=${{ steps.prep_ptaxsim_db.outputs.PTAXSIM_DB_PATH }}" >> $GITHUB_ENV
shell: bash

- name: Build pkgdown site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ jobs:
needs: coverage

- name: Prepare PTAXSIM database
id: prep_ptaxsim_db
uses: ./.github/actions/prepare-ptaxsim
with:
ASSUMED_ROLE: ${{ secrets.AWS_IAM_ROLE_TO_ASSUME_ARN }}

- name: Set PTAXSIM database path
run: echo "PTAXSIM_DB_PATH=${{ steps.prep_ptaxsim_db.outputs.PTAXSIM_DB_PATH }}" >> $GITHUB_ENV
shell: bash

- name: Test coverage
run: |
covr::codecov(
Expand Down

0 comments on commit 07ee0d0

Please sign in to comment.