-
Notifications
You must be signed in to change notification settings - Fork 6
/
azure-pipelines.yml
128 lines (103 loc) · 5.58 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
schedules:
- cron: "0 3 * * *"
displayName: Nightly build
branches:
include:
- master
always: true
jobs:
- job: DataSHIELD_CI
timeoutInMinutes: 150
pool:
vmImage: 'Ubuntu 16.04'
variables:
datetime: $[format('{0:yyyyMMddHHmmss}', pipeline.startTime)]
repoName: 'dsBetaTestClient'
# repoName: $(Build.Repository.Name) # This returns datashield/dsBetaTestClient, but we only want the reponame.
branchName: $(Build.SourceBranchName)
steps:
- bash: |
echo $(branchName)
echo $(repoName)
# Purge the default mysql installed on the VM as it is incompatible with our stuff.
sudo service mysql stop
sudo apt-get update
sudo apt-get remove --purge mysql-client mysql-server mysql-common -y
sudo apt-get purge mysql-client mysql-server mysql-common -y
sudo apt-get autoremove -y
sudo apt-get autoclean -y
sudo rm -rf /var/lib/mysql/
wget -nv https://apt.puppetlabs.com/puppet5-release-xenial.deb
sudo dpkg -i puppet5-release-xenial.deb
sudo apt-get install -qq -f
sudo apt-get update
sudo rm -f puppet5-release-xenial.deb
sudo apt-get install puppet-agent -y
sudo /opt/puppetlabs/puppet/bin/gem install r10k
echo -n "Puppet version: "
/opt/puppetlabs/bin/puppet --version
/opt/puppetlabs/puppet/bin/r10k version
git clone -b ubuntu16 https://github.com/datashield/datashield-infrastructure.git ../datashield-infrastructure
pushd ../datashield-infrastructure/puppet/environments/datashield_azurepipelines && sudo /opt/puppetlabs/puppet/bin/r10k puppetfile install && popd
sudo /opt/puppetlabs/bin/puppet apply azure-pipelines_site.pp --environment datashield_azurepipelines --environmentpath ../datashield-infrastructure/puppet/environments
displayName: 'Install DataSHIELD server'
- bash: |
sudo apt-get install -qq libxml2-dev libcurl4-openssl-dev libssl-dev libgsl-dev -y
sudo R -q -e "install.packages('devtools', dependencies=TRUE)"
sudo R -q -e "install.packages('metafor', dependencies=TRUE)"
sudo R -q -e "install.packages('covr', dependencies=TRUE)"
sudo R -q -e "devtools::install_github(repo='datashield/opal', ref='master')"
sudo R -q -e "devtools::install_github(repo='datashield/opaladmin', ref='master')"
sudo R -q -e "devtools::install_github(repo='datashield/dsBaseClient', ref='master')"
sudo R -q -e "library('devtools'); library('opal'); library('opaladmin'); opals <- opal.login(username='administrator', password='datashield_test&', url='http://127.0.0.1:8080'); opaladmin::dsadmin.install_package(opal=opals,pkg='dsBetaTest',githubusername='datashield',ref='master'); datashield.logout(opals)"
displayName: 'Install R client'
- bash: |
R -q -e "library('devtools'); devtools::check(args = c('--no-examples'))" | tee azure-pipelines_check.Rout
grep --quiet "^0 errors" azure-pipelines_check.Rout && grep --quiet " 0 warnings" azure-pipelines_check.Rout && grep --quiet " 0 notes" azure-pipelines_check.Rout
displayName: 'Devtools checks'
condition: always()
- bash: |
R -q -e "library('devtools'); devtools::test()" | tee azure-pipelines_test.Rout
grep --quiet "Failed: 0" azure-pipelines_test.Rout
displayName: 'Devtools tests'
condition: always()
- bash: |
R -q -e "library('devtools'); options(testthat.output_file = 'test_results.xml'); devtools::test(reporter = 'junit')"
displayName: 'Devtools test reports'
condition: always()
- bash: |
./checkDocumentationUpdated.sh
displayName: 'Check documents'
condition: always()
- bash: |
git config --global user.email "[email protected]"
git config --global user.name "Azure pipeline"
# Should look to see if can use the one downloaded by default and not cloning a fresh one.
git clone -b $(branchName) https://datashield:$(GHPAT)@github.com/datashield/$(repoName).git $(repoName)
cd $(repoName)
sudo R -q -e 'library(covr);write.csv(coverage_to_list(covr::package_coverage(type = c("none"), code = c('"'"'testthat::test_package("dsBetaTestClient", reporter = "silent", stop_on_failure = FALSE)'"'"'))),"../coveragelist.csv")'
cd ../
displayName: 'Code coverage'
condition: always()
- bash: |
git clone https://datashield:$(GHPAT)@github.com/datashield/testStatus.git testStatus
# Make the directories if they dont already exist
mkdir --parents testStatus/logs/$(repoName)/$(branchName)
mkdir --parents testStatus/docs/$(repoName)/$(branchName)/latest
cp coveragelist.csv testStatus/logs/$(repoName)/$(branchName)/
cp coveragelist.csv testStatus/logs/$(repoName)/$(branchName)/$(datetime).csv
cp test_results.xml testStatus/logs/$(repoName)/$(branchName)/
cp test_results.xml testStatus/logs/$(repoName)/$(branchName)/$(datetime).xml
testStatus/source/status.py testStatus/logs/$(repoName)/$(branchName)/$(datetime).xml testStatus/logs/$(repoName)/$(branchName)/$(datetime).csv status.html $(repoName) $(repoName) $(branchName)
cd testStatus
cp ../status.html docs/$(repoName)/$(branchName)/latest/index.html
git add logs/$(repoName)/$(branchName)/coveragelist.csv
git add logs/$(repoName)/$(branchName)/test_results.xml
git add logs/$(repoName)/$(branchName)/$(datetime).xml
git add logs/$(repoName)/$(branchName)/$(datetime).csv
git add docs/$(repoName)/$(branchName)/latest/index.html
git commit -m "Test Status update for $(repoName)/$(branchName)"
git push
exit 0
displayName: 'Parse test results'
condition: always()