-
Notifications
You must be signed in to change notification settings - Fork 5
74 lines (62 loc) · 2.15 KB
/
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
on:
push:
branches: '*'
pull_request:
branches: '*'
name: build
jobs:
build:
runs-on: ubuntu-22.04
env:
R_LIBS_USER: ${{ github.workspace }}/RLibs
steps:
- name: Install required packages
run: |
sudo apt update
sudo apt-get install libudunits2-dev libgdal-dev
- name: Install specific version of R
run: |
sudo apt update
sudo apt-get install dirmngr gnupg apt-transport-https ca-certificates software-properties-common
echo 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/' | sudo tee /etc/apt/sources.list.d/cran.list
gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
gpg -a --export E298A3A825C0D65DFD57CBB651716619E084DAB9 | sudo apt-key add -
sudo apt-get update
sudo apt-get install r-base=4.2.3-1.2004.0 r-recommended=4.2.3-1.2004.0 --allow-downgrades
- name: Clone matsim-melbourne/demand
uses: actions/checkout@v2
with:
repository: matsim-melbourne/demand
path: demand
- name: Setup dirs and permissions for installing R packages
run: |
mkdir -p $R_LIBS_USER
sudo chown -R $USER:$USER $GITHUB_WORKSPACE/demand
sudo chown -R $USER:$USER $R_LIBS_USER
- name: Cache R packages
uses: actions/cache@v2
id: cache-renv
env:
cache-name: cache-renv-lib
with:
path: |
${{ github.workspace }}/demand/renv/lib
key: ${{ runner.os }}-build-${{ env.cache-name }}-1-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-1-
- name: Install renv and project dependencies
if: steps.cache-renv.outputs.cache-hit != 'true'
working-directory: demand
shell: Rscript {0}
run: |
version
install.packages('renv')
library(renv)
renv::restore()
- name: Test demand generation
working-directory: demand
shell: Rscript {0}
run: |
library(renv)
renv::restore()
testthat::test_dir("tests/testthat", stop_on_failure = TRUE)