-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathconfig.yml
178 lines (175 loc) · 8.65 KB
/
config.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
version: 2.1
jobs:
build:
machine:
image: ubuntu-2204:2024.01.1
steps:
- checkout
# **do not edit: start
# Variable programmatically edited by /lib/perl/scripts/read_program_version.pl when changing release number
# /lib/perl/scripts/read_program_version.pl gets invoked by make beta|stable|major
- run: echo 'export RELEASE="0"' >> $BASH_ENV #UPDATE_RELEASE_STATUS
# **do not edit: end
- run: echo 'export RELEASE="'$RELEASE'"' > /home/circleci/env-vars
- run: mv ~/project ~/tcoffee
- run: mkdir -p ~/repo
- run: docker pull cbcrg/tcoffee-build-box:1.2
- run: mkdir $HOME/publish
- run: echo "export GIT_HASH=\$(git -C ~/tcoffee rev-parse --short HEAD)" >> $BASH_ENV
- run: echo $GIT_HASH > git_hash.log
- run: |
docker run -e BUILD_NUMBER=$CIRCLE_BUILD_NUM -e RELEASE=${RELEASE:-0} -e GIT_REVISION=$GIT_HASH \
-v $HOME/tcoffee:/root/tcoffee \
-v $HOME/repo:/root/repo \
-v $HOME/publish:/publish \
cbcrg/tcoffee-build-box:1.2 \
bash -c 'tcoffee/build/build.sh env tcoffee; mv /root/sandbox /publish'
- run: sudo chown -R $(id -u):$(id -g) ~/repo ~/publish
- persist_to_workspace:
root: /home/circleci
paths:
- publish
- tcoffee
- env-vars
# tests and publish test htmls
test:
machine:
image: ubuntu-2204:2024.01.1
steps:
- checkout
- attach_workspace:
at: /home/circleci
- run: cat /home/circleci/env-vars >> $BASH_ENV
- run:
command: |
echo $RELEASE > test.log
mv ~/publish/sandbox/build ~/tcoffee/docker/tcoffee
cd ~/tcoffee/docker/ && docker build -t xcoffee .
mkdir -p ~/publish/sandbox/test-results
(set +e
docker run -v ~/tcoffee:/root/tcoffee -v ~/publish/sandbox/test-results:/test-results xcoffee bash /root/tcoffee/docker/run-tests.sh
test_status=$?
set -x
## Modified
## rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ~/publish/sandbox/test-results/index.html [email protected]:~/Dropbox/Public/public_html/Packages/tests/test-results-linux-x64-$(date +"%Y-%m-%d-%H:%M").html
## TODO seems like the path ~/publish/sandbox/test-results/index.html does not exists
# aws s3 cp ~/publish/sandbox/test-results/index.html s3://tcoffee-packages/tests/test-results-linux-x64-$(date +"%Y-%m-%d-%H:%M").html
[[ "$test_status" != 0 ]] && exit $test_status || true
)
cd ~/ && docker save -o xcoffee.tar xcoffee
no_output_timeout: 30m
- persist_to_workspace:
root: /home/circleci
paths:
- xcoffee.tar
- env-vars
# publish artifacts
publish:
machine:
image: ubuntu-2204:2024.01.1
steps:
- attach_workspace:
at: /home/circleci
- run: cat /home/circleci/env-vars >> $BASH_ENV
- run: |
#
# This section will publish onto the websites the various elements produced by "make distribution"
# Note that since the distribution is usually triggered by the "git push" in "make release", the basic elements (doc, source and binary of the machine in which make release was launched) should already be published
#
echo $RELEASE > test_publish.log
if [[ $RELEASE == 1 ]]; then MODE=Stable; else MODE=Beta; fi;
# version=$(cat ~/publish/sandbox/.version); # version is increased by the CI build
version=$(cat ~/tcoffee/lib/version/version_number.version);
macosx_bversion=$(cat ~/tcoffee/binaries/macosx/version_number.version);
linux_bversion=$(cat ~/tcoffee/binaries/linux/version_number.version);
cp ~/tcoffee/build/web-readme.txt ~/publish/sandbox/distributions/$MODE/$version/readme.txt
#
# Start publishing the latest release -- make sure the receiving directory is not empty before deleting its content
## rsync -avzr -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ~/tcoffee/lib/version/version_number.version [email protected]:~/Dropbox/Public/public_html/Packages/$MODE/Latest;
## ssh [email protected] "rm ~/Dropbox/Public/public_html/Packages/$MODE/Latest/*;";
# Don't need to remove the content of the directory, sync --delete will do it
### aws s3 rm s3://tcoffee-packages/Stable/Latest/ --recursive --exclude "";
### aws s3 cp ~/tcoffee/lib/version/version_number.version s3://tcoffee-packages/$MODE/Latest/;
## rsync -avzr -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ~/publish/sandbox/distributions/$MODE/$version/* [email protected]:~/Dropbox/Public/public_html/Packages/$MODE/Latest;
aws s3 sync ~/publish/sandbox/distributions/$MODE/$version/ s3://tcoffee-packages/$MODE/Latest/ --delete;
aws s3 sync ~/publish/sandbox/distributions/$MODE/$version/ s3://tcoffee.org/Packages/$MODE/Latest/ --delete;
## rsync -avzr -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ~/tcoffee/docs/.html/* [email protected]:~/Dropbox/Public/public_html/Projects/tcoffee/documentation/;
aws s3 sync ~/tcoffee/docs/.html s3://tcoffee.org/Projects/tcoffee/documentation;
#
#Published binaries into the binary dir -- in case the macosx is available, publish it as well -- This will be the case when the release is launched from a mac
## rsync -avzr -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ~/tcoffee/binaries/macosx/t_coffee [email protected]:~/Dropbox/Public/public_html/Packages/Binaries/tcoffee/macosx/t_coffee.$macosx_bversion;
## rsync -avzr -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ~/tcoffee/binaries/linux/t_coffee [email protected]:~/Dropbox/Public/public_html/Packages/Binaries/tcoffee/linux/t_coffee.$linux_bversion;
aws s3 cp ~/tcoffee/binaries/macosx/t_coffee s3://tcoffee-packages/Binaries/tcoffee/macosx/t_coffee.$macosx_bversion; # only if launched from mac
aws s3 cp ~/tcoffee/binaries/linux/t_coffee s3://tcoffee-packages/Binaries/tcoffee/linux/t_coffee.$linux_bversion;
aws s3 cp ~/tcoffee/binaries/macosx/t_coffee s3://tcoffee.org/Binaries/tcoffee/macosx/t_coffee.$macosx_bversion; # only if launched from mac
aws s3 cp ~/tcoffee/binaries/linux/t_coffee s3://tcoffee.org/Packages/Binaries/tcoffee/linux/t_coffee.$linux_bversion;
aws s3 cp ~/tcoffee/binaries/macosx/t_coffee s3://tcoffee.org/Packages/Binaries/tcoffee/macosx/t_coffee.$macosx_bversion; # only if launched from mac
#
#Publish the various distribution files into archives
## ssh [email protected] "cp -r ~/Dropbox/Public/public_html/Packages/$MODE/Latest/* ~/Dropbox/Public/public_html/Packages/Archives";
aws s3 cp s3://tcoffee-packages/$MODE/Latest/ s3://tcoffee-packages/Archives/ --recursive;
#
- persist_to_workspace:
root: /home/circleci
paths:
- env-vars
# tag and push docker latest
push_image:
machine:
image: ubuntu-2204:2024.01.1
steps:
- attach_workspace:
at: /home/circleci
- checkout
- run: |
cat /home/circleci/env-vars >> $BASH_ENV
docker load -i ~/xcoffee.tar
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker tag xcoffee cbcrg/tcoffee:latest;
docker push cbcrg/tcoffee:latest;
# push stable
if [[ $RELEASE == 1 ]]; then
docker tag xcoffee cbcrg/tcoffee:stable;
docker push cbcrg/tcoffee:stable;
fi
# tag versions
version=$(cat ~/publish/sandbox/.version);
docker tag xcoffee cbcrg/tcoffee:$version;
docker push cbcrg/tcoffee:$version;
if [[ $RELEASE == 1 ]]; then
version+='_stable'
docker tag xcoffee cbcrg/tcoffee:$version;
docker push cbcrg/tcoffee:$version;
fi
# Workflow declaration
# See here (https://stackoverflow.com/questions/66689847/executing-a-circleci-job-only-when-tag-matches-a-certain-pattern)
# Another example https://goreleaser.com/ci/circle/
workflows:
build_test_publish:
jobs:
- build:
filters:
tags:
only: /.*/
- test:
requires:
- build
filters:
tags:
only: /.*/
- publish:
requires:
- test
filters:
branches:
ignore: /.*/
tags:
only: /^V.*/
- push_image:
requires:
- publish
filters:
branches:
ignore: /.*/
tags:
only: /^V.*/