-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
106 lines (102 loc) · 2.97 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
---
stages:
- lint
- test
- release
- deploy
lint:
stage: lint
tags:
- shacklyn
image: registry.gitlab.com/bubblehouse/runner-base:1.2.1
variables:
POETRY_CACHE_DIR: .cache/pypoetry
DJANGO_SETTINGS_MODULE: moo.settings.test
before_script:
- mkdir -p public/badges public/lint
- echo undefined > public/badges/$CI_JOB_NAME.score
script:
- poetry install
- poetry run pylint --fail-under=8 --output-format=text moo | tee /tmp/pylint.txt
- sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' /tmp/pylint.txt > public/badges/$CI_JOB_NAME.score
- poetry run pylint --exit-zero --output-format=pylint_gitlab.GitlabCodeClimateReporter moo > codeclimate.json
- poetry run pylint --exit-zero --output-format=pylint_gitlab.GitlabPagesHtmlReporter moo > public/lint/index.html
after_script:
- poetry run anybadge --overwrite --label $CI_JOB_NAME --value=$(cat public/badges/$CI_JOB_NAME.score) --file=public/badges/$CI_JOB_NAME.svg 4=red 6=orange
8=yellow 10=green
- |
echo "Your score is: $(cat public/badges/$CI_JOB_NAME.score)"
artifacts:
paths:
- public
reports:
codequality: codeclimate.json
when: always
cache:
paths:
- .cache/pypoetry
test:
stage: test
tags:
- shacklyn
image: registry.gitlab.com/bubblehouse/runner-base:1.2.1
variables:
POETRY_CACHE_DIR: .cache/pypoetry
script:
- poetry install
- poetry run pytest --junitxml=junit.xml --cov-report term --cov-report xml
coverage: /(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/
artifacts:
when: always
reports:
junit: junit.xml
coverage_report:
coverage_format: cobertura
path: coverage.xml
paths:
- coverage.xml
- junit.xml
cache:
paths:
- .cache/pypoetry
release:
stage: release
tags:
- shacklyn
image: registry.gitlab.com/bubblehouse/runner-base:1.2.1
variables:
GIT_COMMITTER_EMAIL: phil@bubblehouse.org
GIT_COMMITTER_NAME: Phil Christensen
GIT_AUTHOR_EMAIL: phil@bubblehouse.org
GIT_AUTHOR_NAME: Phil Christensen
GIT_CREDENTIALS: philchristensen:${GITLAB_TOKEN}
DOCKER_REGISTRY_USER: philchristensen
DOCKER_REGISTRY_PASSWORD: ${GITLAB_TOKEN}
DOCKER_BUILDKIT: 1
POETRY_CACHE_DIR: .cache/pypoetry
script:
- npm install
- docker buildx install
- docker buildx create --bootstrap --use --name=$CI_PROJECT_NAME --driver=kubernetes '--driver-opt="nodeselector=kubernetes.io/arch=amd64"'
- docker buildx create --bootstrap --append --name=$CI_PROJECT_NAME --driver=kubernetes '--driver-opt="nodeselector=kubernetes.io/arch=arm64","tolerations=key=kubernetes.io/arch,value=arm64,operator=Equal,effect=NoSchedule"'
- npx semantic-release
only:
refs:
- main
cache:
paths:
- .cache/pypoetry
- node_modules/
pages:
stage: deploy
tags:
- shacklyn
image: alpine:latest
script:
- echo
artifacts:
paths:
- public
only:
refs:
- main