forked from grf-labs/grf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
133 lines (130 loc) · 4.8 KB
/
azure-pipelines.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# The following pipeline tests grf in the following ways:
# 1. Core C++ compiled with GCC and test with valgrind on latest Ubuntu.
# 2. Core C++ compiled with Clang and test with valgrind on latest Ubuntu.
# 3. Core C++ compiled with MSVC (release build with all optimizations).
# 4. Latest R release on Ubuntu(+ small valgrind check)/MacOS.
# The R setup here is based on https://eddelbuettel.github.io/r-ci/
trigger:
- master
jobs:
- job: coreCPP
pool:
vmImage: "ubuntu-20.04" # bundled valgrind in ubuntu-latest breaks with clang (update to latest when available).
strategy:
matrix:
clang:
CXX: clang++
gcc:
CXX: g++
steps:
- script: |
sudo apt-get update -qq
sudo apt-get install -qq valgrind
displayName: Setup
- script: |
mkdir build && cd build
cmake -DCMAKE_CXX_COMPILER=$CXX .. && make debug
workingDirectory: core
displayName: Build
- script: valgrind --leak-check=full --error-exitcode=1 ./build/grf
workingDirectory: core
displayName: Valgrind check
- job: coreCPP_MSVC
pool:
vmImage: "windows-latest"
steps:
- script: |
mkdir build && cd build
cmake -DCMAKE_CXX_COMPILER=CL.exe ..
workingDirectory: core
displayName: CMake
- task: VSBuild@1
inputs:
solution: 'core\build\*.sln'
configuration: 'release'
displayName: Build
- script: build\Release\grf.exe
workingDirectory: core
displayName: Check
- job: R_package
strategy:
matrix:
ubuntu:
imageName: "ubuntu-latest"
macos:
imageName: "macOS-latest"
pool:
vmImage: $(imageName)
variables:
- name: R_LIBS_USER
value: '$(Agent.BuildDirectory)/R/library'
- name: CRAN
value: 'https://cloud.r-project.org'
- name: _R_CHECK_FORCE_SUGGESTS_
value: false
- name: _R_CHECK_DONTTEST_EXAMPLES_
value: true
- name: USE_BSPM
value: true
- name: WARNINGS_ARE_ERRORS
value: true
steps:
- script: |
sudo apt-get update -qq
sudo apt-get install -qq valgrind
displayName: Setup valgrind
condition: eq(variables['Agent.OS'], 'Linux')
- script: |
curl -OLs https://eddelbuettel.github.io/r-ci/run.sh && chmod 0755 run.sh
./run.sh bootstrap
./run.sh install_deps
workingDirectory: r-package/grf
displayName: Setup R
- script: ./run.sh run_tests
workingDirectory: r-package/grf
displayName: Test R package
- script: ./run.sh dump_logs_by_extension "fail"
condition: failed()
workingDirectory: r-package/grf
displayName: Print R failures
- script: |
# Use R check's installation instead of reinstalling the package.
sudo sed -i.old '1s;^;.libPaths(c(file.path(getwd(), "grf.Rcheck"), .libPaths()));' tests/valgrind/test_grf_valgrind.R
R -d "valgrind --tool=memcheck --leak-check=full --error-exitcode=1" --vanilla < tests/valgrind/test_grf_valgrind.R
workingDirectory: r-package/grf
displayName: Valgrind check
condition: eq(variables['Agent.OS'], 'Linux')
# Final deploy step:
# Build the online docs and deploy to gh-pages - only done on master branch with Linux image.
# `GITHUB_PAT` is a GitHub access token stored on Azure Pipelines.
- script: |
set -e
sudo apt-get install -qq pandoc
# Lock in a previous version of `pkgdown` and its dependencies.
sudo Rscript -e "install.packages(c('fs', 'highlight', 'httr', 'memoise', 'openssl', 'purrr', 'rmarkdown', 'rstudioapi', 'whisker', 'xml2', 'yaml'))"
sudo Rscript -e "install.packages('https://cran.r-project.org/src/contrib/Archive/pkgdown/pkgdown_1.5.1.tar.gz', repos = NULL, type = 'source')"
# Install dependencies needed for vignettes.
sudo Rscript -e "install.packages(c('DiagrammeR', 'ggplot2', 'glmnet', 'policytree', 'rdd'))"
cp ../../README.md .
cp ../../REFERENCE.md .
cp ../../DEVELOPING.md .
cp ../../releases/CHANGELOG.md .
# Build and deploy page. This requires that the branch `gh-pages` exists.
# git worktree is used to only commit the doc folder (docs/) as the root.
# update-ref is used to not keep a commit history of the generated docs.
git config --local user.email "[email protected]"
git config --local user.name "Azure Pipelines"
git worktree add -B gh-pages docs/ origin/gh-pages
rm -rf docs/*
Rscript -e "pkgdown::build_site()"
cd docs
git add --all
git update-ref -d refs/heads/gh-pages
git commit --allow-empty -m "Update gh-pages ***NO_CI***"
git push --force https://$(GITHUB_PAT)@github.com/grf-labs/grf.git HEAD:gh-pages
workingDirectory: r-package/grf
displayName: 'Publish GitHub Pages'
condition: |
and(eq(variables['Agent.OS'], 'Linux'),
and(not(eq(variables['Build.Reason'], 'PullRequest')),
eq(variables['Build.SourceBranch'], 'refs/heads/master')))