-
Notifications
You must be signed in to change notification settings - Fork 4
67 lines (63 loc) · 2.06 KB
/
ci-production.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
name: Continuous Integration
on:
push:
branches:
- main
- master
release:
types:
- created
jobs:
test:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up testing python ${{ matrix.config.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.config.python-version }}
- name: Install poetry
uses: abatilo/actions-poetry@v2.3.0
- name: Setup a local virtual environment for caching
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- name: Define a cache for the virtual environment based on the dependencies lock file to speed up later runs
uses: actions/cache@v3
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
run: poetry install --no-root --without dev
- name: Pytest
run: poetry run pytest -x --random-order
build-and-publish:
name: Build and publish Python distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-22.04
needs:
- test
steps:
- uses: actions/checkout@v4
- name: Set up base Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Python Poetry Action
uses: abatilo/actions-poetry@v2.3.0
- name: Publish distribution 📦 with test.pypi.org
if: startsWith(github.ref, 'refs/tags')
run: |
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_API_TOKEN }}
poetry build
poetry publish -r testpypi
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
poetry build
poetry publish