Skip to content
Snippets Groups Projects
.gitlab-ci.yml 5.24 KiB
stages:
  - quality
  - build
  - tests
  - deploy

workflow:
  rules:
    - changes:
      - docker/Dockerfile
      - node/**/*
      - pallets/**/*
      - runtime/**/*
      - .gitlab-ci.yml
      - Cargo.toml
      - Cargo.lock

.env:
  image: paritytech/ci-linux:production
  tags:
    - elois-neutron

fmt_and_clippy:
  extends: .env
  rules:
    - if: $CI_COMMIT_REF_NAME =~ /^wip*$/
      when: manual
    - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH == "master"'
      when: never
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - when: manual
  stage: quality
  script:
    - cargo fmt -- --version
    - cargo fmt -- --check
    - cargo clippy -- -V
    - cargo clippy --all --tests -- -D warnings

build_debug:
  extends: .env
  rules:
    - if: $CI_COMMIT_TAG
      when: never
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_BRANCH == "master"'
      changes:
      - Cargo.lock
    - when: never
  stage: build
  script:
    - cargo clean -p duniter
    - cargo build --locked
    - mkdir build
    - mv target/debug/duniter build/duniter
  artifacts:
    paths:
      - build/
    expire_in: 3 day
  cache:
    - key:
        files:
          - Cargo.lock
      paths:
        - target/debug
      policy: push

build_debug_with_cache:
  extends: .env
  rules:
    - changes:
      - Cargo.lock