-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
71 lines (64 loc) · 2.23 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
image: rust:latest
variables:
CARGO_HOME: $CI_PROJECT_DIR/cargo
APT_CACHE_DIR: $CI_PROJECT_DIR/apt
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: "/certs"
before_script:
- apt-get update -o dir::cache::archives="$APT_CACHE_DIR" -yq
- apt-get install -o dir::cache::archives="$APT_CACHE_DIR" -y libsqlcipher-dev
- cargo install cargo-audit
- rustup component add rustfmt
- rustup component add clippy
cache:
key: "$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/apt/
- $CI_PROJECT_DIR/cargo/
- $CI_PROJECT_DIR/target/
stages:
- test
- docs
- publish_docker_images
test:
stage: test
tags:
- internal-memri
script:
- cargo fmt --all -- --check
- touch src/main.rs && cargo clippy --all-targets --all-features -- -D warnings
- if grep --recursive '::{' src/; then exit -1; fi
# cardo audit disabled for 1 week, see https://rustsec.org/advisories/RUSTSEC-2020-0159
- test "$(date +%s)" -lt "$(date -d 2021-10-26 +%s)" || cargo audit
- cargo test
- ./tools/test_curl.sh
publish_docker_images:
stage: publish_docker_images
tags:
- internal-memri
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
before_script:
- echo building for digital ocean
script:
- echo "{\"auths\":{\"$Docker_Repo\":{\"username\":\"$Access_Token\",\"password\":\"$Access_Token\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --build-arg use_kubernetes=true --destination $Docker_Repo/polis/pod-dev:$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --build-arg use_kubernetes=false --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
only:
- dev
- prod
pages:
stage: docs
script:
- rm -rf target/doc 2>/dev/null || true
- cargo doc --no-deps
- mkdir -p public/rustdoc
- mv -T target/doc public/rustdoc
- echo '<a href="./rustdoc/pod">rustdoc</a>' > public/index.html
artifacts:
paths:
- public
only:
- dev