-
Notifications
You must be signed in to change notification settings - Fork 78
116 lines (99 loc) · 3.53 KB
/
upgrade.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
on:
schedule:
- cron: '0 8 * * *'
push:
branches:
- master
- main
paths:
- "data-raw/upgrade.R"
- ".github/workflows/upgrade.yaml"
workflow_dispatch:
name: upgrade
jobs:
upgrade:
runs-on: ubuntu-24.04
name: Upgrade bundled SQLite
env:
RSPM: "https://packagemanager.rstudio.com/cran/__linux__/noble/latest"
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check rate limits
run: |
curl -s --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/rate_limit
shell: bash
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: r-lib/actions/setup-r@v2
- name: Install remotes
run: |
if (!requireNamespace("curl", quietly = TRUE)) install.packages("curl")
if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes")
shell: Rscript {0}
- name: Prepare cache keys
if: runner.os != 'Windows'
run: |
saveRDS(remotes::dev_package_deps(dependencies = TRUE, type = .Platform$pkgType), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: upgrade-${{ hashFiles('.github/R-version') }}-2-${{ hashFiles('.github/depends.Rds') }}
restore-keys: upgrade-${{ hashFiles('.github/R-version') }}-2-
- name: Install system dependencies
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
- name: Install package and dependencies
run: |
remotes::install_deps(dependencies = TRUE, type = .Platform$pkgType)
shell: Rscript {0}
- name: Session info
run: |
options(width = 100)
if (!requireNamespace("sessioninfo", quietly = TRUE)) install.packages("sessioninfo")
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}
- name: Configure Git identity
run: |
env | sort
git config --global user.name "$GITHUB_WORKFLOW"
git config --global user.email "${GITHUB_EVENT_NAME}@ghactions.local"
shell: bash
- name: Run preparation
id: vendor
run: |
R -q -f data-raw/upgrade.R
# Check if ahead of upstream branch
# If yes, set a step output
if [ $(git rev-list HEAD...origin/main --count) -gt 0 ]; then
# Avoid set-output, it's deprecated
echo "vendor=ok" >> "$GITHUB_OUTPUT"
fi
shell: bash
- name: Create PR
if: steps.vendor.outputs.vendor != ''
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
git checkout -b vendor
if git push -u origin HEAD; then
gh pr create --fill-first
gh workflow run rcc -f ref=vendor
gh pr merge --auto --squash
fi
- name: Check rate limits
if: always()
run: |
curl -s --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/rate_limit
shell: bash