Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
gitlab-ci.yaml 1.06 KiB
---
variables:
  container_registry: docker.io
  image_name: archlinux
  image_version: latest

stages:
  - test
  - doc

pre-commit:
  stage: test
  image: ${container_registry}/${image_name}:${image_version}
  before_script:
    - pacman -Syu --noconfirm
    - pacman -S git --noconfirm
    - pacman -S pre-commit --noconfirm
    - pacman -S sudo --noconfirm
    - pacman -S base-devel --noconfirm
    - useradd -G wheel aur_builder
    - echo "aur_builder ALL=(ALL) NOPASSWD:ALL" |
        tee /etc/sudoers.d/aur_builder
    - sudo -u aur_builder git clone https://aur.archlinux.org/gitlint
        /tmp/gitlint
    - cd /tmp/gitlint
    - sudo -u aur_builder makepkg -si --noconfirm
    - git config --global user.name "${GITLAB_USER_LOGIN}"
    - git config --global user.email "${GITLAB_USER_EMAIL}"
  script:
    - pre-commit install -t pre-commit
    - pre-commit install -t commit-msg
    - git log -1 --format=%B > /tmp/COMMIT_MSG
    - pre-commit run gitlint
      --hook-stage commit-msg
      --commit-msg-filename /tmp/COMMIT_MSG
    - pre-commit run --all --verbose