Something went wrong on our end
-
7bd11772
.gitlab-ci.yml 5.03 KiB
image: golang:1.22
stages:
- test
- pre-release
- release
run_tests:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)'
stage: test
script:
- go install gotest.tools/gotestsum@latest
- gotestsum --format testname --junitfile report.xml
artifacts:
when: always
reports:
junit: report.xml
lint:
image: golangci/golangci-lint:v1.56-alpine
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)'
stage: test
script:
- golangci-lint run --issues-exit-code 1 --print-issued-lines=false --new-from-rev $CI_MERGE_REQUEST_DIFF_BASE_SHA --out-format code-climate:gl-code-quality-report.json,line-number
artifacts:
reports:
codequality: gl-code-quality-report.json
paths:
- gl-code-quality-report.json
# ----- prepare release -----
# Расчет тега и формирование Changelog
get_changelog:
stage: pre-release
image:
name: orhunp/git-cliff:latest
entrypoint: [ "" ]
rules:
- if: '$CI_PIPELINE_SOURCE == "pipeline" && $PREPARE_RELEASE == "true"' # Запуск при инициации из perxis
- if: $CI_PIPELINE_SOURCE == "web" # или при ручном запуске из GUI
when: manual
variables:
GIT_STRATEGY: clone
GIT_DEPTH: 0
script:
- echo "$(git-cliff --unreleased | sed '1,6d' | sed '$d')" > current_changelog.md # удалить "лишние" строки для Changelog
artifacts:
reports:
dotenv: vars.env # Use artifacts:reports:dotenv to expose the variables to other jobs
paths:
- current_changelog.md
# Релиз и запись тега в артефакт для использования в perxis
prepare_release:
stage: pre-release
image: bitnami/git:latest
variables:
GIT_DEPTH: 0
GIT_STRATEGY: clone
rules:
- if: '$CI_PIPELINE_SOURCE == "pipeline" && $PREPARE_RELEASE == "true"'
- if: $CI_PIPELINE_SOURCE == "web"
needs:
- job: get_changelog
artifacts: true
script:
- |