-
Notifications
You must be signed in to change notification settings - Fork 5
68 lines (57 loc) · 1.77 KB
/
build-and-publish.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
name: Build and Publish
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV
- name: Install dependencies
run: |
cd pkg
poetry install --no-cache -vv
- name: Lint with flake8
run: |
cd pkg
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Build the package
run: |
cd pkg
poetry build
- name: Install built package
run: |
LATEST_WHL=$(ls pkg/dist/*.whl | sort -V | tail -n 1)
python -m pip install "$LATEST_WHL" --no-cache-dir
- name: Get pip freeze
run: |
pip freeze
- name: Run tests
run: |
cd pkg
# poetry run pytest -v tests --junitxml=results.xml
continue-on-error: True
- name: Publish to PyPI
if: github.ref == 'refs/heads/master'
uses: pypa/[email protected]
env:
POETRY_PYPI_USERNAME: ${{ secrets.POETRY_PYPI_USERNAME }}
POETRY_PYPI_API_TOKEN: ${{ secrets.POETRY_PYPI_API_TOKEN }}
with:
user: ${{ secrets.POETRY_PYPI_USERNAME }}
password: ${{ secrets.POETRY_PYPI_API_TOKEN }}
packages_dir: pkg/dist