-
Notifications
You must be signed in to change notification settings - Fork 98
/
Copy pathazure-pipelines.yml
76 lines (72 loc) · 3.2 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
# The following pipeline tests synthdid in the following way:
# 1. With the latest R release (4.0) on macOS.
# The R setup here is based on https://eddelbuettel.github.io/r-ci/
name: "R (release) - macOS-latest"
trigger:
- master
pool:
vmImage: "macOS-latest"
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: |
curl -OLs https://eddelbuettel.github.io/r-ci/run.sh && chmod 0755 run.sh
./run.sh bootstrap
./run.sh install_all
brew install pandoc # Vignettes/pkgdown sites
displayName: Setup R
- script: |
# install `gmp` CVXR requirement from source as binary breaks (bad linking) on CI image.
sudo Rscript -e "install.packages('https://cran.r-project.org/src/contrib/gmp_0.6-2.tar.gz', repos = NULL, type = 'source')"
sudo Rscript -e "install.packages('CVXR')"
./run.sh run_tests
displayName: Test R package
- script: ./run.sh dump_logs_by_extension "fail"
condition: failed()
displayName: Print test failures
- script: |
R CMD INSTALL .
sudo Rscript -e "install.packages(c('rmarkdown', 'gifski', 'ragg'))"
Rscript -e "rmarkdown::render('vignettes/synthdid.Rmd')"
Rscript -e "rmarkdown::render('vignettes/more-plotting.Rmd')"
displayName: Test vignettes
# Final deploy step
# Build the online docs and deploy to gh-pages - only done on master branch.
# `GITHUB_PAT` is a GitHub access token stored on Azure Pipelines.
- script: |
set -e
# Install a previous version of `pkgdown` and its dependencies, which appears less likely to break.
sudo Rscript -e "install.packages(c('fs', 'highlight', 'httr', 'memoise', 'openssl', 'purrr', 'rmarkdown', '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')"
# To render plot animations properly in pkgdown, we currently also need 'gifski' and 'ragg'.
sudo Rscript -e "install.packages(c('gifski', 'ragg'))"
# Install synthdid, and optionally packages used for vignettes.
R CMD INSTALL .
# 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 "azuredevops@microsoft.com"
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/synth-inference/synthdid.git HEAD:gh-pages
displayName: 'Publish GitHub Pages'
condition: |
and(not(eq(variables['Build.Reason'], 'PullRequest')),
eq(variables['Build.SourceBranch'], 'refs/heads/master'))