Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.81 KiB
stages:
  - lint
  - build
  - test

variables:
  CARGO_HOME: $CI_PROJECT_DIR/cargo
  RUST_BACKTRACE: FULL
  # Faster caching :)   
  FF_USE_FASTZIP: "true"
  CACHE_COMPRESSION_LEVEL: "fastest"

# Linting
cargo-fmt:
  stage: lint
  image: rust:1.83
  script:
    - rustup component add rustfmt
    - cargo fmt -- --check
  allow_failure: true

clippy:
  stage: lint
  image: rust:1.83
  script:
    - rustup component add clippy
    - cargo clippy --
  allow_failure: true

# Building
rust-stable:
  stage: build
  image: rust:1.83
  script:
    - rustc --version && cargo --version
    - apt update
    - apt install -y sqlite3 libmagic1 libmagic-dev
    - sqlite3 ephemeral.db < schema.sql
    - cargo build --verbose

# Testing
test:
  stage: test
  image: rust:1.83
  script:
    - rustc --version && cargo --version
    - apt update
    - apt install -y sqlite3 libmagic1 libmagic-dev
    - sqlite3 ephemeral.db < schema.sql
    - cp config.sample.toml config.toml
    - cargo test -- --nocapture


# # Builds the latest master branch commit.
# docker-build-master:
#   # 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" .
#     - docker push "$CI_REGISTRY_IMAGE"
#   only:
#     - master

# # Builds the latest of any (other) branch.
# docker-build: