fuzzyworld

template / ci-testing / files / .gitlab-ci.yml

Branch ci-testing · default branch · all branches

.gitlab-ci.yml

1.3 KB · history · blame

1# Copied from
2# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
3
4image: golang:1.19
5
6stages: # List of stages for jobs, and their order of execution
7 - build
8 - test
9 - release
10
11build-job: # This job runs in the build stage, which runs first.
12 stage: build
13 script:
14 - make build
15
16unit-test-job: # This job runs in the test stage.
17 stage: test # It only starts when the job in the build stage completes successfully.
18 script:
19 - make test
20
21lint-test-job: # This job also runs in the test stage.
22 stage: test # It can run at the same time as unit-test-job (in parallel).
23 script:
24 - make lint
25
26release:
27 stage: release
28 image: docker:stable
29 services:
30 - docker:dind
31
32 variables:
33 # Disable shallow cloning so that goreleaser can diff between tags to
34 # generate a changelog.
35 GIT_DEPTH: 0
36
37 # Only run this release job for tags, not every commit (for example).
38 only:
39 refs:
40 - tags
41
42 script: |
43 docker run --rm --privileged \
44 -v $PWD:/go/src/gitlab.com/YourGitLabUser/YourGitLabRepo \
45 -w /go/src/gitlab.com/YourGitLabUser/YourGitLabRepo \
46 -v /var/run/docker.sock:/var/run/docker.sock \
47 -e GITLAB_TOKEN \
48 goreleaser/goreleaser release --rm-dist