Skip to content

Commit af7e1b9

Browse files
committed
Rewrite CI
1 parent cf9464c commit af7e1b9

File tree

2 files changed

+71
-38
lines changed

2 files changed

+71
-38
lines changed

.github/workflows/pytest.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Test with pytest and publish Python 🐍 distributions 📦 to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
python-version: [ 3.7, 3.8, 3.9, 3.10.0-beta.3 ]
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
python setup.py sdist
26+
python setup.py install
27+
python -m pip install wheel pytest pytest-cov pytest-xdist requests coveralls codacy-coverage
28+
pip install --ignore-installed pytest>=4.4.0
29+
pytest --version
30+
- name: Test with pytest
31+
run: |
32+
python setup.py test -a '--cov-config .coveragerc --cov=json_to_models -m "not no_expected" test/'
33+
- name: Coverage
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
run: |
37+
coverage xml
38+
coveralls --service=github
39+
# TODO: Fix codacy issue with token
40+
# python-codacy-coverage -r coverage.xml
41+
42+
release:
43+
name: Build and publish Python 🐍 distributions 📦 to PyPI
44+
needs: test
45+
if: startsWith(github.ref, 'refs/tags/v')
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@master
49+
- name: Set up Python 3.7
50+
uses: actions/setup-python@v2
51+
with:
52+
python-version: 3.7
53+
- name: Install deps
54+
run: |
55+
python -m pip install --upgrade pip
56+
pip install setuptools wheel twine
57+
- name: Build a binary wheel and a source tarball
58+
run: |
59+
python setup.py sdist bdist_wheel
60+
- name: Publish distribution 📦 to PyPI
61+
with:
62+
password: ${{ secrets.PYPI_API_TOKEN }}
63+
run: |
64+
twine upload dist/*
65+
- name: Upload release to github
66+
uses: "marvinpinto/action-automatic-releases@latest"
67+
with:
68+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
69+
prerelease: false
70+
files: |
71+
dist/*

0 commit comments

Comments
 (0)