Files
icarus_models/.gitlab-ci.yml
T
phoenix e2995fd223 Update rust (#93)
Reviewed-on: #93
Co-authored-by: phoenix <mail@kundeng.us>
Co-committed-by: phoenix <mail@kundeng.us>
2026-05-03 17:41:40 -04:00

59 lines
1.2 KiB
YAML

stages:
- build
- test
- version
- deploy
build:
stage: build
image: rust:1.95
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.95
script:
- cargo test
cache:
key: "cargo-cache"
paths:
- target/
- ~/.cargo/
test_variable:
stage: test
image: rust:1.95
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'
extract_version:
stage: version
image: alpine:latest
script:
- apk add --no-cache jq
- VERSION=$(grep 'version = "' Cargo.toml | awk -F'"' '{print $2}' | head -n 1)
- VER_HASH=${CI_COMMIT_SHA:0:10}
- VERSION="$VERSION-$VER_HASH"
- if [ $? -ne 0 ]; then echo "Error extracting version"; exit 1; fi
- echo "Extracted version is"
- echo "$VERSION"
- echo "VERSION=$VERSION" > version.env
artifacts:
reports:
dotenv: version.env