moth

Monarch Of The Hill game server
git clone https://git.woozle.org/neale/moth.git

Neale Pickett  ·  2023-12-06

.gitlab-ci.yml

 1stages:
 2  - test
 3  - build
 4  - push
 5
 6Run unit tests:
 7  stage: test
 8  image: &goimage golang:1.21
 9  only:
10    refs:
11      - main
12      - tags
13      - merge_requests
14  script:
15    - go test -coverprofile=coverage.txt -covermode=atomic -race ./...
16    - go tool cover -html=coverage.txt -o coverage.html
17    - go tool cover -func coverage.txt
18  coverage: /\(statements\)(?:\s+)?(\d+(?:\.\d+)?%)/
19  artifacts:
20    paths:
21    - coverage.html
22    - coverage.txt
23Generage coverage XML:
24  stage: test
25  image: *goimage
26  needs: ["Run unit tests"]
27  script:
28    - go get github.com/boumenot/gocover-cobertura
29    - go run github.com/boumenot/gocover-cobertura < coverage.txt > coverage.xml
30  only:
31    refs:
32      - main
33      - tags
34      - merge_requests
35  artifacts:
36    reports:
37      coverage_report:
38        coverage_format: cobertura
39        path: coverage.xml
40
41winbuild:
42  stage: build
43  image: *goimage
44  needs: ["Run unit tests"]
45  script:
46    - GOOS=windows GOARCH=amd64 go build ./cmd/mothd
47    - cp build/package/moth-devel.bat .
48  artifacts:
49    paths:
50      - mothd.exe
51      - moth-devel.bat
52      - theme/*
53
54push:
55  stage: push
56  needs: ["Run unit tests"]
57  rules:
58    - if: $CI_COMMIT_TAG
59    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
60  script:
61    - mkdir ~/.docker
62    - echo "$DOCKER_AUTH_CONFIG" | tee ~/.docker/config.json | md5sum
63    - sh build/ci/ci.sh publish