This repository has been archived by the owner on Nov 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
87 lines (74 loc) · 2.6 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
image: "projects.cispa.saarland:5005/bushart/docker/rust-ci:master"
cache:
paths:
- cargo
variables:
CARGO_HOME: "$CI_PROJECT_DIR/cargo"
GIT_DEPTH: "3"
LANG: "C.UTF-8"
LC_ALL: "C.UTF-8"
MPLBACKEND: "Agg"
PYLIB_FORCE_DEBUG: "TRUE"
RUST_BACKTRACE: "1"
SCCACHE_CACHE_SIZE: "5G"
SCCACHE_DIR: "/sccache"
# Use cargo to test the project
test:cargo:
before_script:
# For some reason this cannot be in the variables section
- export PATH="$CARGO_HOME/bin:$PATH"
- python3 -m pip install pipenv
# Install rust tools
- which cargo-install-update || cargo install cargo-update
- cargo install-update --allow-no-update sccache
# This may only be set AFTER installing sccache
- export RUSTC_WRAPPER="sccache"
- export CC="sccache gcc"
- export CXX="sccache g++"
# Update all tools and install new ones
- cargo install-update --all --git --allow-no-update cargo-cache cargo2junit
script:
# Print version info for debugging
- python3 --version
- rustc --version
- cargo --version
# Install pyenv to support older python versions (i.e., 3.7)
- git clone https://github.com/pyenv/pyenv.git ~/.pyenv
- export PYENV_ROOT="$HOME/.pyenv"
- export PATH="$PYENV_ROOT/bin:$PATH"
# Need to enable shared libraries manually
# https://github.com/PyO3/pyo3/issues/1800#issuecomment-900837307
- export PYTHON_CONFIGURE_OPTS="--enable-shared"
- eval "$(pyenv init --path)"
- eval "$(pyenv init -)"
- pyenv install 3.7.12
- pyenv local 3.7.12
# Need so set the path where libpython3.7m.so.1.0 is located
# https://github.com/PyO3/pyo3/issues/1576#issuecomment-827171538
- export LD_LIBRARY_PATH="$HOME/.pyenv/versions/3.7.12/lib:$LD_LIBRARY_PATH"
- pipenv sync --dev
# Reduce the debug build optimizations for third-party crates and set them to 1
# They are useful for local development, as this crates more optimized debug binaries
# but makes CI very slow
- sed -i 's/^opt-level\s*=\s*3$/opt-level = 1/' Cargo.toml
- cargo build --all
- cargo test --all
- sccache --show-stats
# start pipenv virtual environment
- source $(pipenv --venv)/bin/activate
# Test pylib build
- pushd pylib && python3 ./setup.py install && popd
- python3 -c "import pylib; help(pylib)"
- sccache --show-stats
after_script:
# For some reason this cannot be in the variables section
- export PATH="$CARGO_HOME/bin:$PATH"
# Cleanup old leftover crate files, print before/after stats
- cargo cache
- cargo cache clean-unref
- cargo cache
shellcheck:
image: koalaman/shellcheck-alpine
cache: {}
script:
- shellcheck --color=always $(find . -name \*.sh)