forked from highlight/highlight
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (67 loc) · 2.33 KB
/
python.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
name: Python SDK
on:
push:
branches: ['main']
pull_request:
types: [opened, synchronize]
paths:
- 'e2e/tests/**'
- 'sdk/highlight-py/**'
- '.github/workflows/python.yml'
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
build:
name: Python SDK
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./sdk/highlight-py
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'poetry'
- run: poetry install --all-extras
- name: Lint
run: poetry run black --check .
- name: Test
run: poetry run pytest --cov=highlight_io --cov-branch --cov-report xml
- name: Get Cover
if: github.event.pull_request.head.repo.full_name == 'highlight/highlight'
uses: orgoro/coverage@v3
with:
coverageFile: ./sdk/highlight-py/coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: poetry build
- name: Validate PyProject
working-directory: ./e2e/python
run: |
python -m pip install -U pip-tools;
python -m piptools compile --upgrade pyproject.toml;
- name: Publish
if: github.ref == 'refs/heads/main'
run: poetry publish -u $PYPI_USERNAME -p $PYPI_PASSWORD --skip-existing
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
e2e:
name: Validate E2E tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./e2e/tests
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'poetry'
- run: poetry install --all-extras
- name: Lint
run: poetry run black --check .