-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
148 lines (137 loc) · 4.26 KB
/
.gitlab-ci.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
image: docker.bestsens.local/bone/rust-build-image:master
variables:
GIT_SUBMODULE_STRATEGY: recursive
CARGO_HOME: ${CI_PROJECT_DIR}/.cargo
stages:
- build
- deploy
- release
cache:
- key: "global_cache"
paths:
- .cargo
- target
## Build ##############################################################################################################
build:x86_64:
stage: build
cache:
paths:
- .cargo
- target
artifacts:
expire_in: 4 weeks
name: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}_x86_64"
paths:
- bone_shell
- LICENSE
script:
- cargo build --release
- cp target/release/bone_shell ./bone_shell
build:x86_64-pc-windows-gnu:
stage: build
cache:
paths:
- .cargo
- target
artifacts:
expire_in: 4 weeks
name: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}_x86_64-pc-windows-gnu"
paths:
- bone_shell.exe
- LICENSE
script:
- cargo build --release --target=x86_64-pc-windows-gnu
- cp target/x86_64-pc-windows-gnu/release/bone_shell.exe ./bone_shell.exe
build:armv7:
image: docker.bestsens.local/bone/musl-build-image
stage: build
cache:
paths:
- .cargo
- target
artifacts:
expire_in: 4 weeks
name: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}_armv7"
paths:
- bone_shell
- LICENSE
script:
- CC=arm-bemos-linux-musleabihf-gcc cargo build --release --target=armv7-unknown-linux-musleabihf
- cp target/armv7-unknown-linux-musleabihf/release/bone_shell ./bone_shell
## Create persistent archives #########################################################################################
.deploy: &deploy
stage: deploy
when: on_success
only:
- tags
variables:
GIT_STRATEGY: none
script:
- echo '1'
deploy:x86_64:
<<: *deploy
script:
- echo GE_JOB_ID_x86_64=$CI_JOB_ID >> generate_executables.env
artifacts:
name: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_x86_64"
paths:
- bone_shell
- LICENSE
reports:
dotenv: generate_executables.env
dependencies:
- build:x86_64
deploy:x86_64-pc-windows-gnu:
<<: *deploy
script:
- echo GE_JOB_ID_x86_64_pc_windows_gnu=$CI_JOB_ID >> generate_executables.env
artifacts:
name: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_x86_64-pc-windows-gnu"
paths:
- bone_shell.exe
- LICENSE
reports:
dotenv: generate_executables.env
dependencies:
- build:x86_64-pc-windows-gnu
deploy:armv7:
<<: *deploy
script:
- echo GE_JOB_ID_armv7=$CI_JOB_ID >> generate_executables.env
artifacts:
name: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_armv7"
paths:
- bone_shell
- LICENSE
reports:
dotenv: generate_executables.env
dependencies:
- build:armv7
## Release ############################################################################################################
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- job: deploy:x86_64
artifacts: true
- job: deploy:x86_64-pc-windows-gnu
artifacts: true
- job: deploy:armv7
artifacts: true
only:
- tags
script:
- echo 'releasing $_CI_COMMIT_TAG'
release:
name: '$CI_COMMIT_TAG'
description: 'Automatically created'
tag_name: '$CI_COMMIT_TAG'
ref: '$CI_COMMIT_TAG'
assets:
links:
- name: "Linux x86_64"
url: "https://gitlab.bestsens.local/bone/bone_shell/-/jobs/${GE_JOB_ID_x86_64}/artifacts/download"
- name: "Linux ARM"
url: "https://gitlab.bestsens.local/bone/bone_shell/-/jobs/${GE_JOB_ID_x86_64_pc_windows_gnu}/artifacts/download"
- name: "Windows x86_64"
url: "https://gitlab.bestsens.local/bone/bone_shell/-/jobs/${GE_JOB_ID_armv7}/artifacts/download"