Skip to content

Commit 535d360

Browse files
committed
add GHA from template
1 parent 8bfae17 commit 535d360

File tree

1 file changed

+93
-14
lines changed

1 file changed

+93
-14
lines changed

.github/workflows/pr_check.yml

Lines changed: 93 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,63 @@
1-
name: Devel PR CMD check
1+
name: PR CMD check & build site
22

33
on:
44
pull_request:
5+
push:
6+
paths:
7+
- 'DESCRIPTION'
8+
- '**.yml'
59
branches:
610
- 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
718

819
jobs:
9-
checkDevel:
10-
runs-on: ubuntu-22.04
11-
container: bioconductor/bioconductor_docker:devel
20+
set-matrix:
21+
runs-on: ubuntu-24.04
22+
outputs:
23+
matrix: ${{ steps.set.outputs.matrix }}
24+
steps:
25+
- name: Set Matrix Bioconductor Version
26+
id: set
27+
run: |
28+
MATRIX="{\"include\":[{\"bioc_version\":\"$GITHUB_REF_NAME\"}]}"
29+
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
1230
13-
env:
14-
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
15-
CRAN: https://packagemanager.posit.co/cran/__linux__/jammy/latest
16-
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
31+
check:
32+
needs: set-matrix
33+
runs-on: ubuntu-latest
34+
strategy:
35+
matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
36+
container: bioconductor/bioconductor_docker:${{ matrix.bioc_version }}
1737

1838
steps:
1939
- name: Checkout Repository
20-
uses: actions/checkout@v3
40+
uses: actions/checkout@v4
41+
with:
42+
ref: ${{ matrix.bioc_version }}
2143

2244
- name: Query dependencies
2345
run: |
24-
BiocManager::install("remotes")
46+
BiocManager::install(c("covr", "BiocCheck"))
2547
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
2648
shell: Rscript {0}
2749

2850
- name: Cache R packages
2951
if: runner.os != 'Windows'
30-
uses: actions/cache@v1
52+
uses: actions/cache@v4
3153
with:
3254
path: /usr/local/lib/R/site-library
33-
key: ${{ runner.os }}-r-1-${{ hashFiles('.github/depends.Rds') }}
34-
restore-keys: ${{ runner.os }}-r-1-
55+
key: ${{ runner.os }}-r-${{ matrix.bioc_version }}-${{ hashFiles('.github/depends.Rds') }}
56+
restore-keys: ${{ runner.os }}-r-${{ matrix.bioc_version }}-
57+
58+
- name: Install GPG
59+
if: ${{ github.ref == 'refs/heads/devel' && github.event_name != 'pull_request' }}
60+
run: sudo apt-get update && sudo apt-get install -y gpg
3561

3662
- name: Install Dependencies
3763
run: |
@@ -45,8 +71,61 @@ jobs:
4571
run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error", check_dir = "check")
4672
shell: Rscript {0}
4773

74+
- name: Test coverage
75+
if: ${{ success() && github.ref == 'refs/heads/devel' && github.event_name != 'pull_request' }}
76+
run: |
77+
cov <- covr::package_coverage(
78+
quiet = FALSE,
79+
clean = FALSE,
80+
type = "all",
81+
install_path = file.path(
82+
normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"),
83+
"package"
84+
)
85+
)
86+
covr::to_cobertura(cov)
87+
shell: Rscript {0}
88+
89+
- name: Upload test results to Codecov
90+
if: ${{ success() && github.ref == 'refs/heads/devel' && github.event_name != 'pull_request' }}
91+
uses: codecov/codecov-action@v4
92+
with:
93+
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
94+
file: ./cobertura.xml
95+
plugin: noop
96+
disable_search: true
97+
token: ${{ secrets.CODECOV_TOKEN }}
98+
4899
- name: Run BiocCheck
100+
id: bioccheck
49101
run: |
50-
BiocCheck::BiocCheck()
102+
BiocCheck::BiocCheck(
103+
dir('check', 'tar.gz$', full.names = TRUE),
104+
`quit-with-status` = TRUE, `no-check-bioc-help` = TRUE
105+
)
51106
shell: Rscript {0}
52107

108+
- name: Build pkgdown
109+
if: ${{ github.ref == format('refs/heads/{0}', env.BIOC_RELEASE) && github.event_name != 'pull_request' }}
110+
run: |
111+
PATH=$PATH:$HOME/bin/ Rscript -e 'pkgdown::build_site()'
112+
113+
- name: Upload pkgdown artifact
114+
if: github.ref == format('refs/heads/{0}', env.BIOC_RELEASE)
115+
uses: actions/upload-pages-artifact@v3
116+
with:
117+
path: docs
118+
119+
deploy:
120+
needs: check
121+
permissions:
122+
contents: write
123+
pages: write
124+
id-token: write
125+
runs-on: ubuntu-24.04
126+
127+
steps:
128+
- name: Deploy to GitHub Pages
129+
if: ${{ github.ref == format('refs/heads/{0}', env.BIOC_RELEASE) && github.event_name != 'pull_request' }}
130+
id: deployment
131+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)