Skip to content

Fix website preview #1067

Fix website preview

Fix website preview #1067

Workflow file for this run

# 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]
pull_request:
branches: [main, master]
workflow_dispatch:
name: test-coverage
jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
RENV_PATHS_ROOT: ~/.local/share/renv
OS_VERSION: 1
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: "Set up pandoc"
uses: r-lib/actions/setup-pandoc@v2
- 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@v2
with:
extra-packages: any::covr
needs: coverage
- name: Restore {renv} cache
uses: actions/cache@v4
with:
path: ${{ env.RENV_PATHS_ROOT }}
key: ${{ runner.os }}-${{ env.OS_VERSION }}-renv-${{ runner.r }}-${{ hashFiles('.github/workflows/R-CMD-check.yaml') }}
restore-keys: |
${{ runner.os }}-${{ env.OS_VERSION }}-renv-${{ runner.r }}-
- name: Prime {renv} Cache
run: |
renv::settings$snapshot.type("explicit")
renv::init()
system('rm -rf renv .Rprofile')
system('git clean -fd -e .github')
system('git restore .')
shell: Rscript {0}
- 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@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package