-
Notifications
You must be signed in to change notification settings - Fork 28
95 lines (92 loc) · 2.75 KB
/
test.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
name: PySNC Test
on:
pull_request:
push:
branches: ["main"]
jobs:
install-test:
runs-on: ubuntu-latest
if: github.repository_owner == 'ServiceNow'
strategy:
max-parallel: 1
matrix:
python-version: ["3.8", "3.9", "3.11"]
env:
PYSNC_SERVER: ${{ secrets.PYSNC_SERVER }}
PYSNC_USERNAME: ${{ secrets.PYSNC_USERNAME }}
PYSNC_PASSWORD: ${{ secrets.PYSNC_PASSWORD }}
PYSNC_CLIENT_ID: ${{ secrets.PYSNC_CLIENT_ID }}
PYSNC_CLIENT_SECRET: ${{ secrets.PYSNC_CLIENT_SECRET }}
steps:
- name: check out repository
uses: actions/checkout@v3
- name: set up python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: setup poetry
uses: snok/install-poetry@v1
with:
poetry-version: 1.4.2
virtualenvs-create: true
virtualenvs-in-project: true
- name: cache deps
id: cache-deps
uses: actions/cache@v3
with:
path: .venv
key: pydeps-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: install dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: install project
run: poetry install --no-interaction
- name: run tests
run: |
poetry run pytest
- name: build docs
working-directory: ./docs
run: poetry run make clean html
- name: run extra sanity checks
run: |
poetry run mypy
poetry run jake ddt --whitelist whitelist.json
prerelease:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: install-test
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: cache poetry install
uses: actions/cache@v2
with:
path: ~/.local
key: poetry-1.4.2-0
- name: setup poetry
uses: snok/install-poetry@v1
with:
poetry-version: 1.4.2
virtualenvs-create: true
virtualenvs-in-project: true
- name: cache deps
id: cache-deps
uses: actions/cache@v2
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}
- name: prerelease
env:
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry version prerelease
poetry publish --build
- name: update version
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Automatic version bump
file_pattern: pyproject.toml