Skip to content

Commit

Permalink
Set other workflows to re-use usmapdata workflow scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
pdil committed Mar 31, 2024
1 parent a9c01f8 commit 0deb97b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 119 deletions.
45 changes: 4 additions & 41 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -1,50 +1,13 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples

name: check

on:
push:
branches: master
pull_request:
branches: master

name: check

jobs:
check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {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 }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- 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
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
uses: pdil/usmapdata/.github/workflows/check.yaml@master
secrets: inherit
39 changes: 4 additions & 35 deletions .github/workflows/lintr.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,16 @@
# lintr provides static code analysis for R.
# It checks for adherence to a given style,
# identifying syntax errors and possible semantic issues,
# then reports them to you so you can take action.
# More details at https://lintr.r-lib.org/

name: lintr

on:
push:
branches: [ "master" ]
branches: master
pull_request:
branches: [ "master" ]
branches: master

permissions:
contents: read

jobs:
lintr:
name: Run lintr scanning
runs-on: ubuntu-latest
permissions:
contents: read # for checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup R
uses: r-lib/actions/setup-r@v2

- name: Setup lintr
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: lintr

- name: Run lintr
run: lintr::sarif_output(lintr::lint_dir("."), "lintr-results.sarif")
shell: Rscript {0}
continue-on-error: true

- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: lintr-results.sarif
wait-for-processing: true
uses: pdil/usmapdata/.github/workflows/lintr.yaml@master
secrets: inherit
49 changes: 6 additions & 43 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,50 +1,13 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples

name: test-coverage

on:
push:
branches: [main, master]
branches: master
pull_request:
branches: [main, master]

name: test-coverage
branches: master

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
needs: coverage

- name: Test coverage
run: |
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
shell: Rscript {0}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
uses: pdil/usmapdata/.github/workflows/test-coverage.yaml@master
secrets: inherit

0 comments on commit 0deb97b

Please sign in to comment.