forked from antarctica/flask-entra-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
103 lines (90 loc) · 2.17 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
---
# == Notes ==
# - GitLab automatically passes artifacts from previous stages by default
# - Set required secret variables at: https://gitlab.data.bas.ac.uk/web-apps/flask-extensions/flask-azure-oauth/-/settings/ci_cd
# = Secret variables
# - Variables are grouped by section in KEY: "value" format (e.g. FOO: "bar")
# Sensitive values are represented by "[Sensitive]"
#
# - PyPi (production) - create tokens at https://pypi.org/manage/account/
# > PYPI_TOKEN (protected): "[Sensitive]"
#
# == Global settings ==
stages:
- 🧪 test
- 📋 lint
- 🏗 build
- 🚚 publish
variables:
APP_NAME: flask-azure-oauth
image:
name: docker-registry.data.bas.ac.uk/web-apps/flask-extensions/flask-azure-oauth:latest
entrypoint: [""]
default:
before_script:
- "ln -s /.venv .venv"
- "poetry install --no-interaction --no-ansi"
# == Jobs ==
test:
stage: 🧪 test
needs: []
variables:
FLASK_ENV: testing
before_script:
- "ln -s /.venv .venv"
- "poetry install --no-interaction --no-ansi"
- "cp support/python-tests-junit/tests.py ./"
script:
- "poetry run python ./tests.py"
artifacts:
reports:
junit: test-results.xml
expire_in: 1 month
rules:
- changes:
- '**/*.py'
lint:
stage: 📋 lint
needs: []
script:
- "poetry check"
- "poetry run flake8 src/ examples/"
- "poetry export --without-hashes -f requirements.txt | poetry run safety check --full-report --stdin"
rules:
- changes:
- '**/*.py'
build:
stage: 🏗 build
needs: []
script:
- "poetry version 0.0.0"
- "poetry build"
artifacts:
paths:
- dist
expire_in: 1 week
rules:
-
if: '$CI_COMMIT_TAG == null'
changes:
- '**/*.py'
publish:
stage: 🚚 publish
needs:
- test
- lint
before_script:
- "ln -s /.venv .venv"
- "poetry install --no-interaction --no-ansi"
- "poetry config pypi-token.pypi $PYPI_TOKEN --local"
script:
- "poetry publish --build --no-interaction"
artifacts:
paths:
- dist
expire_in: 1 month
rules:
- if: '$CI_COMMIT_TAG != null'
environment:
name: production
url: https://pypi.org/project/flask-azure-oauth/