From 3a5810fae803b10ab7bb7619d369c17138a98e67 Mon Sep 17 00:00:00 2001 From: 23_KorobovFD <23_KorobovFD@iux.local> Date: Sun, 17 May 2026 22:25:41 +0300 Subject: [PATCH] yaml --- .gitlab-ci.yml | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..c133bbb --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,75 @@ +# GitLab CI/CD пайплайн для Go (вариант 13) +# Автор: Коробов Ф +# Дата: 2026 + +stages: + - lint + - test + - build + +variables: + GO_VERSION: "1.21" + CGO_ENABLED: "0" + + +cache: + key: ${CI_COMMIT_REF_SLUG} + paths: + - .cache/go-mod + +lint: + stage: lint + image: golang:${GO_VERSION} + before_script: + - mkdir -p .cache/go-mod + - export GOPATH=$CI_PROJECT_DIR/.cache + - go mod download + script: + - echo "=== Lint: go vet ===" + - go vet ./... + allow_failure: false + only: + - main + - merge_requests + +test: + stage: test + image: golang:${GO_VERSION} + before_script: + - mkdir -p .cache/go-mod + - export GOPATH=$CI_PROJECT_DIR/.cache + - go mod download + script: + - echo "=== Test: go test with coverage ===" + - go test -v -coverprofile=coverage.out ./... + - go tool cover -func=coverage.out + - go tool cover -html=coverage.out -o coverage.html + artifacts: + name: "coverage_report" + paths: + - coverage.out + - coverage.html + expire_in: 1 week + coverage: '/^total:\s+\(statements\)\s+(\d+\.\d+)%/' + only: + - main + - merge_requests + +build: + stage: build + image: golang:${GO_VERSION} + before_script: + - mkdir -p .cache/go-mod + - export GOPATH=$CI_PROJECT_DIR/.cache + - go mod download + script: + - echo "=== Build: go build ===" + - go build -o app-variant-13 ./... + artifacts: + name: "binary_${CI_COMMIT_SHORT_SHA}" + paths: + - app-variant-13 + expire_in: 1 hour + only: + - main + - tags \ No newline at end of file