-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.ci.yml
110 lines (94 loc) · 2.98 KB
/
.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
# Copyright (C) 2022 Antmicro
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
image: $DOCKER_IMAGE
stages:
- build_and_unit_test
- create_matrix
- test_run
variables:
GITLAB_MATRIX_PATH: matrix-gitlab.json
.install-build-deps: &install-build-deps
variables:
GIT_SUBMODULE_STRATEGY: recursive
before_script:
- export DEBIAN_FRONTEND=noninteractive
- apt -qqy update
- apt -y install wget gzip capnproto libcapnp-dev curl build-essential
- cp ./third_party/capnproto-java/compiler/src/main/schema/capnp/java.capnp /usr/include/capnp/java.capnp
- curl https://sh.rustup.rs -sSf | sh -s -- -y
- source $HOME/.cargo/env
build_debug:
stage: build_and_unit_test
<<: *install-build-deps
script:
- cargo build
artifacts:
paths: [target/debug/nisp]
build_release:
stage: build_and_unit_test
<<: *install-build-deps
script:
- cargo build --release
artifacts:
paths: [target/release/nisp]
unit_test:
stage: build_and_unit_test
<<: *install-build-deps
script:
- cargo test
.test-run-devices: &test-run-devices
- xczu7ev
- xc7a35t
.nisp-artifacts: &nisp-artifacts
- jsons/*.json
- dots/*.dot
create_matrix:
stage: create_matrix
before_script:
- export DEBIAN_FRONTEND=noninteractive
- apt -qqy update
- apt install -y python3
script:
- python3 ci/generate_matrix.py gitlab ci/matrix.json
artifacts:
paths: [$GITLAB_MATRIX_PATH]
test_run:
stage: test_run
parallel: 6 # build-type count * device count
before_script:
- export DEBIAN_FRONTEND=noninteractive
- apt -qqy update
- apt install -y wget xz-utils python3
- export BUILD_TYPE=`python3 ci/gitlab_get_matrix_config.py ${CI_NODE_INDEX} build_type`
- export DEVICE=`python3 ci/gitlab_get_matrix_config.py ${CI_NODE_INDEX} device`
- bash ci/download_device.sh $DEVICE
- |
if [[ "$BUILD_TYPE" == "debug" ]]; then
gzip -d -c ${DEVICE}/${DEVICE}.device > ${DEVICE}/${DEVICE}.device.raw
fi
script:
- export BUILD_TYPE=`python3 ci/gitlab_get_matrix_config.py ${CI_NODE_INDEX} build_type`
- export DEVICE=`python3 ci/gitlab_get_matrix_config.py ${CI_NODE_INDEX} device`
- echo "Running NISP in ${BUILD_TYPE} mode for ${DEVICE} device."
- |
if [[ "$BUILD_TYPE" == "debug" ]]; then
export NISP_PATH=`realpath ./target/debug/nisp`
elif [[ "$BUILD_TYPE" == "release" ]]; then
export NISP_PATH=`realpath ./target/release/nisp`
fi
bash ci/full_run.sh $BUILD_TYPE $DEVICE
artifacts:
paths: *nisp-artifacts