2021-10-18 18:22:00 -06:00
|
|
|
stages:
|
|
|
|
- test
|
2023-12-06 16:44:40 -07:00
|
|
|
- build
|
2021-10-18 18:22:00 -06:00
|
|
|
- push
|
|
|
|
|
2022-10-28 13:27:20 -06:00
|
|
|
Run unit tests:
|
2021-10-18 18:59:15 -06:00
|
|
|
stage: test
|
2023-09-27 16:10:31 -06:00
|
|
|
image: &goimage golang:1.21
|
2021-10-18 18:22:00 -06:00
|
|
|
only:
|
|
|
|
refs:
|
|
|
|
- main
|
2023-04-13 15:32:15 -06:00
|
|
|
- tags
|
2021-10-18 18:22:00 -06:00
|
|
|
- merge_requests
|
|
|
|
script:
|
2022-10-21 15:52:26 -06:00
|
|
|
- go test -coverprofile=coverage.txt -covermode=atomic -race ./...
|
2022-10-25 14:48:58 -06:00
|
|
|
- go tool cover -html=coverage.txt -o coverage.html
|
2022-10-25 14:37:56 -06:00
|
|
|
- go tool cover -func coverage.txt
|
|
|
|
coverage: /\(statements\)(?:\s+)?(\d+(?:\.\d+)?%)/
|
2022-10-28 13:27:20 -06:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- coverage.html
|
|
|
|
- coverage.txt
|
|
|
|
Generage coverage XML:
|
|
|
|
stage: test
|
|
|
|
image: *goimage
|
|
|
|
needs: ["Run unit tests"]
|
|
|
|
script:
|
|
|
|
- go get github.com/boumenot/gocover-cobertura
|
|
|
|
- go run github.com/boumenot/gocover-cobertura < coverage.txt > coverage.xml
|
|
|
|
only:
|
|
|
|
refs:
|
|
|
|
- main
|
2023-04-13 15:32:15 -06:00
|
|
|
- tags
|
2022-10-28 13:27:20 -06:00
|
|
|
- merge_requests
|
2022-10-21 15:52:26 -06:00
|
|
|
artifacts:
|
|
|
|
reports:
|
|
|
|
coverage_report:
|
|
|
|
coverage_format: cobertura
|
|
|
|
path: coverage.xml
|
2022-10-28 13:27:20 -06:00
|
|
|
|
2023-12-06 17:13:21 -07:00
|
|
|
winbuild:
|
2023-12-06 16:44:40 -07:00
|
|
|
stage: build
|
|
|
|
image: *goimage
|
|
|
|
needs: ["Run unit tests"]
|
|
|
|
script:
|
2023-12-06 17:17:47 -07:00
|
|
|
- GOOS=windows GOARCH=amd64 go build ./cmd/mothd
|
2023-12-06 17:22:45 -07:00
|
|
|
- cp build/package/moth-devel.bat .
|
2023-12-06 16:44:40 -07:00
|
|
|
artifacts:
|
|
|
|
paths:
|
2023-12-06 17:13:21 -07:00
|
|
|
- mothd.exe
|
2023-12-06 17:22:45 -07:00
|
|
|
- moth-devel.bat
|
2023-12-06 17:13:21 -07:00
|
|
|
- theme/*
|
2023-12-06 16:44:40 -07:00
|
|
|
|
2021-10-18 18:22:00 -06:00
|
|
|
push:
|
|
|
|
stage: push
|
2022-10-28 13:27:20 -06:00
|
|
|
needs: ["Run unit tests"]
|
2021-10-18 18:22:00 -06:00
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
|
|
script:
|
2021-10-19 17:24:08 -06:00
|
|
|
- mkdir ~/.docker
|
2021-10-20 14:27:32 -06:00
|
|
|
- echo "$DOCKER_AUTH_CONFIG" | tee ~/.docker/config.json | md5sum
|
2021-10-19 18:49:46 -06:00
|
|
|
- sh build/ci/ci.sh publish
|