-
Notifications
You must be signed in to change notification settings - Fork 4
119 lines (117 loc) · 4.02 KB
/
inference-ci.yml
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
name: inference CI
on:
workflow_dispatch:
workflow_run:
workflows: ['flepicommon-ci', 'gempyor-ci']
types:
- completed
push:
paths:
- flepimop/R_packages/inference/**/*
branches:
- dev
pull_request:
types:
- edited
- opened
- ready_for_review
- reopened
- synchronize
paths:
- flepimop/R_packages/inference/**/*
branches:
- dev
- main
jobs:
tests:
runs-on: ubuntu-latest
if: (github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success') && (github.event_name != 'pull_request' || github.event.pull_request.draft == false)
strategy:
matrix:
R-version: ["4.3.3"]
python-version: ["3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
sparse-checkout: |
*
!documentation/
sparse-checkout-cone-mode: false
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install gempyor
run: |
python -m pip install --upgrade pip
python -m pip install "flepimop/gempyor_pkg[test]"
shell: bash
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.R-version }}
update-rtools: true
- name: Install System Dependencies
run: sudo apt install libcurl4-openssl-dev libharfbuzz-dev libfribidi-dev libtiff5-dev libudunits2-dev libgdal-dev libgeos-dev libproj-dev
- name: Determine R Library Location
run: |
R_LIBPATH=$( R -s -e "cat(.libPaths()[1L])" | xargs )
echo "R_LIBPATH=$R_LIBPATH" >> $GITHUB_ENV
R_LIBPATH_CKSUM=$( echo "$R_LIBPATH" | cksum | cut -d ' ' -f 1 )
echo "R_LIBPATH_CKSUM=$R_LIBPATH_CKSUM" >> $GITHUB_ENV
CACHE_DATE=$( date -d "last Sunday" +%Y%m%d )
echo "CACHE_DATE=$CACHE_DATE" >> $GITHUB_ENV
- name: R Library Cache
uses: actions/cache@v4
with:
key: inference-rlibs-${{ runner.os }}-${{ matrix.R-version }}-${{ hashFiles('flepimop/R_packages/flepicommon/DESCRIPTION', 'flepimop/R_packages/flepicommon/NAMESPACE', 'flepimop/R_packages/inference/DESCRIPTION', 'flepimop/R_packages/inference/NAMESPACE') }}-${{ env.R_LIBPATH_CKSUM }}-${{ env.CACHE_DATE }}
path: ${{ env.R_LIBPATH }}
- name: Install R Dependencies For flepicommon
if: steps.r-library-cache.outputs.cache-hit != 'true'
run: |
install.packages(
"devtools",
repos = "https://cloud.r-project.org",
)
library(devtools)
devtools::install_deps(
pkg = "flepimop/R_packages/flepicommon",
dependencies = TRUE
)
install.packages("covidcast", repos = "https://cloud.r-project.org")
shell: Rscript {0}
- name: Install The flepicommon Package
run: |
devtools::install(
pkg = "flepimop/R_packages/flepicommon",
quick = TRUE,
dependencies = TRUE,
force = TRUE
)
shell: Rscript {0}
- name: Install R Dependencies For inference
if: steps.r-library-cache.outputs.cache-hit != 'true'
run: |
devtools::install_deps(
pkg = "flepimop/R_packages/inference",
dependencies = TRUE
)
install.packages("covidcast", repos = "https://cloud.r-project.org")
shell: Rscript {0}
- name: Install The inference Package
run: |
devtools::install(
pkg = "flepimop/R_packages/inference",
args = c(getOption("devtools.install.args"), "--install-tests"),
quick = TRUE,
dependencies = TRUE,
force = TRUE
)
shell: Rscript {0}
- name: Run Tests
run: |
library(testthat)
test_package("inference")
shell: Rscript {0}