Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.45 KiB
Newer Older
Eduardo Trujillo's avatar
Eduardo Trujillo committed
stages:
  - format
  - build
  - lint
  - test

.rust_template: &rust_template
Eduardo Trujillo's avatar
Eduardo Trujillo committed
  before_script:
    - export CARGO_HOME="$CI_PROJECT_DIR/cargo"
    - nix develop -c rustc --version
    - nix develop -c cargo --version
Eduardo Trujillo's avatar
Eduardo Trujillo committed

rust-nightly:
  stage: build
  needs: []
  cache:
    key: "$CI_COMMIT_REF_SLUG"
    paths:
      - cargo/
      - target/
  <<: *rust_template
  script:
    - nix develop -c cargo build --verbose
Eduardo Trujillo's avatar
Eduardo Trujillo committed

rust-nightly-test:
  stage: test
  needs:
    - rust-nightly
  cache:
    key: "$CI_COMMIT_REF_SLUG"
    paths:
      - cargo/
      - target/
    policy: pull
  <<: *rust_template
  script:
    - nix develop -c cargo test --verbose -j 1
Eduardo Trujillo's avatar
Eduardo Trujillo committed

rust-nightly-fmt:
  stage: format
  needs: []
  cache:
    key: "$CI_COMMIT_REF_SLUG"
    paths:
      - cargo/
      - target/
    policy: pull
  <<: *rust_template
  script:
    - nix develop -c cargo fmt --all --verbose -- --check
Eduardo Trujillo's avatar
Eduardo Trujillo committed

rust-nightly-clippy:
  stage: lint
  needs:
    - rust-nightly
  cache:
    key: "$CI_COMMIT_REF_SLUG"
    paths:
      - cargo/
      - target/
  <<: *rust_template
  script:
    - nix develop -c cargo clippy --all --tests --verbose -- -D warnings

pages:
  stage: build
  needs:
    - rust-nightly
  cache:
    key: "$CI_COMMIT_REF_SLUG"
    paths:
      - cargo/
      - target/
    policy: pull
  <<: *rust_template
  script:
    - nix develop -c cargo doc --no-deps
    - rm -rf public
    - mkdir public
    - cp -R target/doc/* public
  artifacts:
    paths: