Skip to content

Pin actions/upload-artifact to b4b15b8 (#116) #283

Pin actions/upload-artifact to b4b15b8 (#116)

Pin actions/upload-artifact to b4b15b8 (#116) #283

# 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:
push:
branches: [main, master, l2d]
pull_request:
branches: [main, master, l2d]
workflow_dispatch:
name: test-coverage
jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
OS_VERSION: 1
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: r-lib/actions/setup-r@e6be4b3706e0f39bc7a4cf4496a5f2c4cb840040 # v2
with:
use-public-rspm: true
- name: "Set up pandoc"
uses: r-lib/actions/setup-pandoc@e6be4b3706e0f39bc7a4cf4496a5f2c4cb840040 # v2
- name: "Set up Chrome" # for PDF rendering
uses: browser-actions/setup-chrome@facf10a55b9caf92e0cc749b4f82bf8220989148 # v1.7.2
- name: "Install sysreqs"
id: run-apt
shell: bash
run: |
sudo apt update || exit 0
curl https://carpentries.r-universe.dev/stats/sysdeps 2> /dev/null \
| jq -r '.headers[0] | select(. != null)' 2> /dev/null \
> ${{ runner.temp }}/sysdeps.txt
if [[ `wc -l < ${{ runner.temp }}/sysdeps.txt` -gt 0 ]]; then
echo 'sysdeps acquired'
else
echo 'fetching sysdeps from descriptions'
curl https://carpentries.r-universe.dev/stats/descriptions \
| jq -r '._builder.sysdeps | .[].headers | select(. != null)' 2> /dev/null \
> ${{ runner.temp }}/sysdeps.txt
fi
if [[ `wc -l < ${{ runner.temp }}/sysdeps.txt` -eq 0 ]]; then
echo "::warn::System dependencies could not be acquired. Builds may fail"
exit 1
else
echo "found sysdeps: $(cat ${{ runner.temp }}/sysdeps.txt)"
fi
printf "libxslt-dev\n" >> ${{ runner.temp }}/sysdeps.txt
sudo xargs apt-get install --fix-missing -y < ${{ runner.temp }}/sysdeps.txt || echo "Not on Ubuntu"
- uses: r-lib/actions/setup-r-dependencies@e6be4b3706e0f39bc7a4cf4496a5f2c4cb840040 # v2
with:
extra-packages: any::covr
needs: coverage
- name: Test coverage
run: |
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package