Skip to content

Commit 6848c24

Browse files
committed
Use Github Actions instead of TravisCI
1 parent 89478a0 commit 6848c24

File tree

3 files changed

+139
-88
lines changed

3 files changed

+139
-88
lines changed

.github/workflows/release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Releases
2+
3+
on:
4+
push:
5+
tags:
6+
- .*
7+
8+
jobs:
9+
10+
prod:
11+
name: Release version
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Wait for tests
16+
uses: fountainhead/[email protected]
17+
id: wait-for-tests
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
checkName: Run tests
21+
ref: ${{ github.ref }}
22+
timeoutSeconds: 3600
23+
24+
- name: Fail the Build
25+
uses: cutenode/action-always-fail@v1
26+
if: steps.wait-for-tests.outputs.conclusion != 'success'
27+
28+
- name: Checkout code
29+
uses: actions/checkout@v2
30+
31+
- name: Inject slug/short variables
32+
uses: rlespinasse/[email protected]
33+
34+
- name: Set up Python ${{ matrix.python-version }}
35+
uses: actions/setup-python@v2
36+
37+
- name: Cache pip
38+
uses: actions/cache@v2
39+
with:
40+
path: ~/.cache/pip
41+
key: ${{ runner.os }}-python-${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt') }}
42+
restore-keys: |
43+
${{ runner.os }}-python-${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt') }}
44+
${{ runner.os }}-python-${{ matrix.python-version }}-pip-
45+
${{ runner.os }}-python
46+
${{ runner.os }}-
47+
48+
- name: Upgrade pip
49+
run: python -m pip install --upgrade pip setuptools wheel twine
50+
51+
- name: Download artifacts
52+
uses: dawidd6/action-download-artifact@v2
53+
with:
54+
github_token: ${{ secrets.GITHUB_TOKEN }}
55+
workflow: test.yml
56+
workflow_conclusion: success
57+
name: dist
58+
path: ./dist/
59+
60+
- name: Create release
61+
id: create_release
62+
uses: actions/create-release@v1
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
with:
66+
tag_name: ${{ github.ref }}
67+
release_name: ${{ github.ref }}
68+
draft: false
69+
prerelease: false
70+
71+
- name: Build and publish
72+
env:
73+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
74+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
75+
TWINE_REPOSITORY_URL: dolfinus/setuptools-git-versioning
76+
run: |
77+
twine upload dist/*

.github/workflows/test.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Tests
2+
3+
on: push
4+
5+
jobs:
6+
tests:
7+
name: Run tests
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: ['2.7', '3.3', '3.4', '3.5', '3.6', '3.7', '3.8', '3.9']
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
17+
- name: Inject slug/short variables
18+
uses: rlespinasse/[email protected]
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Cache pip
26+
uses: actions/cache@v2
27+
with:
28+
path: ~/.cache/pip
29+
key: ${{ runner.os }}-python-${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt') }}
30+
restore-keys: |
31+
${{ runner.os }}-python-${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt') }}
32+
${{ runner.os }}-python-${{ matrix.python-version }}-pip-
33+
${{ runner.os }}-python
34+
${{ runner.os }}-
35+
36+
- name: Upgrade pip
37+
run: python -m pip install --upgrade pip setuptools wheel
38+
39+
- name: Install dependencies
40+
run: pip install -I "flake8<=2.6" -r requirements.txt
41+
if: matrix.python-version == '3.3' || matrix.python-version == '3.4'
42+
43+
- name: Install dependencies
44+
run: pip install "flake8>=3.8" -r requirements.txt
45+
if: matrix.python-version != '3.3' && matrix.python-version != '3.4'
46+
47+
- name: Run flake8
48+
run: flake8 --count --ignore=F401 --max-line-length=120 .
49+
if: matrix.python-version == '3.3' || matrix.python-version == '3.4'
50+
51+
- name: Run flake8
52+
run: flake8 --count --max-line-length=120 .
53+
if: matrix.python-version != '3.3' && matrix.python-version != '3.4'
54+
55+
- name: Build package
56+
run: python setup.py bdist_wheel sdist
57+
58+
- name: Push build artifacts
59+
uses: actions/upload-artifact@v2
60+
with:
61+
name: dist
62+
path: dist/*

.travis.yml

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

0 commit comments

Comments
 (0)