Skip to content

Commit 48176d6

Browse files
committed
add _pkgdown.yml and .github/workflows/pr_check.yml GHA
1 parent c4506ed commit 48176d6

File tree

2 files changed

+178
-0
lines changed

2 files changed

+178
-0
lines changed

.github/workflows/pr_check.yml

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
name: PR CMD check & build site
2+
3+
on:
4+
pull_request:
5+
push:
6+
paths:
7+
- 'DESCRIPTION'
8+
- '**.yml'
9+
branches:
10+
- devel
11+
- RELEASE_3_21
12+
13+
env:
14+
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
15+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
16+
CRAN: https://p3m.dev/cran/__linux__/noble/latest
17+
BIOC_RELEASE: RELEASE_3_21
18+
19+
jobs:
20+
set-matrix:
21+
runs-on: ubuntu-24.04
22+
outputs:
23+
matrix: ${{ steps.set.outputs.matrix }}
24+
dockerfile_exists: ${{ steps.dockerfile.outputs.exists }}
25+
steps:
26+
- name: Set Matrix Bioconductor Version
27+
id: set
28+
run: |
29+
MATRIX="{\"include\":[{\"bioc_version\":\"$GITHUB_REF_NAME\"}]}"
30+
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
31+
- name: Check for Dockerfile
32+
id: dockerfile
33+
run: |
34+
echo "exists=$( [ -f ./inst/docker/pkg/Dockerfile ] && echo true || echo false )" >> $GITHUB_OUTPUT
35+
36+
check:
37+
needs: set-matrix
38+
runs-on: ubuntu-latest
39+
strategy:
40+
matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
41+
container: bioconductor/bioconductor_docker:${{ matrix.bioc_version }}
42+
43+
steps:
44+
- name: Checkout Repository
45+
uses: actions/checkout@v4
46+
with:
47+
ref: ${{ matrix.bioc_version }}
48+
49+
- name: Query dependencies
50+
run: |
51+
BiocManager::install(c("covr", "BiocCheck"))
52+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
53+
shell: Rscript {0}
54+
55+
- name: Cache R packages
56+
uses: actions/cache@v4
57+
with:
58+
path: /usr/local/lib/R/site-library
59+
key: ${{ runner.os }}-r-${{ matrix.bioc_version }}-${{ hashFiles('.github/depends.Rds') }}
60+
restore-keys: ${{ runner.os }}-r-${{ matrix.bioc_version }}-
61+
62+
- name: Install GPG
63+
if: ${{ github.ref == 'refs/heads/devel' && github.event_name != 'pull_request' }}
64+
run: sudo apt-get update && sudo apt-get install -y gpg
65+
66+
- name: Install Dependencies
67+
run: |
68+
remotes::install_deps(dependencies = TRUE, repos = BiocManager::repositories())
69+
BiocManager::install(c("rcmdcheck", "BiocCheck"), ask = FALSE, update = TRUE)
70+
shell: Rscript {0}
71+
72+
- name: Check Package
73+
env:
74+
_R_CHECK_CRAN_INCOMING_REMOTE_: false
75+
run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error", check_dir = "check")
76+
shell: Rscript {0}
77+
78+
- name: Test coverage
79+
if: ${{ success() && github.ref == 'refs/heads/devel' && github.event_name != 'pull_request' }}
80+
run: |
81+
cov <- covr::package_coverage(
82+
quiet = FALSE,
83+
clean = FALSE,
84+
type = "all",
85+
install_path = file.path(
86+
normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"),
87+
"package"
88+
)
89+
)
90+
covr::to_cobertura(cov)
91+
shell: Rscript {0}
92+
93+
- name: Upload test results to Codecov
94+
if: ${{ success() && github.ref == 'refs/heads/devel' && github.event_name != 'pull_request' }}
95+
uses: codecov/codecov-action@v4
96+
with:
97+
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
98+
file: ./cobertura.xml
99+
plugin: noop
100+
disable_search: true
101+
token: ${{ secrets.CODECOV_TOKEN }}
102+
103+
- name: Run BiocCheck
104+
id: bioccheck
105+
run: |
106+
BiocCheck::BiocCheck(
107+
dir('check', 'tar.gz$', full.names = TRUE),
108+
`quit-with-status` = TRUE, `no-check-bioc-help` = TRUE
109+
)
110+
shell: Rscript {0}
111+
112+
- name: Build pkgdown
113+
if: ${{ github.ref == format('refs/heads/{0}', env.BIOC_RELEASE) && github.event_name != 'pull_request' }}
114+
run: |
115+
PATH=$PATH:$HOME/bin/ Rscript -e 'pkgdown::build_site()'
116+
117+
- name: Upload pkgdown artifact
118+
if: github.ref == format('refs/heads/{0}', env.BIOC_RELEASE)
119+
uses: actions/upload-pages-artifact@v3
120+
with:
121+
path: docs
122+
123+
dock:
124+
needs:
125+
- check
126+
- set-matrix
127+
runs-on: ubuntu-24.04
128+
if: ${{ github.ref == 'refs/heads/devel' && needs.set-matrix.outputs.dockerfile_exists == 'true' }}
129+
steps:
130+
- name: Checkout Repository
131+
if: ${{ success() && github.event_name != 'pull_request' }}
132+
uses: actions/checkout@v4
133+
134+
- name: Register repo name
135+
if: ${{ github.event_name != 'pull_request' }}
136+
id: reg_repo_name
137+
run: |
138+
echo CONT_IMG_NAME=$(echo ${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
139+
140+
- name: Login to Docker Hub
141+
if: ${{ github.event_name != 'pull_request' }}
142+
uses: docker/login-action@v2
143+
with:
144+
username: ${{ secrets.DOCKERHUB_USERNAME }}
145+
password: ${{ secrets.DOCKERHUB_TOKEN }}
146+
147+
- name: Build and Push Docker
148+
if: ${{ success() && github.event_name != 'pull_request' }}
149+
uses: docker/build-push-action@v6
150+
with:
151+
context: .
152+
file: ./inst/docker/pkg/Dockerfile
153+
push: true
154+
tags: >
155+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.CONT_IMG_NAME }}:latest,
156+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.CONT_IMG_NAME }}:devel
157+
158+
deploy:
159+
needs: check
160+
permissions:
161+
contents: write
162+
pages: write
163+
id-token: write
164+
runs-on: ubuntu-24.04
165+
166+
steps:
167+
- name: Deploy to GitHub Pages
168+
if: ${{ github.ref == format('refs/heads/{0}', env.BIOC_RELEASE) && github.event_name != 'pull_request' }}
169+
id: deployment
170+
uses: actions/deploy-pages@v4
171+

_pkgdown.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
title: SingleCellMultiModal
2+
url: https://waldronlab.github.io/SingleCellMultiModal
3+
4+
template:
5+
bootstrap: 5
6+
params:
7+
bootswatch: flatly

0 commit comments

Comments
 (0)