/
config.yml
147 lines (139 loc) · 3.79 KB
/
config.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
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
version: 2.1
venv-cache: &venv-cache venv-{{ checksum "poetry.lock" }}
pre-commit-cache: &pre-commit-cache pre-commit-{{ checksum ".pre-commit-config.yaml" }}
orbs:
sonarcloud: sonarsource/sonarcloud@2.0.0
automated-test: interstellar/automated-test@volatile
# variables
workspace: &workspace-dir /tmp/workspace
# E2E Tests
slack-channel-id-qa-alert: &slack-channel-id-qa-alert 'C04QXJP2RCZ'
jobs:
test:
working_directory: *workspace-dir
docker:
- image: cimg/python:3.11
resource_class: medium+
steps:
- attach_workspace:
at: *workspace-dir
- checkout
- restore_cache:
name: Restoring poetry cache
keys:
- *venv-cache
- run:
name: Install requirements
command: |
poetry lock
poetry install --no-interaction --no-ansi
- save_cache:
name: Saving poetry cache
key: *venv-cache
paths:
- .venv
- restore_cache:
name: Restoring pre-commit cache
keys:
- *pre-commit-cache
- run:
name: Running pre-commit
command: poetry run pre-commit run --all
- save_cache:
name: Saving pre-commit cache
key: *pre-commit-cache
paths:
- ~/.cache/pre-commit
- run:
name: Running tests
command: poetry run pytest --cov=up42/ --cov-report=xml:.coverage-reports/coverage.xml --durations=3
- store_artifacts:
path: .coverage-reports/coverage.xml
- store_artifacts:
path: .coverage
- persist_to_workspace:
root: ./
paths:
- up42
- .coverage-reports
- .circleci
- sonar-project.properties
sonar:
working_directory: *workspace-dir
docker:
- image: cimg/base:2021.04
steps:
- attach_workspace:
at: *workspace-dir
- sonarcloud/scan:
sonar_token_variable_name: SONAR_TOKEN
test_live:
docker:
- image: cimg/python:3.11
steps:
- checkout
- run:
name: Install requirements
command: |
poetry lock
poetry install --no-ansi
- run:
name: Running tests
command: poetry run pytest --runlive --durations=5
deploy:
docker:
- image: cimg/python:3.11
steps:
- checkout
- run:
name: Build and upload package
command: poetry publish --build -u __token__ -p $UP42_PY_PYPI_TOKEN
workflows:
test_and_deploy:
jobs:
- test
- sonar:
context: sonarcloud
requires:
- test
- automated-test/run-sdk-tests:
requires:
- test
machine-size: medium+
name: sdk-e2e-tests
fingerprint: 'c5:5a:28:b3:5e:21:8d:9c:6c:b1:9b:a7:7b:f3:41:0c'
run-command: poetry run pytest spec --junitxml=./report/junit.xml
context:
- 'sdk-tests-staging-build'
post-steps:
- automated-test/notify-slack:
test-name: 'SDK E2E tests for up42-py failed!'
channel: *slack-channel-id-qa-alert
filters:
branches:
only: master
- hold_before_deploy:
type: approval
requires:
- sdk-e2e-tests
filters:
branches:
only: master
- deploy:
context: pypi-python-package-publishing
requires:
- hold_before_deploy
filters:
branches:
only: master
test_live:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
jobs:
- test_live:
context: up42-py-live-testing