2021-11-26 08:54:38 -06:00
|
|
|
variables:
|
|
|
|
GIT_SUBMODULE_STRATEGY: recursive
|
2021-11-29 14:41:42 -06:00
|
|
|
BUILD_IMAGE_LINUX_AMD64: $CI_REGISTRY/veilid/ci-cd/veilid-build-linux-amd64:latest
|
2021-11-26 08:54:38 -06:00
|
|
|
|
2021-11-24 15:49:13 -06:00
|
|
|
stages:
|
|
|
|
- clippy
|
|
|
|
- test
|
2021-12-05 14:22:28 -06:00
|
|
|
- build
|
2021-11-24 15:49:13 -06:00
|
|
|
|
|
|
|
############# Clippy Lint
|
2021-12-05 14:22:28 -06:00
|
|
|
|
2021-11-24 15:49:13 -06:00
|
|
|
clippy:
|
|
|
|
stage: clippy
|
2021-11-29 14:41:42 -06:00
|
|
|
image: ${BUILD_IMAGE_LINUX_AMD64}
|
2021-12-05 10:06:22 -06:00
|
|
|
cache:
|
2021-12-05 14:32:03 -06:00
|
|
|
key: $CI_COMMIT_REF_SLUG-linux-amd64
|
2021-12-05 10:06:22 -06:00
|
|
|
paths:
|
|
|
|
- target/
|
2021-12-05 14:22:28 -06:00
|
|
|
tags:
|
|
|
|
- linux
|
|
|
|
- amd64
|
2021-11-24 15:49:13 -06:00
|
|
|
script:
|
2021-12-05 14:32:03 -06:00
|
|
|
- cargo clippy
|
2021-12-05 14:22:28 -06:00
|
|
|
# Only run clippy on non-protected branches, for development
|
|
|
|
rules:
|
2021-12-08 06:33:22 -06:00
|
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
when: never
|
|
|
|
- if: $CI_MERGE_REQUEST_IID
|
|
|
|
when: never
|
2021-12-05 14:22:28 -06:00
|
|
|
- if: $CI_COMMIT_REF_PROTECTED == "false"
|
2021-11-24 15:49:13 -06:00
|
|
|
|
|
|
|
############# Unit Testing
|
2021-12-05 14:22:28 -06:00
|
|
|
|
|
|
|
.test_rules_common:
|
|
|
|
# Only do tests for tags, protected branches, or merge requests
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
- if: $CI_MERGE_REQUEST_IID
|
2021-12-08 06:33:22 -06:00
|
|
|
- if: $CI_COMMIT_REF_PROTECTED == "true"
|
2021-12-05 14:22:28 -06:00
|
|
|
|
2021-12-05 14:32:03 -06:00
|
|
|
test_linux_amd64:
|
2021-11-24 15:49:13 -06:00
|
|
|
stage: test
|
2021-11-29 14:41:42 -06:00
|
|
|
image: ${BUILD_IMAGE_LINUX_AMD64}
|
2021-12-05 14:22:28 -06:00
|
|
|
cache:
|
2021-12-05 14:32:03 -06:00
|
|
|
key: $CI_COMMIT_REF_SLUG-linux-amd64
|
2021-12-05 14:22:28 -06:00
|
|
|
paths:
|
|
|
|
- target/
|
2021-11-24 15:49:13 -06:00
|
|
|
tags:
|
|
|
|
- linux
|
|
|
|
- amd64
|
2021-12-05 14:22:28 -06:00
|
|
|
script:
|
2021-12-05 14:32:03 -06:00
|
|
|
- RUST_BACKTRACE=1 dbus-run-session -- cargo test -- --nocapture
|
2021-12-05 14:22:28 -06:00
|
|
|
rules:
|
|
|
|
- !reference [.test_rules_common, rules]
|
|
|
|
|
|
|
|
############# Build
|
|
|
|
|
|
|
|
.build_rules_common:
|
|
|
|
# Only build for tags or protected branches
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
- if: $CI_COMMIT_REF_PROTECTED == "true"
|
|
|
|
|
2021-12-05 14:32:03 -06:00
|
|
|
build_linux_amd64:
|
2021-12-05 14:22:28 -06:00
|
|
|
stage: build
|
|
|
|
image: ${BUILD_IMAGE_LINUX_AMD64}
|
2021-12-05 10:06:22 -06:00
|
|
|
cache:
|
2021-12-05 14:32:03 -06:00
|
|
|
key: $CI_COMMIT_REF_SLUG-linux-amd64
|
2021-12-05 10:06:22 -06:00
|
|
|
paths:
|
|
|
|
- target/
|
2021-12-05 14:22:28 -06:00
|
|
|
tags:
|
|
|
|
- linux
|
|
|
|
- amd64
|
2021-11-24 15:49:13 -06:00
|
|
|
script:
|
2021-12-05 14:22:28 -06:00
|
|
|
- cargo build --release
|
|
|
|
artifacts:
|
2021-12-05 14:32:03 -06:00
|
|
|
name: $CI_COMMIT_REF_SLUG-linux-amd64
|
2021-12-05 14:22:28 -06:00
|
|
|
paths:
|
|
|
|
- target/release/veilid-cli
|
|
|
|
- target/release/veilid-server
|
|
|
|
rules:
|
|
|
|
- !reference [.build_rules_common, rules]
|