forked from mindspore-ai/mindquantum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
97 lines (80 loc) · 2.61 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
# Requires at least Gitlab 12.5
# NB: this is mainly shown for illustration purposes and is not actively maintained.
---
include: .gitlab/hashes.yml
variables:
CMAKE_VERSION: 3.22.3
GIT_SSL_NO_VERIFY: "true"
# ==============================================================================
.setup_apt: &setup_apt
- mkdir -p ${CI_PROJECT_DIR}/cache/apt/archives/partial
- echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/01-keep-debs
- echo 'Acquire::http::Proxy "http://172.17.0.1:3128";' > /etc/apt/apt.conf.d/02-proxy
- echo "Dir::Cache ${CI_PROJECT_DIR}/cache/apt;" > /etc/apt/apt.conf.d/03-cache-debs
- echo 'deb http://debian.ethz.ch/debian bullseye main' > /etc/apt/sources.list
- echo 'deb http://debian.ethz.ch/debian-security bullseye-security main' >> /etc/apt/sources.list
- echo 'deb http://debian.ethz.ch/debian bullseye-updates main' >> /etc/apt/sources.list
.setup_python: &setup_python
- echo -e "[global]\ncache-dir = ${CI_PROJECT_DIR}/cache/pip" > /usr/pip.conf
.install_packages: &install_packages
- >-
apt-get update && apt-get install -y python3-dev python3-pip
python3-setuptools python3-wheel python3-venv libboost-filesystem-dev ccache
--no-install-recommends
.setup_ccache: &setup_ccache
- which ccache
- ccache --help
- ccache --set-config=cache_dir="${CI_PROJECT_DIR}/cache/ccache"
- ccache --set-config=max_size=100M
- ccache --set-config=compression=true
- ccache -pz
- ccache -sv
.default_script_unix: &default_script_unix
- >-
./build_locally.sh --cxx --debug-cmake --test --ccache
--configure-only -c --clean-3rdparty --prefix=$PWD/install
- ./build_locally.sh --cxx --debug-cmake --test --ccache
- ./build_locally.sh --install # NB: no need to pass the other parameters
.cache_paths:
paths: &cache_paths
- build/.mqlibs
- cache
- venv
# ==============================================================================
default:
before_script:
- env
- *setup_apt
- *setup_python
- *install_packages
- *setup_ccache
after_script:
- ccache -sv
# ==============================================================================
gcc:
image: gcc:${GCC}
inherit:
default: true
parallel:
matrix:
- GCC: [7, 9]
cache:
key: gcc-${GCC}-${OVERALL_HASH}
paths: *cache_paths
script:
- *default_script_unix
clang:
image: silkeh/clang:${CLANG}
inherit:
default: true
parallel:
matrix:
- CLANG: [7, 10]
cache:
key: clang-${clang}-${OVERALL_HASH}
paths: *cache_paths
variables:
CC: clang
CXX: clang++
script:
- *default_script_unix