-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (45 loc) · 1.2 KB
/
Copy pathpython-app.yml
File metadata and controls
47 lines (45 loc) · 1.2 KB
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
name: Python application
on:
push:
branches: ["main"]
tags:
- 'v*'
pull_request:
branches: ["main"]
release:
types: [published]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest build twine
pip install -e .
- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Build package
run: |
python -m build
- name: Test with pytest
run: |
mkdir -p tests
echo 'def test_placeholder(): assert True' > tests/test_basic.py
pytest -xvs tests
- name: Publish to PyPI
if: github.event_name == 'release' || startsWith(github.ref, 'refs/tags/v')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload dist/*