-
Notifications
You must be signed in to change notification settings - Fork 27
130 lines (111 loc) · 3.92 KB
/
release.yaml
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
---
name: release
on:
push:
branches: [master]
env:
PYTHON_VERSION: '3.8'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install required dependencies
run: |
python3 -m pip install --upgrade pip poetry
poetry config virtualenvs.create false
poetry install -E numpy
- name: Linting and static code checks
run: |
pre-commit run --all-files
- name: Verify proto files
env:
TMPDIR: latest_proto
PROTO_URL: https://raw.githubusercontent.com/cognitedata/protobuf-files/master/v1/timeseries
run: |
mkdir $TMPDIR
curl --silent $PROTO_URL/data_points.proto --output $TMPDIR/data_points.proto
curl --silent $PROTO_URL/data_point_list_response.proto --output $TMPDIR/data_point_list_response.proto
diff $TMPDIR/data_points.proto cognite/client/_proto/data_points.proto
diff $TMPDIR/data_point_list_response.proto cognite/client/_proto/data_point_list_response.proto
test_core:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install required dependencies
run: |
python3 -m pip install --upgrade pip poetry
poetry config virtualenvs.create false
poetry install
- name: Test core
env:
CI: 1
run: pytest tests/tests_unit -n8 --dist loadscope --maxfail 10 -m 'not dsl'
--test-deps-only-core
test_full:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install full dependencies
run: |
python3 -m pip install --upgrade pip poetry
poetry config virtualenvs.create false
poetry install -E all
- name: Test full
env:
LOGIN_FLOW: client_credentials
COGNITE_CLIENT_SECRET: ${{ secrets.COGNITE_CLIENT_SECRET }}
COGNITE_TOKEN_URL: https://login.microsoftonline.com/dff7763f-e2f5-4ffd-9b8a-4ba4bafba5ea/oauth2/v2.0/token
COGNITE_TOKEN_SCOPES: https://greenfield.cognitedata.com/.default
COGNITE_CLIENT_ID: 14fd282e-f77a-457d-add5-928ec2bcbf04
COGNITE_PROJECT: python-sdk-test
COGNITE_BASE_URL: https://greenfield.cognitedata.com
COGNITE_CLIENT_NAME: python-sdk-integration-tests
CI: 1
run: |
pytest tests --cov --cov-report xml:coverage.xml -n8 --dist loadscope --reruns 2
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
build:
runs-on: ubuntu-latest
needs: [lint, test_full]
environment: CD
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install full dependencies
run: |
python3 -m pip install --upgrade pip poetry
poetry config virtualenvs.create false
poetry install -E all
- name: Build package
run: poetry build
- name: Build docs
run: cd docs && make html
- name: Release to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload --verbose dist/* || echo 'Version exists'
- name: Push code snippets to service-contracts
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: sh ./scripts/deploy_code_snippets.sh || echo 'PR failed. There is probably
nothing to commit'