-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (51 loc) · 1.79 KB
/
ci.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
name: CI
on: [push, pull_request]
env:
PYTHON_VERSION: '3.10'
POETRY_VERSION: '1.3.2'
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Load cached venv
id: cache
uses: actions/cache@v3
with:
path: ".venv"
key: venv-${{ runner.os }}-${{ hashFiles('poetry.lock') }}
restore-keys: |
venv-${{ runner.os }}-${{ hashFiles('poetry.lock') }}
venv-${{ runner.os }}
- name: Setup poetry
uses: abatilo/[email protected]
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: poetry install
- name: Run Black
run: poetry run black . --check --diff --color
- name: Run MyPy checks
run: poetry run mypy . --show-error-context --pretty
- name: Export PiP requirements
run: poetry export -f requirements.txt > requirements.txt
- name: Prepare dist
run: poetry build
- name: Check metadata
run: pipx run twine check dist/*
- name: Dry publish
run: poetry publish --username "${PYPI_USERNAME}" --password "${PYPI_PASSWORD}" --dry-run
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
- name: Publish
if: contains('refs/heads/master', github.ref) && github.event_name == 'push'
run: poetry publish --username "${PYPI_USERNAME}" --password "${PYPI_PASSWORD}"
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}