-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (72 loc) · 2.39 KB
/
run-tests.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
on:
push:
branches:
- master
pull_request:
name: Run unit tests
jobs:
create_mock:
runs-on: ubuntu-latest
container: bioconductor/bioconductor_docker:devel
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Cache RDS files
id: cache-mock
uses: actions/cache@v4
with:
path: tests/mock-files
key: mock-${{ hashFiles('tests/mock.R') }}
- name: Set directories
if: steps.cache-mock.outputs.cache-hit != 'true'
run: |
echo "R_PKG_DIR=${R_HOME}/site-library" >> $GITHUB_ENV
- name: Restore the package directory
if: steps.cache-mock.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: ${{ env.R_PKG_DIR }}
key: check-packages
- name: Clone the wobbegong R package
if: steps.cache-mock.outputs.cache-hit != 'true'
run: git clone https://github.com/kanaverse/wobbegong-R rpkg
- name: Install dependencies
if: steps.cache-mock.outputs.cache-hit != 'true'
shell: Rscript {0}
run: |
stuff <- read.dcf("rpkg/DESCRIPTION")
stuff <- stuff[,intersect(colnames(stuff), c("Imports", "LinkingTo", "Suggests", "Depends"))]
deps <- sub(" .*", "", unlist(strsplit(stuff, ",\\s*"), use.names=FALSE))
BiocManager::install(deps)
- name: Install the R package
if: steps.cache-mock.outputs.cache-hit != 'true'
run: R CMD INSTALL rpkg
- name: Build the mock files
if: steps.cache-mock.outputs.cache-hit != 'true'
run: |
cd tests
R -f mock.R
test:
runs-on: ubuntu-latest
needs: [ create_mock ]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 22
- name: Cache Modules
uses: actions/cache@v4
with:
path: '**/node_modules'
key: npm-${{ hashFiles('package.json') }}
- name: Update NPM packages
run: npm i --include=dev
- name: Cache mock files
uses: actions/cache@v4
with:
path: tests/mock-files
key: mock-${{ hashFiles('tests/mock.R') }}
- name: Run tests
run: npm run test