-
Notifications
You must be signed in to change notification settings - Fork 2
129 lines (127 loc) · 4.29 KB
/
main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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:
BBI_VERSION: v3.3.0
MPN: 2024-03-01
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
bbi_version: v3.0.2
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@v4
- name: Install bbi
uses: ./.github/actions/setup-bbi
with:
version: ${{ matrix.config.bbi_version || env.BBI_VERSION }}
- 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'
shell: bash
run: |
# Even on oldest, install new enough nmrec for vignettes to
# build.
version=0.4.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 }}
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'
shell: Rscript {0}
run: pkgdown::check_pkgdown()
release:
name: Upload release
needs: check
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Install bbi
uses: ./.github/actions/setup-bbi
with:
version: ${{ env.BBI_VERSION }}
- 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
- name: Configure Git
shell: bash
run: |
git config --global user.email CI
git config --global user.name ci@metrumrg
- name: Tag
shell: bash
run: git tag -am 'release 1.10.0.9999' 1.10.0.9999
- name: Create output directory
shell: bash
run: echo "REPO_DIR=$(mktemp -d)" >>$GITHUB_ENV
- name: Create CRAN-like repo for release
run: pkgpub::create_tagged_repo("${{ env.REPO_DIR }}")
shell: Rscript {0}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::906087756158:role/github-actions-mpn-s3-publish
aws-region: us-east-1
- name: 'Publish package: 1.10.0.9999'
run: |
aws s3 sync \
'${{ env.REPO_DIR }}/1.10.0.9999/' \
's3://mpn.metworx.dev/releases/${{ github.event.repository.name }}/1.10.0.9999/'
- name: 'Publish package: latest_tag'
run: |
aws s3 sync \
'${{ env.REPO_DIR }}/1.10.0.9999/' \
's3://mpn.metworx.dev/releases/${{ github.event.repository.name }}/latest_tag_test/'