Skip to content

Commit 6706b49

Browse files
Remove Travis CI and use GitHub Actions
1 parent e5b0d56 commit 6706b49

File tree

4 files changed

+150
-28
lines changed

4 files changed

+150
-28
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [brandonwillard]

.github/workflows/pypi.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: PyPI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- auto-release
7+
pull_request:
8+
branches: [master]
9+
release:
10+
types: [published]
11+
12+
jobs:
13+
build:
14+
name: Build source distribution
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- uses: actions/setup-python@v2
21+
with:
22+
python-version: "3.8"
23+
- name: Build the sdist
24+
run: |
25+
python setup.py sdist
26+
- name: Check the sdist installs and imports
27+
run: |
28+
mkdir -p test-sdist
29+
cd test-sdist
30+
python -m venv venv-sdist
31+
venv-sdist/bin/python -m pip install ../dist/cons-*.tar.gz
32+
- uses: actions/upload-artifact@v2
33+
with:
34+
name: artifact
35+
path: dist/*
36+
37+
upload_pypi:
38+
name: Upload to PyPI on release
39+
needs: [build]
40+
runs-on: ubuntu-latest
41+
if: github.event_name == 'release' && github.event.action == 'published'
42+
steps:
43+
- uses: actions/download-artifact@v2
44+
with:
45+
name: artifact
46+
path: dist
47+
- uses: pypa/gh-action-pypi-publish@master
48+
with:
49+
user: __token__
50+
password: ${{ secrets.pypi_secret }}

.github/workflows/tests.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
changes:
13+
name: "Check for changes"
14+
runs-on: ubuntu-latest
15+
outputs:
16+
changes: ${{ steps.changes.outputs.src }}
17+
steps:
18+
- uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 0
21+
- uses: dorny/paths-filter@v2
22+
id: changes
23+
with:
24+
filters: |
25+
python: &python
26+
- 'cons/**/*.py'
27+
- 'tests/**/*.py'
28+
- '*.py'
29+
src:
30+
- *python
31+
- '.github/**/*.yml'
32+
- 'setup.cfg'
33+
- 'requirements.txt'
34+
- '.coveragerc'
35+
- '.pre-commit-config.yaml'
36+
37+
style:
38+
name: Check code style
39+
needs: changes
40+
runs-on: ubuntu-latest
41+
if: ${{ needs.changes.outputs.changes == 'true' }}
42+
steps:
43+
- uses: actions/checkout@v2
44+
- uses: actions/setup-python@v2
45+
with:
46+
python-version: 3.8
47+
- uses: pre-commit/[email protected]
48+
49+
test:
50+
needs:
51+
- changes
52+
- style
53+
runs-on: ubuntu-latest
54+
if: ${{ needs.changes.outputs.changes == 'true' && needs.style.result == 'success' }}
55+
strategy:
56+
matrix:
57+
python-version:
58+
- 3.6
59+
- 3.7
60+
- 3.8
61+
- pypy3
62+
steps:
63+
- uses: actions/checkout@v2
64+
- uses: actions/setup-python@v2
65+
with:
66+
python-version: ${{ matrix.python-version }}
67+
- name: Install dependencies
68+
run: |
69+
python -m pip install --upgrade pip
70+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
71+
- name: Test with pytest
72+
run: |
73+
pytest -v tests/ --cov=cons --cov-report=xml:./coverage.xml
74+
- name: Coveralls
75+
uses: AndreMiras/coveralls-python-action@develop
76+
with:
77+
parallel: true
78+
flag-name: run-${{ matrix.python-version }}
79+
80+
all-checks:
81+
if: ${{ always() }}
82+
runs-on: ubuntu-latest
83+
name: "All tests"
84+
needs: [changes, style, test]
85+
steps:
86+
- name: Check build matrix status
87+
if: ${{ needs.changes.outputs.changes == 'true' && (needs.style.result != 'success' || needs.test.result != 'success') }}
88+
run: exit 1
89+
90+
upload-coverage:
91+
name: "Upload coverage"
92+
needs: [changes, all-checks]
93+
if: ${{ needs.changes.outputs.changes == 'true' && needs.all-checks.result == 'success' }}
94+
runs-on: ubuntu-latest
95+
steps:
96+
- name: Coveralls Finished
97+
uses: AndreMiras/coveralls-python-action@develop
98+
with:
99+
parallel-finished: true

.travis.yml

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

0 commit comments

Comments
 (0)