From 61b2a8ff10f6625e9a7f745205418809e0cf76d2 Mon Sep 17 00:00:00 2001
From: a <eddy@gfxlabs.io>
Date: Thu, 20 Jul 2023 21:15:32 +0000
Subject: [PATCH] Update .gitlab-ci.yml file

---
 .gitlab-ci.yml | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..dca1565
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,49 @@
+.go-cache:
+  variables:
+    GOPATH: $CI_PROJECT_DIR/.go
+  before_script:
+    - mkdir -p .go
+  cache:
+    paths:
+      - .go/pkg/mod/
+
+
+
+stages:
+  - lint
+  - test
+
+
+lint:
+  image: registry.gitlab.com/gitlab-org/gitlab-build-images:golangci-lint-alpine
+  stage: tint
+  extends: .go-cache
+  script:
+    # Use default .golangci.yml file from the image if one is not present in the project root.
+    - "[ -e .golangci.yml ] || cp /golangci/.golangci.yml ."
+    # Write the code coverage report to gl-code-quality-report.json
+    # and print linting issues to stdout in the format: path/to/file:line description
+    # remove `--issues-exit-code 0` or set to non-zero to fail the job if linting issues are detected
+    - golangci-lint run --issues-exit-code 0 --print-issued-lines=false --out-format code-climate:gl-code-quality-report.json,line-number
+  artifacts:
+    when: always
+    reports:
+      codequality: gl-code-quality-report.json
+    paths:
+      - gl-code-quality-report.json
+
+coverage:
+  stage: test
+  image: golang:1.20-alpine
+  coverage: '/\(statements\)(?:\s+)?(\d+(?:\.\d+)?%)/'
+  extends: .go-cache
+  script:
+    - go run gotest.tools/gotestsum@latest --junitfile report.xml --format testname -- -coverprofile=coverage.txt -covermode count ./...
+    - go tool cover -func=coverage.txt
+    - go run github.com/boumenot/gocover-cobertura@master < coverage.txt > coverage.xml
+  artifacts:
+    reports:
+      junit: report.xml
+      coverage_report:
+        coverage_format: cobertura
+        path: coverage.xml
-- 
GitLab