-
Notifications
You must be signed in to change notification settings - Fork 7
171 lines (149 loc) · 5.49 KB
/
Copy pathpr_check.yml
File metadata and controls
171 lines (149 loc) · 5.49 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: PR CMD check & build site
on:
pull_request:
push:
paths:
- 'DESCRIPTION'
- '**.yml'
branches:
- devel
- RELEASE_3_21
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
CRAN: https://p3m.dev/cran/__linux__/noble/latest
BIOC_RELEASE: RELEASE_3_21
jobs:
set-matrix:
runs-on: ubuntu-24.04
outputs:
matrix: ${{ steps.set.outputs.matrix }}
dockerfile_exists: ${{ steps.dockerfile.outputs.exists }}
steps:
- name: Set Matrix Bioconductor Version
id: set
run: |
MATRIX="{\"include\":[{\"bioc_version\":\"$GITHUB_REF_NAME\"}]}"
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
- name: Check for Dockerfile
id: dockerfile
run: |
echo "exists=$( [ -f ./inst/docker/pkg/Dockerfile ] && echo true || echo false )" >> $GITHUB_OUTPUT
check:
needs: set-matrix
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
container: bioconductor/bioconductor_docker:${{ matrix.bioc_version }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ matrix.bioc_version }}
- name: Query dependencies
run: |
BiocManager::install(c("covr", "BiocCheck"))
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
shell: Rscript {0}
- name: Cache R packages
uses: actions/cache@v4
with:
path: /usr/local/lib/R/site-library
key: ${{ runner.os }}-r-${{ matrix.bioc_version }}-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-r-${{ matrix.bioc_version }}-
- name: Install GPG
if: ${{ github.ref == 'refs/heads/devel' && github.event_name != 'pull_request' }}
run: sudo apt-get update && sudo apt-get install -y gpg
- name: Install Dependencies
run: |
remotes::install_deps(dependencies = TRUE, repos = BiocManager::repositories())
BiocManager::install(c("rcmdcheck", "BiocCheck"), ask = FALSE, update = TRUE)
shell: Rscript {0}
- name: Check Package
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error", check_dir = "check")
shell: Rscript {0}
- name: Test coverage
if: ${{ success() && github.ref == 'refs/heads/devel' && github.event_name != 'pull_request' }}
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
type = "all",
install_path = file.path(
normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"),
"package"
)
)
covr::to_cobertura(cov)
shell: Rscript {0}
- name: Upload test results to Codecov
if: ${{ success() && github.ref == 'refs/heads/devel' && github.event_name != 'pull_request' }}
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Run BiocCheck
id: bioccheck
run: |
BiocCheck::BiocCheck(
dir('check', 'tar.gz$', full.names = TRUE),
`quit-with-status` = TRUE, `no-check-bioc-help` = TRUE
)
shell: Rscript {0}
- name: Build pkgdown
if: ${{ github.ref == format('refs/heads/{0}', env.BIOC_RELEASE) && github.event_name != 'pull_request' }}
run: |
PATH=$PATH:$HOME/bin/ Rscript -e 'pkgdown::build_site()'
- name: Upload pkgdown artifact
if: github.ref == format('refs/heads/{0}', env.BIOC_RELEASE)
uses: actions/upload-pages-artifact@v3
with:
path: docs
dock:
needs:
- check
- set-matrix
runs-on: ubuntu-24.04
if: ${{ github.ref == 'refs/heads/devel' && needs.set-matrix.outputs.dockerfile_exists == 'true' }}
steps:
- name: Checkout Repository
if: ${{ success() && github.event_name != 'pull_request' }}
uses: actions/checkout@v4
- name: Register repo name
if: ${{ github.event_name != 'pull_request' }}
id: reg_repo_name
run: |
echo CONT_IMG_NAME=$(echo ${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Login to Docker Hub
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push Docker
if: ${{ success() && github.event_name != 'pull_request' }}
uses: docker/build-push-action@v6
with:
context: .
file: ./inst/docker/pkg/Dockerfile
push: true
tags: >
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.CONT_IMG_NAME }}:latest,
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.CONT_IMG_NAME }}:devel
deploy:
needs: check
permissions:
contents: write
pages: write
id-token: write
runs-on: ubuntu-24.04
steps:
- name: Deploy to GitHub Pages
if: ${{ github.ref == format('refs/heads/{0}', env.BIOC_RELEASE) && github.event_name != 'pull_request' }}
id: deployment
uses: actions/deploy-pages@v4