veilid/.gitlab-ci.yml
2021-12-05 15:32:03 -05:00

79 lines
1.6 KiB
YAML

variables:
GIT_SUBMODULE_STRATEGY: recursive
BUILD_IMAGE_LINUX_AMD64: $CI_REGISTRY/veilid/ci-cd/veilid-build-linux-amd64:latest
stages:
- clippy
- test
- build
############# Clippy Lint
clippy:
stage: clippy
image: ${BUILD_IMAGE_LINUX_AMD64}
cache:
key: $CI_COMMIT_REF_SLUG-linux-amd64
paths:
- target/
tags:
- linux
- amd64
script:
- cargo clippy
# Only run clippy on non-protected branches, for development
rules:
- if: $CI_COMMIT_REF_PROTECTED == "false"
############# Unit Testing
.test_rules_common:
# Only do tests for tags, protected branches, or merge requests
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_REF_PROTECTED == "true"
- if: $CI_MERGE_REQUEST_IID
test_linux_amd64:
stage: test
image: ${BUILD_IMAGE_LINUX_AMD64}
cache:
key: $CI_COMMIT_REF_SLUG-linux-amd64
paths:
- target/
tags:
- linux
- amd64
script:
- RUST_BACKTRACE=1 dbus-run-session -- cargo test -- --nocapture
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"
build_linux_amd64:
stage: build
image: ${BUILD_IMAGE_LINUX_AMD64}
cache:
key: $CI_COMMIT_REF_SLUG-linux-amd64
paths:
- target/
tags:
- linux
- amd64
script:
- cargo build --release
artifacts:
name: $CI_COMMIT_REF_SLUG-linux-amd64
paths:
- target/release/veilid-cli
- target/release/veilid-server
rules:
- !reference [.build_rules_common, rules]