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
include:
- local: "/.gitlab-ci/utils.gitlab-ci.yml"
- local: "/.gitlab-ci/executors.gitlab-ci.yml"
# ---------------------------------------------------------
# [TEST] Validate project rules
# ---------------------------------------------------------
.test:validate:upstream: # on upstream changes
# ---------------------------------------------------------
extends: .executor:rust # from local: "/.gitlab-ci/executors.gitlab-ci.yml"
script:
# Check that package version is not less than the latest tag
- ${CI_SCRIPTS_DIR}/validate-versions --package ${CI_CARGO_PACKAGE}
only:
- main
except:
- schedules
# ---------------------------------------------------------
.test:validate:tags: # on pushing new tags
# ---------------------------------------------------------
extends: .executor:rust # from local: "/.gitlab-ci/executors.gitlab-ci.yml"
script:
# Check that new tag strictly equals to package version
- ${CI_SCRIPTS_DIR}/validate-versions --exact --package ${CI_CARGO_PACKAGE}
only:
- tags
except:
- schedules
# ---------------------------------------------------------
# [TEST] Ensure that docs are properly generated
# ---------------------------------------------------------
.test:build:docs:
extends: .executor:rust # from local: "/.gitlab-ci/executors.gitlab-ci.yml"
script:
- cargo doc --no-deps
# ---------------------------------------------------------
# [TEST] Test project for various features
# ---------------------------------------------------------
.test:test:
stage: test
extends: .executor:rust # from local: "/.gitlab-ci/executors.gitlab-ci.yml"
# noinspection YAMLSchemaValidation
before_script:
- # from: local: "/.gitlab-ci/executors.gitlab-ci.yml"
- rustup component add clippy
script:
# Lint code for minimal features
- cargo check ${FEATURES}
- cargo clippy ${FEATURES}
# Run tests
- cargo test ${FEATURES} --lib --tests --bins
parallel:
matrix:
- FEATURES:
- "--no-default-features"
- ""
- "--all-features"
# ---------------------------------------------------------
# [TEST] Dry run for publishing to Crates.io
# ---------------------------------------------------------
.test:publish:
stage: test
extends: .executor:rust # from local: "/.gitlab-ci/executors.gitlab-ci.yml"
script:
- cargo publish --package ${CI_CARGO_PACKAGE} --dry-run