Skip to content

Commit

Permalink
Switch back to temp dir
Browse files Browse the repository at this point in the history
  • Loading branch information
dfsnow committed May 3, 2024
1 parent 17aa118 commit 1ef09bd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
25 changes: 12 additions & 13 deletions .github/actions/prepare-ptaxsim/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +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_DB_DIR:
description: "PTAXSIM database directory on runner"
value: ${{ steps.set_db_dir.outputs.PTAXSIM_DB_DIR }}
PTAXSIM_VERSION:
description: "PTAXSIM database version"
value: ${{ steps.version_db.outputs.PTAXSIM_VERSION }}
Expand All @@ -21,12 +21,11 @@ runs:
- name: Checkout
uses: actions/checkout@v4

- name: Set database path
id: set_db_path
- name: Set database directory
id: set_db_dir
run: |
echo "PTAXSIM_DB_PATH_COMP=$RUNNER_TEMP/ptaxsim.db.bz2" >> $GITHUB_ENV
echo "PTAXSIM_DB_PATH=$RUNNER_TEMP/ptaxsim.db" >> $GITHUB_ENV
echo "PTAXSIM_DB_PATH=$RUNNER_TEMP/ptaxsim.db" >> $GITHUB_OUTPUT
echo "PTAXSIM_DB_DIR=$RUNNER_TEMP" >> $GITHUB_ENV
echo "PTAXSIM_DB_DIR=$RUNNER_TEMP" >> $GITHUB_OUTPUT
shell: bash

- name: Get database version
Expand All @@ -41,7 +40,7 @@ runs:
uses: actions/cache@v3.3.2
id: cache_db
with:
path: ${{ env.PTAXSIM_DB_PATH_COMP }}
path: ${{ env.PTAXSIM_DB_DIR }}/ptaxsim.db.bz2
key: ${{ format('{0}-{1}', env.PTAXSIM_VERSION, hashFiles('DESCRIPTION')) }}
enableCrossOsArchive: true

Expand All @@ -56,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 ${{ env.PTAXSIM_DB_PATH_COMP }} --quiet
aws s3 cp ${{ inputs.PTAXSIM_DB_BASE_URI }}/ptaxsim-${{ env.PTAXSIM_VERSION }}.db.bz2 ${{ env.PTAXSIM_DB_DIR }}/ptaxsim.db.bz2 --quiet
shell: bash

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

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

- name: Unpack database (Windows)
if: runner.os == 'Windows'
run: |
7z x ${{ env.PTAXSIM_DB_PATH_COMP }}
7z x ${{ env.PTAXSIM_DB_DIR }}\ptaxsim.db.bz2
shell: cmd
6 changes: 5 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
env:
PTAXSIM_DB_PATH: ${{ github.workspace }}/ptaxsim.db
R_KEEP_PKG_SOURCE: yes

# Required for OIDC access to S3
Expand Down Expand Up @@ -48,10 +47,15 @@ jobs:
needs: check

- 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_DIR }}/ptaxsim.db" >> $GITHUB_ENV
shell: bash

- name: Check R package
uses: r-lib/actions/check-r-package@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
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
run: echo "PTAXSIM_DB_PATH=${{ steps.prep_ptaxsim_db.outputs.PTAXSIM_DB_DIR }}/ptaxsim.db" >> $GITHUB_ENV
shell: bash

- name: Test coverage
Expand Down

0 comments on commit 1ef09bd

Please sign in to comment.