matrix-modbot/.gitlab-ci.yml

39 lines
914 B
YAML

.caching_rust: &caching_rust
cache:
paths:
- .cargo/
- .cache/sccache
- target/x86_64-unknown-linux-musl/release/material
stages:
- test
- build
run_tests_cargo:
stage: test
image: "rust:latest"
# Use cargo to test the project
script:
- rustc --version && cargo --version # Print version info for debugging
- cargo build --release
- cargo test --release --workspace --verbose
artifacts:
paths:
- target/release/matrix-modbot
expire_in: 2 weeks
docker-build-main:
# Official docker image.
image: "docker:latest"
stage: build
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build --pull -t "$CI_REGISTRY_IMAGE" --build-arg package=target/release/matrix-modbot .
- docker push "$CI_REGISTRY_IMAGE:latest"
only:
- main