diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 94b6238..e0d023a 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,7 +1,4 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples -# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: - workflow_dispatch: pull_request: push: branches: [main, master] @@ -16,9 +13,7 @@ jobs: R-CMD-check: needs: prepare-ptaxsim runs-on: ${{ matrix.config.os }} - name: ${{ matrix.config.os }} (${{ matrix.config.r }}) - strategy: fail-fast: false matrix: @@ -28,24 +23,25 @@ jobs: - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - {os: ubuntu-latest, r: 'release'} - {os: ubuntu-latest, r: 'oldrel-1'} - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} PTAXSIM_DB_PATH: ${{ github.workspace }}/ptaxsim.db R_KEEP_PKG_SOURCE: yes - steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 - - uses: r-lib/actions/setup-pandoc@v2 + - name: Setup pandoc + uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-r@v2 + - name: Setup R + uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v2 + - name: Setup R dependencies + uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: any::rcmdcheck needs: check @@ -77,6 +73,7 @@ jobs: run: 7z x ptaxsim.db.bz2 shell: cmd - - uses: r-lib/actions/check-r-package@v2 + - name: Check R package + uses: r-lib/actions/check-r-package@v2 with: upload-snapshots: true diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 0a0a503..507fedb 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,5 +1,3 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples -# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: pull_request: push: @@ -10,16 +8,17 @@ name: lint jobs: lint: runs-on: ubuntu-latest - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 - - uses: r-lib/actions/setup-r@v2 + - name: Setup R + uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v2 + - name: Setup R dependencies + uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: any::lintr, local::. needs: lint diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index e9dd857..59ff4be 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -1,5 +1,3 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples -# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: workflow_dispatch: pull_request: @@ -14,32 +12,25 @@ jobs: uses: ./.github/workflows/prepare-ptaxsim.yaml secrets: inherit - pkgdown: + build-pkgdown-site: needs: prepare-ptaxsim runs-on: ubuntu-latest env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} PTAXSIM_DB_PATH: ${{ github.workspace }}/ptaxsim.db - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - concurrency: - group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} - cancel-in-progress: false - permissions: - contents: read - pages: write - id-token: write steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 - - uses: r-lib/actions/setup-pandoc@v2 + - name: Setup pandoc + uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-r@v2 + - name: Setup R + uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v2 + - name: Setup R dependencies + uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: any::pkgdown, local::. needs: website @@ -57,7 +48,7 @@ jobs: pbzip2 -d ptaxsim.db.bz2 shell: bash - - name: Build site + - name: Build pkgdown site run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) shell: Rscript {0} @@ -69,6 +60,17 @@ jobs: with: path: 'docs' + deploy: + if: contains(fromJSON('["main", "master"]'), github.ref_name) && github.event_name != 'pull_request' + needs: build-pkgdown-site + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + permissions: + pages: write + id-token: write + steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v2 diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index bf1ad4d..1f8648c 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -11,19 +11,28 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: + - name: Checkout + uses: actions/checkout@v3 - # Replacement for pre-commit/action - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 + - name: Setup python + uses: actions/setup-python@v4 with: python-version: 3.x - - run: python -m pip install pre-commit + - name: Install pre-commit + run: python -m pip install pre-commit shell: bash - - run: python -m pip freeze --local + - name: Freeze dependencies + run: python -m pip freeze --local shell: bash - - run: pre-commit run --show-diff-on-failure --color=always --all-files + - name: Cache pre-commit environment + uses: actions/cache@v3 + with: + path: ~/.cache/pre-commit + key: pre-commit-3-${{ env.pythonLocation }}-${{ hashFiles('.pre-commit-config.yaml') }} + + - name: Run pre-commit + run: pre-commit run --show-diff-on-failure --color=always --all-files shell: bash diff --git a/.github/workflows/prepare-ptaxsim.yaml b/.github/workflows/prepare-ptaxsim.yaml index e23c66b..527085b 100644 --- a/.github/workflows/prepare-ptaxsim.yaml +++ b/.github/workflows/prepare-ptaxsim.yaml @@ -23,32 +23,33 @@ jobs: output1: ${{ steps.version_db.outputs.PTAXSIM_VERSION }} steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 - - id: version_db - name: Get database version + - name: Get database version + id: version_db run: | echo "PTAXSIM_VERSION=$(grep -Po "(?<=Wants_DB_Version: )[0-9]*\.[0-9]*\.[0-9]*" ${{ github.workspace }}/DESCRIPTION)" >> $GITHUB_ENV echo "PTAXSIM_VERSION=$(grep -Po "(?<=Wants_DB_Version: )[0-9]*\.[0-9]*\.[0-9]*" ${{ github.workspace }}/DESCRIPTION)" >> $GITHUB_OUTPUT - - id: check_db - name: Check database cache + - name: Check database cache uses: actions/cache/restore@v3 + id: check_db with: path: ptaxsim.db.bz2 key: ${{ format('{0}-{1}', env.PTAXSIM_VERSION, hashFiles('DESCRIPTION')) }} lookup-only: true - - id: fetch_db - name: Fetch database file + - name: Fetch database file + id: fetch_db if: steps.check_db.outputs.cache-hit != 'true' run: | aws s3 cp ${{ inputs.PTAXSIM_DB_BASE_URL }}/ptaxsim-${{ env.PTAXSIM_VERSION }}.db.bz2 ${{ github.workspace }}/ptaxsim.db.bz2 shell: bash - - id: save_db - name: Save database cache + - name: Save database cache uses: actions/cache/save@v3 + id: save_db if: steps.check_db.outputs.cache-hit != 'true' with: path: ptaxsim.db.bz2 diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index d5ec47c..a240391 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -1,7 +1,4 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples -# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: - workflow_dispatch: pull_request: push: branches: [main, master] @@ -17,17 +14,18 @@ jobs: needs: prepare-ptaxsim runs-on: ubuntu-latest env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} PTAXSIM_DB_PATH: ${{ github.workspace }}/ptaxsim.db - steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 - - uses: r-lib/actions/setup-r@v2 + - name: Setup R + uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v2 + - name: Setup R dependencies + uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: any::covr needs: coverage