.gitlab-ci.yml improvements

This commit is contained in:
Oscar Krause 2022-12-29 12:30:23 +01:00
parent 0c3a38b84e
commit 0983426f30

View File

@ -7,6 +7,9 @@ build:docker:
stage: build stage: build
rules: rules:
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH - if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
changes:
- app/**/*
- Dockerfile
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
tags: [ docker ] tags: [ docker ]
before_script: before_script:
@ -21,7 +24,11 @@ build:apt:
interruptible: true interruptible: true
stage: build stage: build
rules: rules:
- if: $CI_COMMIT_BRANCH - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
changes:
- app/**/*
- .DEBIAN/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
before_script: before_script:
- echo "COMMIT=${CI_COMMIT_SHA}" >> version.env - echo "COMMIT=${CI_COMMIT_SHA}" >> version.env
@ -58,7 +65,11 @@ build:pacman:
interruptible: true interruptible: true
stage: build stage: build
rules: rules:
- if: $CI_COMMIT_BRANCH - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
changes:
- app/**/*
- .PKGBUILD/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
before_script: before_script:
- echo "COMMIT=${CI_COMMIT_SHA}" >> version.env - echo "COMMIT=${CI_COMMIT_SHA}" >> version.env
@ -103,9 +114,11 @@ test:
.test:linux: .test:linux:
stage: test stage: test
rules: rules:
- changes: - if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
- .DEBIAN/**/* changes:
- app/**/* - app/**/*
- .DEBIAN/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
needs: needs:
- job: build:apt - job: build:apt
artifacts: true artifacts: true
@ -147,9 +160,11 @@ test:ubuntu:
test:archlinux: test:archlinux:
image: archlinux:base image: archlinux:base
rules: rules:
- changes: - if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
- .PKGBUILD/**/* changes:
- app/**/* - app/**/*
- .PKGBUILD/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
needs: needs:
- job: build:pacman - job: build:pacman
artifacts: true artifacts: true
@ -166,6 +181,8 @@ test:archlinux:
deploy:docker: deploy:docker:
extends: .deploy extends: .deploy
stage: deploy stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
before_script: before_script:
- echo "COMMIT=${CI_COMMIT_SHA}" >> version.env - echo "COMMIT=${CI_COMMIT_SHA}" >> version.env
- source version.env - source version.env
@ -189,6 +206,8 @@ deploy:apt:
extends: .deploy extends: .deploy
image: debian:bookworm-slim image: debian:bookworm-slim
stage: deploy stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
needs: needs:
- job: build:apt - job: build:apt
artifacts: true artifacts: true
@ -228,6 +247,8 @@ deploy:pacman:
extends: .deploy extends: .deploy
image: archlinux:base-devel image: archlinux:base-devel
stage: deploy stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
needs: needs:
- job: build:pacman - job: build:pacman
artifacts: true artifacts: true