-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
118 lines (103 loc) · 2.74 KB
/
.gitlab-ci.yml
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
---
# cSpell:ignore urllib unprotect interruptible
stages:
- validate
- release
default:
image: alpine:latest
before_script: &default_before_script
- apk -U upgrade
variables:
GIT_SUBMODULE_STRATEGY: recursive
.lint:
stage: validate
variables:
PIP_CACHE_DIR: $CI_PROJECT_DIR/.cache/pip
PRE_COMMIT_HOME: $CI_PROJECT_DIR/.cache/pre-commit
GITLAB_PRIVATE_TOKEN: $GL_TOKEN
# Skip protect-first-parent pre-commit hook until `[ERROR] caught error 1 on line 69 of ...: FIRST_PARENT="$(git show-ref -s "${BASE}")"` is fixed
SKIP: check-hooks-apply,protect-first-parent
before_script:
- *default_before_script
- apk --no-cache add bash git go grep npm py-pip python3-dev shellcheck shfmt
- python3 -m venv .venv
- source .venv/bin/activate
- pip install -r requirements.txt
- npm install -g markdownlint-cli
script:
- pre-commit run -a --hook-stage manual
cache:
- key: default
paths:
- $PIP_CACHE_DIR
unprotect: true
- key:
files:
- requirements.txt
paths:
- .venv
when: always
- key:
files:
- .pre-commit-config.yaml
paths:
- $PRE_COMMIT_HOME
unprotect: true
when: always
interruptible: true
lint:
extends: [.lint]
variables:
SKIP: check-hooks-apply,protect-first-parent,anti-todo
rules:
- if: $CI_PIPELINE_SOURCE != 'merge_request_event'
lint-merge-request:
extends: [.lint]
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
.test:
stage: validate
.test-alpine:
extends: [.test]
before_script:
- *default_before_script
- apk --no-cache add bats git
.test-ubuntu:
extends: [.test]
image: ubuntu:latest
before_script:
- apt-get update && apt-get upgrade -y
- apt-get install -y bats git
.test-full:
script:
- scripts/test tests/full.set
interruptible: true
rules:
- if: $CI_PIPELINE_SOURCE != "schedule"
.test-nightly:
script:
- scripts/test tests/nightly.set
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
test-alpine-full:
extends: [.test-alpine, .test-full]
test-alpine-nightly:
extends: [.test-alpine, .test-nightly]
test-ubuntu-full:
extends: [.test-ubuntu, .test-full]
test-ubuntu-nightly:
extends: [.test-ubuntu, .test-nightly]
release:
stage: release
image:
name: node:alpine
entrypoint: [""]
before_script:
- *default_before_script
- apk --no-cache add git
- npm install -g semantic-release @semantic-release/gitlab @semantic-release/git @semantic-release/changelog
script:
- npx semantic-release
rules:
- if: $CI_COMMIT_BRANCH =~ /^(((0|[1-9]\d*)\.)(((0|[1-9]\d*|x)\.)?x)|main|next(-major)?|beta|alpha)$/ && $CI_PIPELINE_SOURCE != "schedule"
resource_group: release