Skip to content
Snippets Groups Projects
.gitlab-ci.yml 4.11 KiB
variables:
  RUST_BACKTRACE: full

stages:
  - check
  - test
  - publish
  - report

check-commits:
  before_script:
    - pacman-key --init
    - pacman -Sy --needed --noconfirm archlinux-keyring
    - source .env && pacman -Syu --needed --noconfirm $PACMAN_PACKAGES
    # fetch the default branch as we need it for comparison
    - git fetch origin $CI_DEFAULT_BRANCH
    # setup a dummy user as `cog verify` needs that
    - git config --local user.name "Foobar McFooface"
    - git config --local user.email "foobar@mcfooface.com"
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
  script:
    - just check-commits
  stage: check

check:
  before_script:
    - pacman-key --init
    - pacman -Sy --needed --noconfirm archlinux-keyring
    - source .env && pacman -Syu --needed --noconfirm $PACMAN_PACKAGES
    - just install-rust-dev-tools
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  script:
    - just check
  stage: check

test:
  before_script:
    - pacman-key --init
    - pacman -Sy --needed --noconfirm archlinux-keyring
    - source .env && pacman -Syu --needed --noconfirm $PACMAN_PACKAGES
    - just install-rust-dev-tools
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  script:
    - just test
  stage: test

integration-test:
  before_script:
    - pacman-key --init
    - pacman -Sy --needed --noconfirm archlinux-keyring
    - source .env && pacman -Syu --needed --noconfirm $PACMAN_PACKAGES
    - useradd -m testuser
    - chown -R testuser:testuser .
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  script:
    - WORKDIR="$(pwd)" runuser -w WORKDIR -l testuser -c 'env && cd "$WORKDIR" && just install-rust-dev-tools && just ignored=true test'
  stage: test
  tags:
    - vm

test-readmes:
  before_script:
    - pacman-key --init