-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
79 lines (73 loc) · 1.93 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
---
stages:
- test
- build
- docker
.rust: &rust
image: rust:latest
cache:
paths:
- .cargo/
- target/
test:fmt:
stage: test
<<: *rust
before_script:
- export CARGO_HOME="$(pwd)/.cargo"
- rustup default nightly
- rustup component add rustfmt
script:
- cargo +nightly fmt -- --check
test:lint:
stage: test
<<: *rust
before_script:
- export CARGO_HOME="$(pwd)/.cargo"
- rustup default nightly
- rustup component add clippy
script:
- cargo +nightly clippy --all-targets --all-features -- -D warnings
test:unit:
stage: test
<<: *rust
before_script:
- export CARGO_HOME="$(pwd)/.cargo"
- rustup default nightly
script:
- cargo +nightly test
build:
stage: build
<<: *rust
before_script:
- export CARGO_HOME="$(pwd)/.cargo"
- rustup default nightly
- apt-get -qq update
- apt-get -qq install pysassc python3-pkg-resources
script:
- cargo +nightly build --release
- mkdir -p build/ build/assets/
- cp target/release/hydra-idp-ldap build/
- cp -r assets/static/ build/assets/
- cp -r assets/templates/ build/assets/
- pysassc --sourcemap -t compressed assets/scss/main.scss build/assets/static/css/main.css
artifacts:
name: "hydra-idp-ldap-${CI_COMMIT_TAG:-${CI_COMMIT_SHA}}"
paths:
- build
docker:
stage: docker
image: docker:19.03
only:
- main
- tags
services:
- docker:19.03-dind
variables:
DOCKER_IMAGE_NAME: ${DOCKER_REGISTRY}/${CI_PROJECT_NAME}
before_script:
- docker login -u ${DOCKER_REGISTRY_USER} -p ${DOCKER_REGISTRY_PASSWORD}
script:
- docker build -t ${DOCKER_IMAGE_NAME}:${CI_COMMIT_SHA} .
- if [ -n "${CI_COMMIT_TAG}" ]; then docker tag ${DOCKER_IMAGE_NAME}:${CI_COMMIT_SHA} ${DOCKER_IMAGE_NAME}:${CI_COMMIT_TAG}; fi
- docker push ${DOCKER_IMAGE_NAME}:${CI_COMMIT_SHA}
- if [ -n "${CI_COMMIT_TAG}" ]; then docker push ${DOCKER_IMAGE_NAME}:${CI_COMMIT_TAG}; fi