Skip to content

Commit a4a0c6c

Browse files
modernize pipeline install methods
1 parent fff8a89 commit a4a0c6c

File tree

2 files changed

+90
-70
lines changed

2 files changed

+90
-70
lines changed

.github/workflows/deploy.yaml

Lines changed: 0 additions & 58 deletions
This file was deleted.

.github/workflows/pythonapp.yml

Lines changed: 90 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,53 @@
1-
name: Python application
1+
name: python tests+artifacts+release
22

33
on:
44
pull_request:
55
push:
6-
branches: [main]
6+
branches:
7+
- main
8+
tags:
9+
- "v*"
10+
release:
11+
types: [published]
12+
713

814
jobs:
15+
dist:
16+
runs-on: ubuntu-latest
17+
name: Python sdist/wheel
18+
steps:
19+
- uses: actions/checkout@v1
20+
- uses: actions/setup-python@v2
21+
with:
22+
python-version: "3.9"
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install --upgrade wheel setuptools build
27+
28+
- name: Build package
29+
run: python -m build -o dist/
30+
- uses: actions/upload-artifact@v2
31+
with:
32+
name: dist
33+
path: dist
34+
35+
936
test:
1037
runs-on: ubuntu-latest
38+
needs: [dist]
1139
strategy:
1240
matrix:
1341
# todo: extract from source
1442
python-version: [2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, "3.10", "3.11-dev"]
15-
install-style: [full, editable]
16-
43+
install-from: ["dist/*.whl"]
44+
include:
45+
- python-version: 3.9
46+
install-from: "-e ."
47+
- python-version: 3.9
48+
install-from: "."
49+
- python-version: 3.9
50+
install-from: "dist/*.tar.gz"
1751
steps:
1852
- uses: actions/checkout@v1
1953
- name: Set up Python ${{ matrix.python-version }}
@@ -25,14 +59,58 @@ jobs:
2559
python -m pip install --upgrade pip
2660
pip install -U setuptools setuptools_scm
2761
pip install pytest
28-
2962
- name: install editable
30-
run: pip install -e .
31-
if: matrix.install-style=='editable'
32-
- name: install full
33-
run: pip install .
34-
35-
if: matrix.install-style=='full'
36-
63+
run: pip install ${{ matrix.install-from }}
3764
- name: pytest
3865
run: pytest
66+
67+
68+
jobs:
69+
70+
71+
mypy:
72+
runs-on: ubuntu-latest
73+
74+
name: Python ${{ matrix.python_version }} - dist ${{ matrix.dist }}
75+
steps:
76+
- uses: actions/checkout@v1
77+
- name: Setup python
78+
uses: actions/setup-python@v2
79+
with:
80+
python-version: ${{ matrix.python_version }}
81+
architecture: x64
82+
- uses: actions/download-artifact@v2
83+
with:
84+
name: dist
85+
path: dist
86+
- run: pip install -e . mypy
87+
- run: mypy -m
88+
89+
dist_check:
90+
runs-on: ubuntu-latest
91+
needs: [dist]
92+
steps:
93+
- uses: actions/setup-python@v2
94+
with:
95+
python-version: "3.9"
96+
- uses: actions/download-artifact@v2
97+
with:
98+
name: dist
99+
path: dist
100+
- run: pipx run twine check --strict dist/*
101+
102+
dist_upload:
103+
104+
runs-on: ubuntu-latest
105+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
106+
needs: [dist_check, test]
107+
steps:
108+
- uses: actions/download-artifact@v2
109+
with:
110+
name: dist
111+
path: dist
112+
- name: Publish package to PyPI
113+
uses: pypa/gh-action-pypi-publish@master
114+
with:
115+
user: __token__
116+
password: ${{ secrets.pypi_token }}

0 commit comments

Comments
 (0)