Skip to content

Commit 0919e78

Browse files
authored
Setup Github Actions (#79)
1 parent f74da8b commit 0919e78

File tree

9 files changed

+1395
-64
lines changed

9 files changed

+1395
-64
lines changed

.appveyor.yml

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

.github/workflows/release.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*.*'
7+
8+
jobs:
9+
10+
Linux:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Get tag
16+
id: tag
17+
run: |
18+
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v1
21+
with:
22+
python-version: 3.8
23+
- name: Install and set up Poetry
24+
run: |
25+
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
26+
python get-poetry.py --preview -y
27+
- name: Build distributions
28+
run: |
29+
source $HOME/.poetry/env
30+
poetry build -vvv
31+
- name: Upload distribution artifacts
32+
uses: actions/upload-artifact@v1
33+
with:
34+
name: project-dist
35+
path: dist
36+
37+
MacOS:
38+
runs-on: macos-latest
39+
40+
steps:
41+
- uses: actions/checkout@v2
42+
- name: Get tag
43+
id: tag
44+
run: |
45+
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
46+
- name: Set up Python ${{ matrix.python-version }}
47+
uses: actions/setup-python@v1
48+
with:
49+
python-version: 3.8
50+
- name: Install and set up Poetry
51+
run: |
52+
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
53+
python get-poetry.py --preview -y
54+
- name: Build distributions
55+
run: |
56+
source $HOME/.poetry/env
57+
poetry build -vvv
58+
- name: Upload distribution artifacts
59+
uses: actions/upload-artifact@v1
60+
with:
61+
name: project-dist
62+
path: dist
63+
64+
Windows:
65+
runs-on: windows-latest
66+
67+
steps:
68+
- uses: actions/checkout@v2
69+
- name: Get tag
70+
id: tag
71+
shell: bash
72+
run: |
73+
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
74+
- name: Set up Python ${{ matrix.python-version }}
75+
uses: actions/setup-python@v1
76+
with:
77+
python-version: 3.8
78+
- name: Install and setup Poetry
79+
run: |
80+
Invoke-WebRequest https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -O get-poetry.py
81+
python get-poetry.py --preview -y
82+
- name: Build distributions
83+
run: |
84+
$env:Path += ";$env:Userprofile\.poetry\bin"
85+
poetry build -vvv
86+
- name: Upload distribution artifact
87+
uses: actions/upload-artifact@v1
88+
with:
89+
name: project-dist
90+
path: dist
91+
92+
Release:
93+
needs: [Linux, MacOS, Windows]
94+
runs-on: ubuntu-latest
95+
96+
steps:
97+
- name: Checkout code
98+
uses: actions/checkout@v2
99+
- name: Get tag
100+
id: tag
101+
run: |
102+
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
103+
- name: Download distribution artifact
104+
uses: actions/download-artifact@master
105+
with:
106+
name: project-dist
107+
path: dist
108+
- name: Install and set up Poetry
109+
run: |
110+
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
111+
python get-poetry.py --preview -y
112+
- name: Check distributions
113+
run: |
114+
ls -la dist
115+
- name: Publish to PyPI
116+
env:
117+
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
118+
run: |
119+
source $HOME/.poetry/env
120+
poetry publish
121+
- name: Create Release
122+
id: create_release
123+
uses: actions/create-release@v1
124+
env:
125+
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
126+
with:
127+
tag_name: ${{ steps.tag.outputs.tag }}
128+
release_name: ${{ steps.tag.outputs.tag }}
129+
draft: false
130+
prerelease: false

.github/workflows/tests.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
Linting:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Set up Python 3.8
12+
uses: actions/setup-python@v1
13+
with:
14+
python-version: 3.8
15+
- name: Linting
16+
run: |
17+
pip install pre-commit
18+
pre-commit run --all-files
19+
Linux:
20+
needs: Linting
21+
runs-on: ubuntu-latest
22+
strategy:
23+
matrix:
24+
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3]
25+
26+
steps:
27+
- uses: actions/checkout@v2
28+
- name: Set up Python ${{ matrix.python-version }}
29+
uses: actions/setup-python@v1
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
- name: Get full python version
33+
id: full-python-version
34+
run: |
35+
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
36+
- name: Install and set up Poetry
37+
run: |
38+
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
39+
python get-poetry.py --preview -y
40+
source $HOME/.poetry/env
41+
poetry config virtualenvs.in-project true
42+
- name: Set up cache
43+
uses: actions/cache@v1
44+
with:
45+
path: .venv
46+
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
47+
- name: Install dependencies
48+
run: |
49+
source $HOME/.poetry/env
50+
poetry install
51+
- name: Test
52+
run: |
53+
source $HOME/.poetry/env
54+
poetry run pytest -q tests
55+
poetry install
56+
57+
MacOS:
58+
needs: Linting
59+
runs-on: macos-latest
60+
strategy:
61+
matrix:
62+
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3]
63+
64+
steps:
65+
- uses: actions/checkout@v2
66+
- name: Set up Python ${{ matrix.python-version }}
67+
uses: actions/setup-python@v1
68+
with:
69+
python-version: ${{ matrix.python-version }}
70+
- name: Get full python version
71+
id: full-python-version
72+
run: |
73+
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
74+
- name: Install and set up Poetry
75+
run: |
76+
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
77+
python get-poetry.py --preview -y
78+
source $HOME/.poetry/env
79+
poetry config virtualenvs.in-project true
80+
- name: Set up cache
81+
uses: actions/cache@v1
82+
with:
83+
path: .venv
84+
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
85+
- name: Install dependencies
86+
run: |
87+
source $HOME/.poetry/env
88+
poetry install
89+
- name: Test
90+
run: |
91+
source $HOME/.poetry/env
92+
poetry run pytest -q tests
93+
Windows:
94+
needs: Linting
95+
runs-on: windows-latest
96+
strategy:
97+
matrix:
98+
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
99+
100+
steps:
101+
- uses: actions/checkout@v2
102+
- name: Set up Python ${{ matrix.python-version }}
103+
uses: actions/setup-python@v1
104+
with:
105+
python-version: ${{ matrix.python-version }}
106+
- name: Get full python version
107+
id: full-python-version
108+
shell: bash
109+
run: |
110+
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
111+
- name: Install and setup Poetry
112+
run: |
113+
Invoke-WebRequest https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -O get-poetry.py
114+
python get-poetry.py --preview -y
115+
$env:Path += ";$env:Userprofile\.poetry\bin"
116+
poetry config virtualenvs.in-project true
117+
- name: Set up cache
118+
uses: actions/cache@v1
119+
with:
120+
path: .venv
121+
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
122+
- name: Install dependencies
123+
run: |
124+
$env:Path += ";$env:Userprofile\.poetry\bin"
125+
poetry install
126+
- name: Test
127+
run: |
128+
$env:Path += ";$env:Userprofile\.poetry\bin"
129+
poetry run pytest -q tests

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,5 @@ nosetests.xml
2121

2222
test.py
2323
/test
24-
poetry.lock
2524
.pytest_cache
2625
.vscode

.travis.yml

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

0 commit comments

Comments
 (0)