Welcome to mirror list, hosted at ThFree Co, Russian Federation.

.gitlab-ci.yml - gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0e121cb2b77cd262d321b26f4bd315df18ad5113 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
include:
  - template: Security/License-Scanning.gitlab-ci.yml
  - template: Security/SAST.gitlab-ci.yml
  - template: Security/Dependency-Scanning.gitlab-ci.yml

stages:
  - prepare
  - test

workflow:
  rules:
    # For merge requests, create a pipeline.
    - if: '$CI_MERGE_REQUEST_IID'
    # For `master` branch, create a pipeline (this includes on schedules, pushes, merges, etc.).
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
    # For tags, create a pipeline.
    - if: '$CI_COMMIT_TAG'
    # For stable, and security branches, create a pipeline.
    - if: '$CI_COMMIT_BRANCH =~ /^[\d-]+-stable(-ee)?$/'
    - if: '$CI_COMMIT_BRANCH =~ /^security\//'

default:
  image: golang:1.13
  tags:
    - gitlab-org

.go-mod-cache:
  variables:
    GOPATH: $CI_PROJECT_DIR/.GOPATH
  before_script:
    - mkdir -p .GOPATH
  cache:
    paths:
      - .GOPATH/pkg/mod/

.tests:
  extends: .go-mod-cache
  stage: test
  tags:
    - gitlab-org-docker
  needs: ['download deps']
  script:
  - echo "Running all tests without daemonizing..."
  - make test
  - echo "Running just the acceptance tests daemonized (tmpdir)...."
  - TEST_DAEMONIZE=tmpdir make acceptance
  - echo "Running just the acceptance tests daemonized (inplace)...."
  - TEST_DAEMONIZE=inplace make acceptance
  artifacts:
    paths:
      - bin/gitlab-pages

license_scanning:
  stage: prepare
  variables:
    LICENSE_MANAGEMENT_SETUP_CMD: go mod vendor
  rules:
    - if: $CI_MERGE_REQUEST_ID
      when: on_success
    - if: $CI_COMMIT_BRANCH == 'master'
      when: on_success

# disable eslint-sast since html files are fixtures for testing
eslint-sast:
  rules:
    - when: never

secrets-sast:
  stage: prepare
  rules:
    - if: $CI_MERGE_REQUEST_ID
      when: on_success
    - if: $CI_COMMIT_BRANCH == 'master'
      when: on_success

gosec-sast:
  stage: prepare
  rules:
    - if: $CI_MERGE_REQUEST_ID
      when: on_success
    - if: $CI_COMMIT_BRANCH == 'master'
      when: on_success

download deps:
  extends: .go-mod-cache
  stage: prepare
  script:
    - make deps-download
  artifacts:
    paths:
      - go.mod
      - go.sum

cover:
  extends: .go-mod-cache
  stage: test
  needs: ['download deps']
  script:
    - make setup
    - make generate-mocks
    - make cover
  coverage: '/total:.+\(statements\).+\d+\.\d+/'
  artifacts:
    paths:
      - coverage.html

code_quality:
  stage: test
  needs: ['download deps']
  extends: .go-mod-cache
  image: golangci/golangci-lint:v1.27.0
  variables:
    REPORT_FILE: gl-code-quality-report.json
    LINT_FLAGS: "--color never --deadline 15m"
    OUT_FORMAT: code-climate
  script:
    - golangci-lint run ./... --out-format ${OUT_FORMAT} ${LINT_FLAGS} | tee ${REPORT_FILE}
  timeout: 15 minutes
  artifacts:
    reports:
      codequality: ${REPORT_FILE}
    paths:
      - ${REPORT_FILE}

test:1.13:
  extends: .tests
  image: golang:1.13

test:1.14:
  extends: .tests
  image: golang:1.14

race:
  extends: .go-mod-cache
  stage: test
  tags:
    - gitlab-org-docker
  needs: ['download deps']
  script:
  - echo "Running race detector"
  - make race

check deps:
  extends: .go-mod-cache
  stage: test
  needs: ['download deps']
  script:
    - make deps-check