Skip to content

Commit 27c4f25

Browse files
Deploy one artifact per platform (#213)
## What is the goal of this PR? We split the typedb-console distribution into 5: one per operating system+architecture. We now publish: 1) `linux-x86_64` 2) `linux-arm64` 3) `mac-x86_64` 4) `mac-arm64` 5) `windows-x86_64` We orchestrate all releases through CircleCI, for both artifacts and apt. Build targets in this repository are now platform-native, and deployment rules for specific platforms are protected by Bazel's platform target compatibility flags. ## What are the changes implemented in this PR? * Move all deployment to CircleCI, using native deployment * Create BUILD targets for every platform (OS + arch)
1 parent 82c485b commit 27c4f25

File tree

11 files changed

+619
-119
lines changed

11 files changed

+619
-119
lines changed

.circleci/config.yml

Lines changed: 365 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,365 @@
1+
#
2+
# Copyright (C) 2022 Vaticle
3+
#
4+
# This program is free software: you can redistribute it and/or modify
5+
# it under the terms of the GNU Affero General Public License as
6+
# published by the Free Software Foundation, either version 3 of the
7+
# License, or (at your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU Affero General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU Affero General Public License
15+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
#
17+
18+
version: 2.1
19+
20+
orbs:
21+
win: circleci/[email protected]
22+
23+
executors:
24+
linux-arm64:
25+
machine:
26+
image: ubuntu-2204:current
27+
resource_class: arm.medium
28+
working_directory: ~/typedb-console
29+
30+
linux-x86_64:
31+
machine:
32+
image: ubuntu-2204:current
33+
working_directory: ~/typedb-console
34+
35+
mac-arm64:
36+
macos:
37+
xcode: "14.2.0"
38+
resource_class: macos.m1.medium.gen1
39+
working_directory: ~/typedb-console
40+
41+
mac-x86_64:
42+
macos:
43+
xcode: "14.2.0"
44+
working_directory: ~/typedb-console
45+
46+
47+
commands:
48+
install-bazel-linux:
49+
parameters:
50+
arch:
51+
type: string
52+
steps:
53+
- run: |
54+
curl -OL "https://github.com/bazelbuild/bazelisk/releases/download/v1.17.0/bazelisk-linux-<<parameters.arch>>"
55+
sudo mv "bazelisk-linux-<<parameters.arch>>" /usr/local/bin/bazel
56+
chmod a+x /usr/local/bin/bazel
57+
58+
install-bazel-mac:
59+
steps:
60+
- run: brew install bazelisk
61+
62+
jobs:
63+
deploy-artifact-snapshot-linux-x86_64:
64+
executor: linux-x86_64
65+
steps:
66+
- checkout
67+
- install-bazel-linux:
68+
arch: amd64
69+
- run: |
70+
export DEPLOY_ARTIFACT_USERNAME=$REPO_VATICLE_USERNAME
71+
export DEPLOY_ARTIFACT_PASSWORD=$REPO_VATICLE_PASSWORD
72+
bazel run @vaticle_dependencies//tool/bazelinstall:remote_cache_setup.sh
73+
bazel run --define version=$(git rev-parse HEAD) //:deploy-linux-x86_64-targz -- snapshot
74+
75+
deploy-artifact-snapshot-linux-arm64:
76+
executor: linux-arm64
77+
steps:
78+
- checkout
79+
- install-bazel-linux:
80+
arch: arm64
81+
- run: |
82+
export DEPLOY_ARTIFACT_USERNAME=$REPO_VATICLE_USERNAME
83+
export DEPLOY_ARTIFACT_PASSWORD=$REPO_VATICLE_PASSWORD
84+
bazel run @vaticle_dependencies//tool/bazelinstall:remote_cache_setup.sh
85+
bazel run --define version=$(git rev-parse HEAD) //:deploy-linux-arm64-targz -- snapshot
86+
87+
deploy-artifact-snapshot-mac-x86_64:
88+
executor: mac-x86_64
89+
steps:
90+
- checkout
91+
- install-bazel-mac
92+
- run: |
93+
export DEPLOY_ARTIFACT_USERNAME=$REPO_VATICLE_USERNAME
94+
export DEPLOY_ARTIFACT_PASSWORD=$REPO_VATICLE_PASSWORD
95+
bazel run @vaticle_dependencies//tool/bazelinstall:remote_cache_setup.sh
96+
bazel run --define version=$(git rev-parse HEAD) //:deploy-mac-x86_64-zip -- snapshot
97+
98+
deploy-artifact-snapshot-mac-arm64:
99+
executor: mac-arm64
100+
steps:
101+
- checkout
102+
- install-bazel-mac
103+
- run: |
104+
export DEPLOY_ARTIFACT_USERNAME=$REPO_VATICLE_USERNAME
105+
export DEPLOY_ARTIFACT_PASSWORD=$REPO_VATICLE_PASSWORD
106+
bazel run @vaticle_dependencies//tool/bazelinstall:remote_cache_setup.sh
107+
bazel run --define version=$(git rev-parse HEAD) //:deploy-mac-arm64-zip -- snapshot
108+
109+
deploy-artifact-snapshot-windows-x86_64:
110+
executor:
111+
name: win/default
112+
shell: cmd.exe
113+
working_directory: ~/typedb-driver
114+
steps:
115+
- checkout
116+
- run: .circleci\windows\prepare.bat
117+
- run: .circleci\windows\deploy_snapshot.bat
118+
119+
deploy-apt-snapshot-x86_64:
120+
executor: linux-x86_64
121+
steps:
122+
- checkout
123+
- install-bazel-linux:
124+
arch: amd64
125+
- run: |
126+
export DEPLOY_APT_USERNAME=$REPO_VATICLE_USERNAME
127+
export DEPLOY_APT_PASSWORD=$REPO_VATICLE_PASSWORD
128+
bazel run @vaticle_dependencies//tool/bazelinstall:remote_cache_setup.sh
129+
bazel run --define version=$(git rev-parse HEAD) //:deploy-apt-x86_64 -- snapshot
130+
131+
deploy-apt-snapshot-arm64:
132+
executor: linux-arm64
133+
steps:
134+
- checkout
135+
- install-bazel-linux:
136+
arch: arm64
137+
- run: |
138+
export DEPLOY_APT_USERNAME=$REPO_VATICLE_USERNAME
139+
export DEPLOY_APT_PASSWORD=$REPO_VATICLE_PASSWORD
140+
bazel run @vaticle_dependencies//tool/bazelinstall:remote_cache_setup.sh
141+
bazel run --define version=$(git rev-parse HEAD) //:deploy-apt-arm64 -- snapshot
142+
143+
deploy-artifact-release-linux-x86_64:
144+
executor: linux-x86_64
145+
steps:
146+
- checkout
147+
- install-bazel-linux:
148+
arch: amd64
149+
- run: |
150+
export DEPLOY_ARTIFACT_USERNAME=$REPO_VATICLE_USERNAME
151+
export DEPLOY_ARTIFACT_PASSWORD=$REPO_VATICLE_PASSWORD
152+
bazel run @vaticle_dependencies//tool/bazelinstall:remote_cache_setup.sh
153+
bazel run --define version=$(cat VERSION) //:deploy-linux-x86_64-targz -- release
154+
- run: |
155+
mkdir -p ~/dist
156+
cp bazel-bin/typedb-console-linux-x86_64.zip ~/dist/typedb-console-linux-x86_64.zip
157+
- persist_to_workspace:
158+
root: ~/dist
159+
paths: ["./*"]
160+
161+
deploy-artifact-release-linux-arm64:
162+
executor: linux-arm64
163+
steps:
164+
- checkout
165+
- install-bazel-linux:
166+
arch: arm64
167+
- run: |
168+
export DEPLOY_ARTIFACT_USERNAME=$REPO_VATICLE_USERNAME
169+
export DEPLOY_ARTIFACT_PASSWORD=$REPO_VATICLE_PASSWORD
170+
bazel run @vaticle_dependencies//tool/bazelinstall:remote_cache_setup.sh
171+
bazel run --define version=$(cat VERSION) //:deploy-linux-arm64-targz -- release
172+
- run: |
173+
mkdir -p ~/dist
174+
cp bazel-bin/typedb-console-linux-arm64.zip ~/dist/typedb-console-linux-arm64.zip
175+
- persist_to_workspace:
176+
root: ~/dist
177+
paths: ["./*"]
178+
179+
deploy-artifact-release-mac-x86_64:
180+
executor: mac-x86_64
181+
steps:
182+
- checkout
183+
- install-bazel-mac
184+
- run: |
185+
export DEPLOY_ARTIFACT_USERNAME=$REPO_VATICLE_USERNAME
186+
export DEPLOY_ARTIFACT_PASSWORD=$REPO_VATICLE_PASSWORD
187+
bazel run @vaticle_dependencies//tool/bazelinstall:remote_cache_setup.sh
188+
bazel run --define version=$(cat VERSION) //:deploy-mac-x86_64-zip -- release
189+
- run: |
190+
mkdir -p ~/dist
191+
cp bazel-bin/typedb-console-mac-x86_64.zip ~/dist/typedb-console-mac-x86_64.zip
192+
- persist_to_workspace:
193+
root: ~/dist
194+
paths: ["./*"]
195+
196+
deploy-artifact-release-mac-arm64:
197+
executor: mac-arm64
198+
steps:
199+
- checkout
200+
- install-bazel-mac
201+
- run: |
202+
export DEPLOY_ARTIFACT_USERNAME=$REPO_VATICLE_USERNAME
203+
export DEPLOY_ARTIFACT_PASSWORD=$REPO_VATICLE_PASSWORD
204+
bazel run @vaticle_dependencies//tool/bazelinstall:remote_cache_setup.sh
205+
bazel run --define version=$(cat VERSION) //:deploy-mac-arm64-zip -- release
206+
- run: |
207+
mkdir -p ~/dist
208+
cp bazel-bin/typedb-console-mac-arm64.zip ~/dist/typedb-console-mac-arm64.zip
209+
- persist_to_workspace:
210+
root: ~/dist
211+
paths: [ "./*" ]
212+
213+
deploy-artifact-release-windows-x86_64:
214+
executor:
215+
name: win/default
216+
shell: cmd.exe
217+
working_directory: ~/typedb-driver
218+
steps:
219+
- checkout
220+
- run: .circleci\windows\prepare.bat
221+
- run: .circleci\windows\deploy_release.bat
222+
- run: |
223+
mkdir -p ~/dist
224+
cp bazel-bin/typedb-console-mac-arm64.zip ~/dist/typedb-console-windows-x86_64.zip
225+
- persist_to_workspace:
226+
root: ~/dist
227+
paths: [ "./*" ]
228+
229+
deploy-apt-release-x86_64:
230+
executor: linux-x86_64
231+
steps:
232+
- checkout
233+
- install-bazel-mac
234+
- run: |
235+
export DEPLOY_APT_USERNAME=$REPO_VATICLE_USERNAME
236+
export DEPLOY_APT_PASSWORD=$REPO_VATICLE_PASSWORD
237+
bazel run @vaticle_dependencies//tool/bazelinstall:remote_cache_setup.sh
238+
bazel run --define version=$(cat VERSION) //:deploy-apt-x86_64 -- release
239+
- run: |
240+
mkdir -p ~/dist
241+
cp bazel-bin/typedb-console__x86_64.deb ~/dist/typedb-console__x86_64.deb
242+
- persist_to_workspace:
243+
root: ~/dist
244+
paths: ["./*"]
245+
246+
deploy-apt-release-arm64:
247+
executor: linux-arm64
248+
steps:
249+
- checkout
250+
- install-bazel-mac
251+
- run: |
252+
export DEPLOY_APT_USERNAME=$REPO_VATICLE_USERNAME
253+
export DEPLOY_APT_PASSWORD=$REPO_VATICLE_PASSWORD
254+
bazel run @vaticle_dependencies//tool/bazelinstall:remote_cache_setup.sh
255+
bazel run --define version=$(cat VERSION) //:deploy-apt-arm64 -- release
256+
- run: |
257+
mkdir -p ~/dist
258+
cp bazel-bin/typedb-console__arm64.deb ~/dist/typedb-console__arm64.deb
259+
- persist_to_workspace:
260+
root: ~/dist
261+
paths: ["./*"]
262+
263+
deploy-github:
264+
executor: linux-x86_64
265+
steps:
266+
- attach_workspace:
267+
at: ~/dist
268+
- checkout
269+
- install-bazel-linux:
270+
arch: amd64
271+
- run:
272+
name: "Publish Draft Release on GitHub"
273+
command: |
274+
wget https://github.com/tcnksm/ghr/releases/download/v0.12.1/ghr_v0.12.1_linux_amd64.tar.gz
275+
tar -xf ghr_v0.12.1_linux_amd64.tar.gz
276+
ghr_v0.12.1_linux_amd64/ghr -t ${REPO_GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} \
277+
-r ${CIRCLE_PROJECT_REPONAME} -n "TypeDB Console $(cat VERSION)" -b "$(cat ./RELEASE_NOTES_LATEST.md)" \
278+
-c ${CIRCLE_SHA1} -delete -draft $(cat VERSION) ~/dist/
279+
280+
release-cleanup:
281+
executor: linux-x86_64
282+
steps:
283+
- checkout
284+
- run: git push --delete https://[email protected]/vaticle/typedb-console.git $CIRCLE_BRANCH
285+
286+
287+
workflows:
288+
snapshot:
289+
jobs:
290+
- deploy-artifact-snapshot-linux-x86_64:
291+
filters:
292+
branches:
293+
only: [master, development, platform-specific-releases]
294+
- deploy-artifact-snapshot-linux-arm64:
295+
filters:
296+
branches:
297+
only: [master, development, platform-specific-releases]
298+
- deploy-artifact-snapshot-mac-x86_64:
299+
filters:
300+
branches:
301+
only: [master, development, platform-specific-releases]
302+
- deploy-artifact-snapshot-mac-arm64:
303+
filters:
304+
branches:
305+
only: [master, development, platform-specific-releases]
306+
- deploy-artifact-snapshot-windows-x86_64:
307+
filters:
308+
branches:
309+
only: [master, development, platform-specific-releases]
310+
- deploy-apt-snapshot-x86_64:
311+
filters:
312+
branches:
313+
only: [master, development]
314+
- deploy-apt-snapshot-arm64:
315+
filters:
316+
branches:
317+
only: [ master, development, platform-specific-releases ]
318+
release:
319+
jobs:
320+
- deploy-artifact-release-linux-x86_64:
321+
filters:
322+
branches:
323+
only: [release]
324+
- deploy-artifact-release-linux-arm64:
325+
filters:
326+
branches:
327+
only: [release]
328+
- deploy-artifact-release-mac-x86_64:
329+
filters:
330+
branches:
331+
only: [release]
332+
- deploy-artifact-release-mac-arm64:
333+
filters:
334+
branches:
335+
only: [release]
336+
- deploy-artifact-release-windows-x86_64:
337+
filters:
338+
branches:
339+
only: [release]
340+
- deploy-apt-release-x86_64:
341+
filters:
342+
branches:
343+
only: [release]
344+
- deploy-apt-release-arm64:
345+
filters:
346+
branches:
347+
only: [release]
348+
- deploy-github:
349+
filters:
350+
branches:
351+
only: [release]
352+
requires:
353+
- deploy-artifact-release-linux-x86_64
354+
- deploy-artifact-release-linux-arm64
355+
- deploy-artifact-release-mac-x86_64
356+
- deploy-artifact-release-mac-arm64
357+
- deploy-artifact-release-windows-x86_64
358+
- deploy-apt-release-x86_64
359+
- deploy-apt-release-arm64
360+
- release-cleanup:
361+
filters:
362+
branches:
363+
only: [release]
364+
requires:
365+
- deploy-github
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright (C) 2022 Vaticle
3+
4+
This program is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU Affero General Public License as
6+
published by the Free Software Foundation, either version 3 of the
7+
License, or (at your option) any later version.
8+
9+
This program is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU Affero General Public License for more details.
13+
14+
You should have received a copy of the GNU Affero General Public License
15+
along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
17+
-->
18+
19+
<packages>
20+
<package id="bazelisk" version="1.17.0"/>
21+
<package id="python" version="3.9.6"/>
22+
<package id="openjdk11" version="11.0.9.11"/>
23+
</packages>

0 commit comments

Comments
 (0)