55 lines
961 B
YAML
55 lines
961 B
YAML
stages:
|
|
- build
|
|
- test
|
|
- deploy
|
|
|
|
build:
|
|
stage: build
|
|
image: rust:1.85
|
|
script:
|
|
- cargo build --release
|
|
- ls -R target/release/
|
|
artifacts:
|
|
paths:
|
|
- target/release/
|
|
expire_in: 1 week
|
|
cache:
|
|
key: "cargo-cache"
|
|
paths:
|
|
- target/
|
|
- ~/.cargo/
|
|
|
|
test:
|
|
stage: test
|
|
image: rust:1.85
|
|
script:
|
|
- cargo test
|
|
cache:
|
|
key: "cargo-cache"
|
|
paths:
|
|
- target/
|
|
- ~/.cargo/
|
|
|
|
test_variable:
|
|
stage: test
|
|
image: rust:1.85
|
|
script:
|
|
- echo "Checking CARGO_LOGIN_TOKEN..."
|
|
- if [[ -z "$CARGO_LOGIN_TOKEN" ]]; then echo "CARGO_LOGIN_TOKEN is empty!"; exit 1; else echo "CARGO_LOGIN_TOKEN is set."; fi
|
|
- env
|
|
rules:
|
|
- if: '$CI_COMMIT_TAG'
|
|
|
|
deploy:
|
|
stage: deploy
|
|
image: rust:1.85
|
|
script:
|
|
- echo "Printing environment"
|
|
- env
|
|
- cargo login "$CARGO_LOGIN_TOKEN"
|
|
- cargo publish
|
|
dependencies:
|
|
- build
|
|
rules:
|
|
- if: '$CI_COMMIT_TAG'
|