Skip to content

Commit 047e39d

Browse files
authored
Merge pull request #23 from StuartWheater/to_upstream
Restructure 'azure-pipelines.yml' for 'jobs'
2 parents eb40425 + 5922773 commit 047e39d

File tree

1 file changed

+114
-101
lines changed

1 file changed

+114
-101
lines changed

azure-pipelines.yml

Lines changed: 114 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,118 @@
1-
pool:
2-
vmImage: 'Ubuntu 16.04'
1+
schedules:
2+
- cron: "0 0 * * *"
3+
displayName: Daily midnight build
4+
branches:
5+
include:
6+
- master
7+
always: true
38

4-
variables:
9+
jobs:
10+
- job: DataSHIELD_CI
11+
12+
timeoutInMinutes: 90
13+
14+
pool:
15+
vmImage: 'Ubuntu 16.04'
16+
17+
variables:
518
datetime: $[format('{0:yyyyMMddHHmmss}', pipeline.startTime)]
619
repoName: 'dsBaseClient'
720

8-
steps:
9-
- bash: |
10-
sudo service mysql stop
11-
sudo apt-get update
12-
sudo apt-get remove --purge mysql-client mysql-server mysql-common -y
13-
sudo apt-get purge mysql-client mysql-server mysql-common -y
14-
sudo apt-get autoremove -y
15-
sudo apt-get autoclean -y
16-
sudo rm -rf /var/lib/mysql/
17-
18-
wget -nv https://apt.puppetlabs.com/puppet5-release-xenial.deb
19-
sudo dpkg -i puppet5-release-xenial.deb
20-
sudo apt-get install -qq -f
21-
sudo apt-get update
22-
sudo rm -f puppet5-release-xenial.deb
23-
24-
sudo apt-get install puppet-agent -y
25-
26-
sudo apt-get clean all
27-
sudo apt-get update
28-
sudo apt-get autoremove -y
29-
sudo apt-get clean all
30-
31-
sudo /opt/puppetlabs/puppet/bin/gem install r10k
32-
33-
echo -n "Puppet version: "
34-
/opt/puppetlabs/bin/puppet --version
35-
/opt/puppetlabs/puppet/bin/r10k version
36-
37-
git clone -b ubuntu16 https://github.com/datashield/datashield-infrastructure.git ../datashield-infrastructure
38-
pushd ../datashield-infrastructure/puppet/environments/datashield_azurepipelines && sudo /opt/puppetlabs/puppet/bin/r10k puppetfile install && popd
39-
sudo /opt/puppetlabs/bin/puppet apply azure-pipelines_site.pp --environment datashield_azurepipelines --environmentpath ../datashield-infrastructure/puppet/environments
40-
displayName: 'Install DataSHIELD server'
41-
42-
- bash: |
43-
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
44-
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/'
45-
sudo apt-get update
46-
sudo apt-get install -qq libxml2-dev libcurl4-openssl-dev libssl-dev libgsl-dev -y
47-
sudo apt-get install -qq r-base -y
48-
sudo R -q -e "install.packages('devtools', dependencies=TRUE)"
49-
sudo R -q -e "install.packages('covr', dependencies=TRUE)"
50-
sudo R -q -e "devtools::install_github(repo='datashield/opal', ref='master')"
51-
sudo R -q -e "devtools::install_github(repo='datashield/opaladmin', ref='master')"
52-
displayName: 'Install R client'
53-
54-
- bash: |
55-
R -q -e "library('devtools'); devtools::check(args = c('--no-examples'))" | tee azure-pipelines_check.Rout
56-
grep --quiet "0 error" azure-pipelines_check.Rout && grep --quiet "0 notes" azure-pipelines_check.Rout
57-
displayName: 'Devtools checks'
58-
condition: always()
59-
60-
- bash: |
61-
R -q -e "library('devtools'); devtools::test()" | tee azure-pipelines_test.Rout
62-
grep --quiet "Failed: 0" azure-pipelines_test.Rout
63-
displayName: 'Devtools tests'
64-
condition: always()
65-
66-
- bash: |
67-
R -q -e "library('devtools'); options(testthat.output_file = 'test_results.xml'); devtools::test(reporter = 'junit')"
68-
displayName: 'Devtools test reports'
69-
condition: always()
70-
71-
- bash: |
72-
./checkDocumentationUpdated.sh
73-
displayName: 'Check documents'
74-
condition: always()
75-
76-
- bash: |
77-
git config --global user.email "you@example.com"
78-
git config --global user.name "Azure pipeline"
79-
git clone https://datashield:$(GHPAT)@github.com/datashield/$(repoName).git $(repoName)
80-
git clone https://datashield:$(GHPAT)@github.com/datashield/testStatus.git testStatus
81-
82-
cd $(repoName)
83-
sudo R -q -e 'library(covr);write.csv(coverage_to_list(covr::package_coverage(type = c("none"), code = c('"'"'testthat::test_package("$(repoName)", reporter = "silent", stop_on_failure = FALSE)'"'"'))),"../coveragelist.csv")'
84-
cd ../
85-
86-
cp coveragelist.csv testStatus/logs/$(repoName)/
87-
cp coveragelist.csv testStatus/logs/$(repoName)/$(datetime).csv
88-
cp test_results.xml testStatus/logs/$(repoName)/
89-
cp test_results.xml testStatus/logs/$(repoName)/$(datetime).xml
90-
91-
testStatus/source/status.py testStatus/logs/$(repoName)/$(datetime).xml testStatus/logs/$(repoName)/$(datetime).csv status.html $(repoName)
92-
93-
cd testStatus
94-
cp ../status.html docs/$(repoName)/latest/index.html
95-
96-
git add logs/$(repoName)/coveragelist.csv
97-
git add logs/$(repoName)/test_results.xml
98-
git add logs/$(repoName)/$(datetime).xml
99-
git add logs/$(repoName)/$(datetime).csv
100-
git add docs/$(repoName)/latest/index.html
101-
git commit -m "adding new test_results file"
102-
git push
103-
exit 0
104-
displayName: 'Parse test results'
105-
condition: always()
21+
steps:
22+
- bash: |
23+
sudo service mysql stop
24+
sudo apt-get update
25+
sudo apt-get remove --purge mysql-client mysql-server mysql-common -y
26+
sudo apt-get purge mysql-client mysql-server mysql-common -y
27+
sudo apt-get autoremove -y
28+
sudo apt-get autoclean -y
29+
sudo rm -rf /var/lib/mysql/
30+
31+
wget -nv https://apt.puppetlabs.com/puppet5-release-xenial.deb
32+
sudo dpkg -i puppet5-release-xenial.deb
33+
sudo apt-get install -qq -f
34+
sudo apt-get update
35+
sudo rm -f puppet5-release-xenial.deb
36+
37+
sudo apt-get install puppet-agent -y
38+
39+
sudo apt-get clean all
40+
sudo apt-get update
41+
sudo apt-get autoremove -y
42+
sudo apt-get clean all
43+
44+
sudo /opt/puppetlabs/puppet/bin/gem install r10k
45+
46+
echo -n "Puppet version: "
47+
/opt/puppetlabs/bin/puppet --version
48+
/opt/puppetlabs/puppet/bin/r10k version
49+
50+
git clone -b ubuntu16 https://github.com/datashield/datashield-infrastructure.git ../datashield-infrastructure
51+
pushd ../datashield-infrastructure/puppet/environments/datashield_azurepipelines && sudo /opt/puppetlabs/puppet/bin/r10k puppetfile install && popd
52+
sudo /opt/puppetlabs/bin/puppet apply azure-pipelines_site.pp --environment datashield_azurepipelines --environmentpath ../datashield-infrastructure/puppet/environments
53+
displayName: 'Install DataSHIELD server'
54+
55+
- bash: |
56+
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
57+
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/'
58+
sudo apt-get update
59+
sudo apt-get install -qq libxml2-dev libcurl4-openssl-dev libssl-dev libgsl-dev -y
60+
sudo apt-get install -qq r-base -y
61+
sudo R -q -e "install.packages('devtools', dependencies=TRUE)"
62+
sudo R -q -e "install.packages('covr', dependencies=TRUE)"
63+
sudo R -q -e "devtools::install_github(repo='datashield/opal', ref='master')"
64+
sudo R -q -e "devtools::install_github(repo='datashield/opaladmin', ref='master')"
65+
displayName: 'Install R client'
66+
67+
- bash: |
68+
R -q -e "library('devtools'); devtools::check(args = c('--no-examples'))" | tee azure-pipelines_check.Rout
69+
grep --quiet "0 error" azure-pipelines_check.Rout && grep --quiet "0 notes" azure-pipelines_check.Rout
70+
displayName: 'Devtools checks'
71+
condition: always()
72+
73+
- bash: |
74+
R -q -e "library('devtools'); devtools::test()" | tee azure-pipelines_test.Rout
75+
grep --quiet "Failed: 0" azure-pipelines_test.Rout
76+
displayName: 'Devtools tests'
77+
condition: always()
78+
79+
- bash: |
80+
R -q -e "library('devtools'); options(testthat.output_file = 'test_results.xml'); devtools::test(reporter = 'junit')"
81+
displayName: 'Devtools test reports'
82+
condition: always()
83+
84+
- bash: |
85+
./checkDocumentationUpdated.sh
86+
displayName: 'Check documents'
87+
condition: always()
88+
89+
- bash: |
90+
git config --global user.email "you@example.com"
91+
git config --global user.name "Azure pipeline"
92+
git clone https://datashield:$(GHPAT)@github.com/datashield/$(repoName).git $(repoName)
93+
git clone https://datashield:$(GHPAT)@github.com/datashield/testStatus.git testStatus
94+
95+
cd $(repoName)
96+
sudo R -q -e 'library(covr);write.csv(coverage_to_list(covr::package_coverage(type = c("none"), code = c('"'"'testthat::test_package("$(repoName)", reporter = "silent", stop_on_failure = FALSE)'"'"'))),"../coveragelist.csv")'
97+
cd ../
98+
99+
cp coveragelist.csv testStatus/logs/$(repoName)/
100+
cp coveragelist.csv testStatus/logs/$(repoName)/$(datetime).csv
101+
cp test_results.xml testStatus/logs/$(repoName)/
102+
cp test_results.xml testStatus/logs/$(repoName)/$(datetime).xml
103+
104+
testStatus/source/status.py testStatus/logs/$(repoName)/$(datetime).xml testStatus/logs/$(repoName)/$(datetime).csv status.html $(repoName)
105+
106+
cd testStatus
107+
cp ../status.html docs/$(repoName)/latest/index.html
108+
109+
git add logs/$(repoName)/coveragelist.csv
110+
git add logs/$(repoName)/test_results.xml
111+
git add logs/$(repoName)/$(datetime).xml
112+
git add logs/$(repoName)/$(datetime).csv
113+
git add docs/$(repoName)/latest/index.html
114+
git commit -m "adding new test_results file"
115+
git push
116+
exit 0
117+
displayName: 'Parse test results'
118+
condition: always()

0 commit comments

Comments
 (0)