Skip to content

[wip] try to work around withr issue #21

[wip] try to work around withr issue

[wip] try to work around withr issue #21

Workflow file for this run

name: CI
on:
push:
branches:
- 'main'
- 'scratch/**'
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+.[0-9]+'
pull_request:
env:
MPN: 2023-12-05
# Note: Updates here do not affect the nmrec version use for oldest
# step.
NMREC_PKG: github::metrumresearchgroup/nmrec@0.3.0
jobs:
check:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} R ${{ matrix.config.r }} ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config:
- os: ubuntu-20.04
r: 4.0.5
- os: ubuntu-20.04
r: 4.1.3
- os: ubuntu-latest
r: release
- label: oldest
os: ubuntu-20.04
r: 4.0.5
mpn: 2020-06-08
cran_override: 'https://mpn.metworx.com/snapshots/stable/2020-06-08'
rspm: 'https://packagemanager.posit.co/cran/__linux__/focal/2020-06-08'
env:
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v3
- name: Install bbi
uses: ./.github/actions/setup-bbi
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
use-public-rspm: true
extra-repositories: 'https://mpn.metworx.com/snapshots/stable/${{ matrix.config.mpn || env.MPN }}'
env:
RSPM: ${{ matrix.config.rspm }}
CRAN: ${{ matrix.config.cran_override }}
- name: Check out nmrec
if: matrix.config.label == 'oldest'
run: |
version=0.3.0
tdir=$(mktemp -d)
git clone --branch "$version" --depth 1 \
https://github.com/metrumresearchgroup/nmrec.git "$tdir"
# Delete testthat version constraint. It doesn't matter in
# this context and causes pak's solver to abort.
sed -i 's/testthat (.*/testthat,/' "$tdir/DESCRIPTION"
echo "NMREC_PKG=local::$tdir" >>$GITHUB_ENV
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::pkgdown
any::rcmdcheck
${{ env.NMREC_PKG }}
${{ matrix.config.label != 'oldest' && 'github::r-lib/withr@v3.0.0' }}
upgrade: ${{ matrix.config.label == 'oldest' && 'FALSE' || 'TRUE' }}
- uses: r-lib/actions/check-r-package@v2
- name: Check pkgdown
# The pkgdown on MPN 2020-06-08 does not have check_pkgdown().
if: matrix.config.label != 'oldest'
run: pkgdown::check_pkgdown()
shell: Rscript {0}
release:
if: github.ref_type == 'tag'
name: Upload release
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/setup-r@v2
with:
r-version: release
use-public-rspm: true
extra-repositories: 'https://mpn.metworx.com/snapshots/stable/${{ env.MPN }}'
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::pkgpub
${{ env.NMREC_PKG }}
github::r-lib/withr@v3.0.0
- name: Configure Git
run: |
git config --global user.email CI
git config --global user.name ci@metrumrg
- name: Create output directory
run: echo "REPO_DIR=$(mktemp -d)" >>$GITHUB_ENV
- name: Create CRAN-like repo for release
run: pkgpub::create_tagged_repo("${{ env.REPO_DIR }}/${{ github.event.repository.name }}")
shell: Rscript {0}
- name: Create repo tarball
run: |
cd '${{ env.REPO_DIR }}'
tar czf \
'${{ github.event.repository.name }}-${{ github.ref_name }}.tar.gz' \
'${{ github.event.repository.name }}'
- name: Store release # TODO: tmp for testing; change to mpn.metworx.dev s3 upload
uses: actions/upload-artifact@v3
with:
name: release-for-mpn-dev
path: ${{ env.REPO_DIR }}/${{ github.event.repository.name }}-${{ github.ref_name }}.tar.gz