-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
111 lines (103 loc) · 2.95 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
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
.matrix-common:
tags:
- akita
- conda
before_script: &common-before-script
- export PIP_CACHE_DIR="/opt/cache/pip"
- echo "Setting up conda environment and installing dependencies"
- conda create -y -n meanshift python=${PYTHON_VERSION:-3.7}
- source activate meanshift
- pip install -r requirements.txt
- python --version
- 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
parallel:
matrix:
- PYTHON_VERSION: ["3.7", "3.8", "3.9"]
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:
coverage_report:
coverage_format: cobertura
path: coverage.xml
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}
deploy-pypi:
extends: .matrix-common
stage: deploy
only:
- main
tags:
- akita
- python
- conda
variables:
PYPI_TOKEN: $PYPI_TOKEN
PYPI_USER: __token__
script:
- make build
- TWINE_PASSWORD=${PYPI_TOKEN} TWINE_USERNAME=${PYPI_USER} twine upload --verbose ./wheels/meanshift_rs-*.whl