[wip] gha #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'scratch/**' | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
- '[0-9]+.[0-9]+.[0-9]+.[0-9]+' | |
pull_request: | |
jobs: | |
check: | |
runs-on: ${{ matrix.config.os }} | |
# TODO: customize | |
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: | |
BBI_VERSION: v3.3.0 | |
BBI_URL: https://github.com/metrumresearchgroup/bbi/releases/download | |
MPN: 2023-12-05 | |
R_KEEP_PKG_SOURCE: yes | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install bbi | |
run: | | |
mkdir -p $HOME/bin | |
curl -fSsL "$BBI_URL/$BBI_VERSION/bbi_linux_amd64.tar.gz" | | |
tar -z --extract --to-stdout >"$HOME/bin/bbi" | |
chmod +x "$HOME/bin/bbi" | |
$HOME/bin/bbi version | |
echo "BBI_EXE_PATH=$HOME/bin/bbi" >>$GITHUB_ENV | |
- 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 }} | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: | | |
any::pkgdown | |
any::rcmdcheck | |
cran::testthat | |
github::metrumresearchgroup/nmrec@0.3.0 | |
upgrade: ${{ matrix.cran_override && 'TRUE' || 'FALSE' }} | |
- uses: r-lib/actions/check-r-package@v2 | |
with: | |
error-on: '"note"' | |
- name: Check pkgdown | |
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 | |
# For pkgpub. | |
extra-repositories: 'https://mpn.metworx.com/snapshots/stable/2023-12-05' | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: | | |
any::pkgpub | |
github::metrumresearchgroup/nmrec@0.3.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 |