This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
107 lines (94 loc) · 2.75 KB
/
main.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
name: main
on:
pull_request:
branches:
- main
push:
branches:
- "*"
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"
jobs:
publish:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && github.repository == 'duffelhq/duffel-api-python'
runs-on: ubuntu-latest
needs: [integration-test, test, types]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: pip install build tox tox-gh-actions
- name: Build package
run: python -m build
- name: Test publishing package to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
integration-test:
runs-on: ubuntu-latest
env:
DUFFEL_ACCESS_TOKEN: ${{ secrets.DUFFEL_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install local version of package
run: pip install --editable .
- name: Run search and book example
run: python examples/search-and-book.py
- name: Run hold and pay later example
run: python examples/hold-and-pay-later.py
- name: Run book with seat example
run: python examples/book-with-seat.py
- name: Run book and change example
run: python examples/book-and-change.py
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dev dependencies
run: pip install -r requirements-dev.txt
- name: Install tox
run: pip install tox-gh-actions
- name: Test using tox
run: tox
- name: Linting
run: tox -e linting
- name: Check code documentation
run: tox -e doc
- name: Check formatting
run: tox -e format -- --check
types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: pip install tox tox-gh-actions
- name: Check with pyright
run: tox -e pyright
- name: Check with mypy
run: tox -e mypy