-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
119 lines (112 loc) · 3.25 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
default:
before_script:
- rustc --version
- cargo --version
- sed -i "s/ssh:\/\/git/https:\/\/gitlab-ci-token:$CI_JOB_TOKEN/" Cargo.toml
- apt-get update
- apt-get install -y gfortran
- apt-get install -y build-essential
stages:
- style
- test
- deploy
linting:
image: "gitlab.hpi.de/akita/dependency_proxy/containers/rust:latest"
stage: style
tags:
- akita
script:
- rustup component add clippy
- cargo clippy
formatting:
image: "gitlab.hpi.de/akita/dependency_proxy/containers/rust:latest"
stage: style
tags:
- akita
script:
- rustup component add rustfmt
- cargo fmt -- --check
coverage:
image: "gitlab.hpi.de/akita/dependency_proxy/containers/rustdocker/rust:nightly"
stage: test
tags:
- akita
variables:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "coverage-%p-%m.profraw"
script:
- apt-get install -y python3-pip
- rustup component add llvm-tools-preview
- cargo test
# generate html report
- cargo install grcov
- grcov . --binary-path ./target/debug/ -s . -t html --branch --ignore-not-existing --ignore "*cargo*" -o ./coverage/
# generate cobertura report for gitlab integration
- pip3 install lcov_cobertura
- grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "*cargo*" -o coverage.lcov
- python3 /usr/local/lib/python3.*/dist-packages/lcov_cobertura/lcov_cobertura.py coverage.lcov
# output coverage summary for gitlab parsing
- apt-get update && apt-get install -y lcov
- lcov --summary coverage.lcov
artifacts:
paths:
- 'coverage'
reports:
cobertura: coverage.xml
deploy-docker:
stage: deploy
only:
- main
tags:
- akita
- docker
variables:
DOCKER_DRIVER: "overlay2"
DOCKER_TLS_CERTDIR: "/certs"
REGISTRY_NAME: "registry.gitlab.hpi.de"
BASE_IMAGE_NAME: "registry.gitlab.hpi.de/akita/i"
REGISTRY_USERNAME: "ci-job-registry"
REGISTRY_PASSWORD: "${CI_JOB_REGISTRY_TOKEN}"
IMAGE_TAG: "${BASE_IMAGE_NAME}/s2gpp"
services:
- name: "gitlab.hpi.de/akita/dependency_proxy/containers/docker:20.10.2-dind"
alias: docker
before_script:
- docker info
- docker login -u $REGISTRY_USERNAME -p $REGISTRY_PASSWORD $REGISTRY_NAME
script:
- S2GPP_VERSION=$(sed -n "s/^version = \"\(.*\)\"$/\1/p" Cargo.toml)
- docker build -t "${IMAGE_TAG}:${S2GPP_VERSION}" .
- docker push "${IMAGE_TAG}:${S2GPP_VERSION}"
deploy-pypi:
stage: deploy
only:
- main
tags:
- akita
- python
- conda
variables:
PYPI_TOKEN: $PYPI_TOKEN
PYPI_USER: __token__
before_script:
- apt-get update
- apt-get install -y curl make gfortran build-essential
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- export PATH=/root/.cargo/bin:$PATH
- rustc --version
- cargo --version
script:
- make build
- TWINE_PASSWORD=${PYPI_TOKEN} TWINE_USERNAME=${PYPI_USER} twine upload --verbose ./wheels/s2gpp-*.whl
deploy-cargo:
image: "gitlab.hpi.de/akita/dependency_proxy/containers/rust:latest"
stage: deploy
only:
- main
tags:
- akita
variables:
CARGO_REGISTRY_TOKEN: $CARGO_REGISTRY_TOKEN
script:
- cargo publish --token=${CARGO_REGISTRY_TOKEN}