forked from tenstorrent/luwen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
135 lines (119 loc) · 3.49 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
image: rust:latest
# Optional: Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
# Check out: https://docs.gitlab.com/ee/ci/services/index.html
# services:
# - mysql:latest
# - redis:latest
# - postgres:latest
# Optional: Install a C compiler, cmake and git into the container.
# You will often need this when you (or any of your dependencies) depends on C code.
# before_script:
# - apt-get update -yqq
# - apt-get install -yqq --no-install-recommends build-essential
stages:
- build
- test
- deploy
# build:
# stage: build
# image: rust:latest
# tags:
# - 8-core
# timeout: 1h
# parallel:
# matrix:
# - CHANNEL: [stable, beta, nightly]
# PROFILE: [release]
# TARGET: [x86_64-unknown-linux-gnu]
# CARGO_OPTS: [ "--verbose" ]
# script:
# - cargo build --target $TARGET $([[ $PROFILE == "release" ]] && echo "--release" || echo "") $CARGO_OPTS
# artifacts:
# paths:
# - target/$TARGET/$PROFILE/*
variables:
RUST_BACKTRACE: 1
.build-base:
stage: build
image: $CI_REGISTRY/syseng-platform/luwen/rust-ci-build:latest
tags:
- 8-core
timeout: 1h
variables:
CHANNEL: stable
PROFILE: release
TARGET: x86_64-unknown-linux-gnu
CARGO_OPTS: "--verbose"
script:
- rustc --version && cargo --version # Print version info for debugging
- cargo build --target $TARGET $([[ $PROFILE == "release" ]] && echo "--release" || echo "") $CARGO_OPTS
artifacts:
paths:
- target/$TARGET/$PROFILE/*
build:stable:release:
extends: .build-base
variables:
CHANNEL: stable
build:stable:debug:
extends: .build-base
variables:
PROFILE: debug
build:nightly:
extends: .build-base
image: rustlang/rust:nightly
variables:
CHANNEL: nightly
allow_failure: true
# Use cargo to test the project
.cargo_test_setup:
extends: .build-base
stage: test
needs: ["build:stable:release"]
script:
- rustc --version && cargo --version # Print version info for debugging
- cargo test --workspace --target $TARGET $([[ $PROFILE == "release" ]] && echo "--release" || echo "") $CARGO_OPTS
test:cargo:gs:
extends: .cargo_test_setup
tags:
- gs-1-card
test:cargo:wh:
extends: .cargo_test_setup
tags:
- wh-nebula_x2-card
# Optional: Use a third party library to generate gitlab junit reports
# test:junit-report:
# script:
# Should be specified in Cargo.toml
# - cargo install junitify
# - cargo test -- --format=json -Z unstable-options --report-time | junitify --out $CI_PROJECT_DIR/tests/
# artifacts:
# when: always
# reports:
# junit: $CI_PROJECT_DIR/tests/*.xml
deploy:
tags:
- 8-core
stage: deploy
before_script:
- cargo install --locked cargo-deb
script:
- make deb
environment: production
# The default cross riscv image doesn't work with
# simd instructions, so I've made a manual job here
# to deploy the image to the container registry
deploy-cross:
tags:
- 8-core
when: manual
# Seems to be how we setup docker in docker
image: rust:latest
services:
- docker:20.10.16-dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- git clone https://github.com/TTDRosen/cross
- cd cross
- CROSS_CONTAINER_IN_CONTAINER=true cargo build-docker-image riscv64gc-unknown-linux-gnu --tag latest --repo $CI_REGISTRY/syseng-platform/luwen
- docker push $CI_REGISTRY/syseng-platform/luwen/riscv64gc-unknown-linux-gnu:latest