forked from interlay/interbtc-clients
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
119 lines (111 loc) · 3.69 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
image: "registry.gitlab.com/interlay/containers/rust-base:nightly-2021-03-15"
.rust-base-job:
variables:
CARGO_HOME: /cargo
RUSTC_WRAPPER: /usr/local/bin/sccache
before_script:
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$GH_INTERBTC_SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- rustup show
- rustc --version
- rustfmt --version
- cargo --version
- SCCACHE_START_SERVER=1 SCCACHE_IDLE_TIMEOUT=0 sccache
- sccache -s
.only-refs: &only_refs
only:
- tags
- master
- dev
workflow:
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
stages:
- test
- build
- deploy
- release
test-clients:
stage: test
extends:
- .rust-base-job
variables:
BITCOIN_RPC_URL: "http://localhost:18443"
BITCOIN_RPC_USER: "rpcuser"
BITCOIN_RPC_PASS: "rpcpassword"
services:
- name: ruimarinho/bitcoin-core:0.21-alpine
alias: bitcoind
command:
- bitcoind
- -regtest
- -rpcuser=rpcuser
- -rpcpassword=rpcpassword
script:
- cargo fmt -- --check
- cargo check --workspace --release
- cargo clippy --workspace --release
- cargo test --workspace --release
- cargo test --manifest-path bitcoin/Cargo.toml --test "*" --features uses-bitcoind -- --test-threads=1
cache:
key: cargo
paths:
- .cargo
build-clients:
stage: build
extends:
- .rust-base-job
<<: *only_refs
script:
- cargo check --workspace --release --target $PLATFORM
- cargo build --workspace --release --target $PLATFORM
- ls -l target/$PLATFORM/release/
parallel:
matrix:
- PLATFORM: x86_64-unknown-linux-gnu
FILE_EXTENSION: [""]
# - PLATFORM: x86_64-pc-windows-gnu
# FILE_EXTENSION: [".exe"]
artifacts:
name: "${CI_COMMIT_REF_SLUG}"
paths:
- target/$PLATFORM/release/oracle${FILE_EXTENSION}
- target/$PLATFORM/release/vault${FILE_EXTENSION}
- target/$PLATFORM/release/faucet${FILE_EXTENSION}
build-docker-images:
stage: deploy
parallel:
matrix:
- IMAGE:
[
"oracle",
"vault",
"faucet",
]
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- |
/kaniko/executor \
--build-arg BINARY=${IMAGE} \
--build-arg PROFILE="x86_64-unknown-linux-gnu/release" \
--context ${CI_PROJECT_DIR} \
--dockerfile ${CI_PROJECT_DIR}/.deploy/Dockerfile \
--destination ${CI_REGISTRY_IMAGE}/${IMAGE}:${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}-$(date +%s) \
--destination ${CI_REGISTRY_IMAGE}/${IMAGE}:${CI_COMMIT_REF_NAME}
<<: *only_refs
release-github:
stage: release
image: registry.gitlab.com/interlay/containers/github-publisher:master
script:
- gh auth status
- git-chglog --output CHANGELOG.md $CI_COMMIT_TAG
- gh release -R https://github.com/interlay/interbtc-clients create $CI_COMMIT_TAG --title $CI_COMMIT_TAG -F CHANGELOG.md -d target/x86_64-unknown-linux-gnu/release/*
only:
- tags