|
1 | 1 | stages: |
2 | 2 | - test |
3 | | - - push-release |
4 | 3 | - build |
5 | | - - docs |
| 4 | + - publish |
| 5 | + - optional |
| 6 | + |
| 7 | +image: parity/rust:gitlab-ci |
| 8 | + |
6 | 9 | variables: |
7 | | - RUST_BACKTRACE: "1" |
8 | | - RUSTFLAGS: "" |
9 | | - CARGOFLAGS: "" |
10 | | - CI_SERVER_NAME: "GitLab CI" |
| 10 | + CI_SERVER_NAME: "GitLab CI" |
| 11 | + CARGO_HOME: "${CI_PROJECT_DIR}/.cargo" |
| 12 | + BUILD_TARGET: ubuntu |
| 13 | + BUILD_ARCH: amd64 |
| 14 | + CARGO_TARGET: x86_64-unknown-linux-gnu |
| 15 | + |
11 | 16 | cache: |
12 | | - key: "$CI_BUILD_STAGE-$CI_BUILD_REF_NAME" |
| 17 | + key: "${CI_JOB_NAME}" |
13 | 18 | paths: |
14 | | - - target/ |
15 | | - untracked: true |
16 | | -linux-amd64: |
17 | | - stage: build |
18 | | - image: parity/rust:gitlab-ci |
19 | | - only: |
20 | | - - beta |
21 | | - - tags |
22 | | - - stable |
23 | | - - triggers |
24 | | - script: |
25 | | - - rustup default stable |
26 | | - # ARGUMENTS: 1. BUILD_PLATFORM (target for binaries) 2. PLATFORM (target for cargo) 3. ARC (architecture) 4. & 5. CC & CXX flags 6. binary identifier |
27 | | - - scripts/gitlab-build.sh x86_64-unknown-linux-gnu x86_64-unknown-linux-gnu amd64 gcc g++ linux |
28 | | - tags: |
29 | | - - rust-stable |
30 | | - artifacts: |
31 | | - paths: |
32 | | - - parity.zip |
33 | | - name: "stable-x86_64-unknown-linux-gnu_parity" |
34 | | -linux-i686: |
35 | | - stage: build |
36 | | - image: parity/rust-i686:gitlab-ci |
37 | | - only: |
38 | | - - beta |
39 | | - - tags |
40 | | - - stable |
41 | | - - triggers |
42 | | - script: |
43 | | - - scripts/gitlab-build.sh i686-unknown-linux-gnu i686-unknown-linux-gnu i386 gcc g++ linux |
44 | | - tags: |
45 | | - - rust-i686 |
46 | | - artifacts: |
47 | | - paths: |
48 | | - - parity.zip |
49 | | - name: "i686-unknown-linux-gnu" |
50 | | - allow_failure: true |
51 | | -linux-armv7: |
52 | | - stage: build |
53 | | - image: parity/rust-armv7:gitlab-ci |
54 | | - only: |
55 | | - - beta |
56 | | - - tags |
57 | | - - stable |
58 | | - - triggers |
59 | | - script: |
60 | | - - scripts/gitlab-build.sh armv7-unknown-linux-gnueabihf armv7-unknown-linux-gnueabihf armhf arm-linux-gnueabihf-gcc arm-linux-gnueabihf-g++ linux |
61 | | - tags: |
62 | | - - rust-arm |
63 | | - artifacts: |
64 | | - paths: |
65 | | - - parity.zip |
66 | | - name: "armv7_unknown_linux_gnueabihf_parity" |
67 | | - allow_failure: true |
68 | | -linux-armhf: |
69 | | - stage: build |
70 | | - image: parity/rust-arm:gitlab-ci |
71 | | - only: |
72 | | - - beta |
73 | | - - tags |
| 19 | + - ./target |
| 20 | + - ./.cargo |
| 21 | + |
| 22 | +.releaseable_branches: # list of git refs for building GitLab artifacts (think "pre-release binaries") |
| 23 | + only: &releaseable_branches |
74 | 24 | - stable |
75 | | - - triggers |
76 | | - script: |
77 | | - - scripts/gitlab-build.sh arm-unknown-linux-gnueabihf arm-unknown-linux-gnueabihf armhf arm-linux-gnueabihf-gcc arm-linux-gnueabihf-g++ linux |
78 | | - tags: |
79 | | - - rust-arm |
80 | | - artifacts: |
81 | | - paths: |
82 | | - - parity.zip |
83 | | - name: "arm-unknown-linux-gnueabihf_parity" |
84 | | - allow_failure: true |
85 | | -linux-aarch64: |
86 | | - stage: build |
87 | | - image: parity/rust-arm64:gitlab-ci |
88 | | - only: |
89 | 25 | - beta |
90 | 26 | - tags |
91 | | - - stable |
92 | | - - triggers |
93 | | - script: |
94 | | - - scripts/gitlab-build.sh aarch64-unknown-linux-gnu aarch64-unknown-linux-gnu arm64 aarch64-linux-gnu-gcc aarch64-linux-gnu-g++ linux |
95 | | - tags: |
96 | | - - rust-arm |
| 27 | + |
| 28 | +.collect_artifacts: &collect_artifacts |
97 | 29 | artifacts: |
| 30 | + name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}" |
| 31 | + when: on_success |
| 32 | + expire_in: 1 mos |
98 | 33 | paths: |
99 | | - - parity.zip |
100 | | - name: "aarch64-unknown-linux-gnu_parity" |
101 | | -linux-snap: |
102 | | - stage: build |
103 | | - image: parity/snapcraft:gitlab-ci |
104 | | - only: |
105 | | - - stable |
106 | | - - beta |
107 | | - - tags |
108 | | - - triggers |
109 | | - script: |
110 | | - - scripts/gitlab-build.sh x86_64-unknown-snap-gnu x86_64-unknown-linux-gnu amd64 gcc g++ snap |
| 34 | + - artifacts/ |
| 35 | + |
| 36 | +.determine_version: &determine_version |
| 37 | + - VERSION="$(sed -r -n '1,/^version/s/^version = "([^"]+)".*$/\1/p' Cargo.toml)" |
| 38 | + - DATE_STR="$(date +%Y%m%d)" |
| 39 | + - ID_SHORT="$(echo ${CI_COMMIT_SHA} | cut -c 1-7)" |
| 40 | + - test "${CI_COMMIT_REF_NAME}" = "nightly" && VERSION="${VERSION}-${ID_SHORT}-${DATE_STR}" |
| 41 | + - export VERSION |
| 42 | + - echo "Version = ${VERSION}" |
| 43 | + |
| 44 | +test-linux: |
| 45 | + stage: test |
| 46 | + variables: |
| 47 | + RUN_TESTS: all |
| 48 | + script: |
| 49 | + - scripts/gitlab/test-all.sh stable |
111 | 50 | tags: |
112 | 51 | - rust-stable |
113 | | - artifacts: |
114 | | - paths: |
115 | | - - parity.zip |
116 | | - name: "stable-x86_64-unknown-snap-gnu_parity" |
117 | | -darwin: |
118 | | - stage: build |
119 | | - only: |
120 | | - - beta |
121 | | - - tags |
122 | | - - stable |
123 | | - - triggers |
| 52 | + |
| 53 | +build-linux: |
| 54 | + stage: build |
| 55 | + only: *releaseable_branches |
| 56 | + variables: |
| 57 | + CARGO_TARGET: x86_64-unknown-linux-gnu |
124 | 58 | script: |
125 | | - - scripts/gitlab-build.sh x86_64-apple-darwin x86_64-apple-darwin macos gcc g++ macos |
| 59 | + - scripts/gitlab/build-unix.sh |
| 60 | + <<: *collect_artifacts |
126 | 61 | tags: |
127 | | - - osx |
128 | | - artifacts: |
129 | | - paths: |
130 | | - - parity.zip |
131 | | - name: "x86_64-apple-darwin_parity" |
132 | | -windows: |
133 | | - cache: |
134 | | - key: "%CI_BUILD_STAGE%-%CI_BUILD_REF_NAME%" |
135 | | - untracked: true |
136 | | - stage: build |
137 | | - only: |
138 | | - - beta |
139 | | - - tags |
140 | | - - stable |
141 | | - - triggers |
142 | | - script: |
143 | | - - sh scripts/gitlab-build.sh x86_64-pc-windows-msvc x86_64-pc-windows-msvc amd64 "" "" windows |
| 62 | + - rust-stable |
| 63 | + |
| 64 | +build-darwin: |
| 65 | + stage: build |
| 66 | + only: *releaseable_branches |
| 67 | + variables: |
| 68 | + CARGO_TARGET: x86_64-apple-darwin |
| 69 | + CC: gcc |
| 70 | + CXX: g++ |
| 71 | + script: |
| 72 | + - scripts/gitlab/build-unix.sh |
| 73 | + tags: |
| 74 | + - rust-osx |
| 75 | + <<: *collect_artifacts |
| 76 | + |
| 77 | +build-windows: |
| 78 | + stage: build |
| 79 | + only: *releaseable_branches |
| 80 | + variables: |
| 81 | + CARGO_TARGET: x86_64-pc-windows-msvc |
| 82 | + script: |
| 83 | + - sh scripts/gitlab/build-windows.sh |
144 | 84 | tags: |
145 | 85 | - rust-windows |
146 | | - artifacts: |
147 | | - paths: |
148 | | - - parity.zip |
149 | | - name: "x86_64-pc-windows-msvc_parity" |
150 | | -android-armv7: |
151 | | - stage: build |
152 | | - image: parity/parity-android:latest |
153 | | - only: |
154 | | - - beta |
155 | | - - tags |
156 | | - - stable |
157 | | - - triggers |
158 | | - script: |
159 | | - - cargo build --target=armv7-linux-androideabi |
| 86 | + <<: *collect_artifacts |
| 87 | + |
| 88 | +publish-docker: |
| 89 | + stage: publish |
| 90 | + only: *releaseable_branches |
| 91 | + cache: {} |
| 92 | + dependencies: |
| 93 | + - build-linux |
160 | 94 | tags: |
161 | | - - rust-arm |
162 | | - allow_failure: true |
163 | | - artifacts: |
164 | | - paths: |
165 | | - - parity.zip |
166 | | - name: "armv7-linux-androideabi_parity" |
167 | | -docker-build: |
168 | | - stage: build |
169 | | - only: |
170 | | - - tags |
171 | | - - master |
172 | | - - beta |
173 | | - - stable |
174 | | - - triggers |
175 | | - before_script: |
176 | | - - docker info |
| 95 | + - shell |
177 | 96 | script: |
178 | | - - if [ "$CI_BUILD_REF_NAME" == "master" ]; then DOCKER_TAG="latest"; else DOCKER_TAG=$CI_BUILD_REF_NAME; fi |
179 | | - - echo "Tag:" $DOCKER_TAG |
180 | | - - docker login -u $Docker_Hub_User_Parity -p $Docker_Hub_Pass_Parity |
181 | | - - scripts/docker-build.sh $DOCKER_TAG |
182 | | - - docker logout |
183 | | - tags: |
184 | | - - docker |
185 | | -test-coverage: |
186 | | - stage: test |
| 97 | + - scripts/gitlab/publish-docker.sh parity |
| 98 | + |
| 99 | +publish-awss3: |
| 100 | + stage: publish |
| 101 | + only: *releaseable_branches |
| 102 | + cache: {} |
| 103 | + dependencies: |
| 104 | + - build-linux |
| 105 | + - build-darwin |
| 106 | + - build-windows |
| 107 | + before_script: *determine_version |
| 108 | + script: |
| 109 | + - scripts/gitlab/publish-awss3.sh |
| 110 | + tags: |
| 111 | + - shell |
| 112 | + |
| 113 | +docs-jsonrpc: |
| 114 | + stage: optional |
187 | 115 | only: |
188 | | - - master |
| 116 | + - tags |
| 117 | + cache: {} |
189 | 118 | script: |
190 | | - - scripts/gitlab-test.sh test-coverage |
| 119 | + - scripts/gitlab/docs-jsonrpc.sh |
191 | 120 | tags: |
192 | | - - kcov |
193 | | - allow_failure: true |
194 | | -test-rust-stable: |
195 | | - stage: test |
196 | | - image: parity/rust:gitlab-ci |
| 121 | + - shell |
| 122 | + |
| 123 | +cargo-audit: |
| 124 | + stage: optional |
197 | 125 | script: |
198 | | - - scripts/gitlab-test.sh stable |
| 126 | + - scripts/gitlab/cargo-audit.sh |
199 | 127 | tags: |
200 | 128 | - rust-stable |
201 | | -test-rust-beta: |
202 | | - stage: test |
203 | | - only: |
204 | | - - triggers |
205 | | - - master |
206 | | - image: parity/rust:gitlab-ci |
| 129 | + |
| 130 | +test-android: |
| 131 | + stage: optional |
| 132 | + image: parity/rust-android:gitlab-ci |
| 133 | + variables: |
| 134 | + CARGO_TARGET: armv7-linux-androideabi |
207 | 135 | script: |
208 | | - - scripts/gitlab-test.sh beta |
| 136 | + - scripts/gitlab/test-all.sh stable |
209 | 137 | tags: |
210 | | - - rust-beta |
211 | | - allow_failure: true |
212 | | -test-rust-nightly: |
213 | | - stage: test |
214 | | - only: |
215 | | - - triggers |
216 | | - - master |
217 | | - image: parity/rust:gitlab-ci |
218 | | - script: |
219 | | - - scripts/gitlab-test.sh nightly |
| 138 | + - rust-arm |
| 139 | + |
| 140 | +test-darwin: |
| 141 | + stage: optional |
| 142 | + variables: |
| 143 | + CARGO_TARGET: x86_64-apple-darwin |
| 144 | + CC: gcc |
| 145 | + CXX: g++ |
| 146 | + RUN_TESTS: cargo |
| 147 | + script: |
| 148 | + - scripts/gitlab/test-all.sh stable |
| 149 | + tags: |
| 150 | + - rust-osx |
| 151 | + |
| 152 | +test-windows: |
| 153 | + stage: optional |
| 154 | + variables: |
| 155 | + CARGO_TARGET: x86_64-pc-windows-msvc |
| 156 | + RUN_TESTS: cargo |
| 157 | + script: |
| 158 | + - sh scripts/gitlab/test-all.sh stable |
220 | 159 | tags: |
221 | | - - rust |
222 | | - - rust-nightly |
223 | | - allow_failure: true |
224 | | -json-rpc-docs: |
225 | | - stage: docs |
226 | | - only: |
227 | | - - tags |
228 | | - image: parity/rust:gitlab-ci |
| 160 | + - rust-windows |
| 161 | + |
| 162 | +test-beta: |
| 163 | + stage: optional |
| 164 | + variables: |
| 165 | + RUN_TESTS: cargo |
229 | 166 | script: |
230 | | - - scripts/gitlab-rpc-docs.sh |
| 167 | + - scripts/gitlab/test-all.sh beta |
231 | 168 | tags: |
232 | | - - docs |
233 | | - cache: {} |
234 | | -push-release: |
235 | | - stage: push-release |
236 | | - only: |
237 | | - - tags |
238 | | - - triggers |
239 | | - image: parity/rust:gitlab-ci |
| 169 | + - rust-beta |
| 170 | + |
| 171 | +test-nightly: |
| 172 | + stage: optional |
| 173 | + variables: |
| 174 | + RUN_TESTS: all |
240 | 175 | script: |
241 | | - - scripts/gitlab-push-release.sh |
| 176 | + - scripts/gitlab/test-all.sh nightly |
242 | 177 | tags: |
243 | | - - curl |
| 178 | + - rust-nightly |
0 commit comments