Skip to content

Commit acdce2d

Browse files
committed
build: use poetry for building
1 parent 60b9c42 commit acdce2d

File tree

8 files changed

+756
-149
lines changed

8 files changed

+756
-149
lines changed

.github/workflows/publish.yml

+63-33
Original file line numberDiff line numberDiff line change
@@ -9,61 +9,91 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
python-version: [ 3.6, 3.7, 3.8 ]
12+
python-version: [ 3.7, 3.8 ]
1313
steps:
1414
- uses: actions/checkout@v2
1515
- name: Set up Python ${{ matrix.python-version }}
1616
uses: actions/setup-python@v2
1717
with:
1818
python-version: ${{ matrix.python-version }}
1919

20-
- name: Patch for Python 3.6
21-
if: matrix.python-version == 3.6
20+
- name: Install dependencies
2221
run: |
23-
pip install strip-hints==0.1.9
24-
./patch-python3.6.sh
22+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
23+
source $HOME/.poetry/env
24+
poetry install
2525
26-
git config --global user.email "[email protected]"
27-
git config --global user.name "Github Actions"
26+
- name: Run tests
27+
run: |
28+
source $HOME/.poetry/env
29+
poetry run pytest
2830
29-
git add --all
30-
git commit --message "Python 3.6 patch"
31-
latest_tag=$(git describe --abbrev=0 --tags)
32-
git tag --force ${latest_tag}
31+
- name: Build wheels
32+
run: |
33+
source $HOME/.poetry/env
34+
poetry version $(git tag --points-at HEAD)
35+
poetry build
3336
34-
- name: Install dependencies
37+
- name: Upload
38+
env:
39+
USERNAME: __token__
40+
PASSWORD: ${{ secrets.PYPI_TOKEN }}
3541
run: |
36-
pip install -r requirements.txt
42+
source $HOME/.poetry/env
43+
poetry publish --username=$USERNAME --password=$PASSWORD
44+
45+
46+
47+
name: Publish
48+
49+
on:
50+
release:
51+
types: [created]
3752

38-
- name: Install dev dependencies
53+
jobs:
54+
build:
55+
runs-on: ubuntu-latest
56+
strategy:
57+
matrix:
58+
python-version: [ 3.7, 3.8 ]
59+
steps:
60+
- uses: actions/checkout@v2
61+
- name: Set up Python ${{ matrix.python-version }}
62+
uses: actions/setup-python@v2
63+
with:
64+
python-version: ${{ matrix.python-version }}
65+
66+
- name: Install dependencies
3967
run: |
40-
pip install -r dev_requirements.txt
68+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
69+
source $HOME/.poetry/env
70+
poetry install
4171
42-
- name: Test
72+
- name: Run tests
4373
run: |
44-
pytest
74+
source $HOME/.poetry/env
75+
poetry run pytest
4576
46-
- name: Test install package
47-
env:
48-
PYTHON_VERSION: ${{ matrix.python-version }}
77+
- name: Build wheels
4978
run: |
50-
python setup.py bdist_wheel --python-tag py${PYTHON_VERSION//.}
79+
source $HOME/.poetry/env
80+
poetry version $(git tag --points-at HEAD)
81+
poetry build
5182
5283
- name: Test install package
5384
run: |
54-
pip install virtualenv
55-
virtualenv installable
56-
source installable/bin/activate
57-
58-
pip install dist/$(ls dist)
59-
85+
source $HOME/.poetry/env
6086
mkdir test_install
6187
cd test_install
62-
python -c "import datastream"
88+
poetry init
89+
poetry add ../dist/$(ls dist/*.whl)
90+
91+
poetry run python -c "import datastream"
6392
64-
- name: PyPi Publish
93+
- name: Upload
6594
env:
66-
TWINE_USERNAME: __token__
67-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
68-
run:
69-
twine upload dist/*
95+
USERNAME: __token__
96+
PASSWORD: ${{ secrets.PYPI_TOKEN }}
97+
run: |
98+
source $HOME/.poetry/env
99+
poetry publish --username=$USERNAME --password=$PASSWORD

.github/workflows/test.yml

+45-30
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ name: Test
33
on: [push]
44

55
jobs:
6-
build:
6+
test:
7+
78
runs-on: ubuntu-latest
89
strategy:
910
matrix:
10-
python-version: [ 3.6, 3.7, 3.8 ]
11+
python-version: [3.7, 3.8]
12+
1113
steps:
1214
- uses: actions/checkout@v2
1315
- name: Set up Python ${{ matrix.python-version }}
@@ -18,43 +20,56 @@ jobs:
1820
- name: Cache pip
1921
uses: actions/cache@v2
2022
with:
21-
# This path is specific to Ubuntu
2223
path: ~/.cache/pip
23-
# Look to see if there is a cache hit for the corresponding requirements file
24-
key: ${{ runner.os }}-python${{ matrix.python-version}}-pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('dev_requirements.txt') }}-${ GITHUB_REF }
25-
26-
- name: Patch for Python 3.6
27-
if: matrix.python-version == 3.6
28-
run: |
29-
pip install strip-hints==0.1.9
30-
./patch-python3.6.sh
24+
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}-${ GITHUB_REF }
25+
restore-keys: |
26+
${{ runner.os }}-pip-
27+
${{ runner.os }}-
3128
3229
- name: Install dependencies
3330
run: |
34-
pip install -r requirements.txt
31+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
32+
source $HOME/.poetry/env
33+
poetry install
3534
36-
- name: Install dev dependencies
35+
- name: Run tests
3736
run: |
38-
pip install -r dev_requirements.txt
37+
source $HOME/.poetry/env
38+
poetry run pytest
3939
40-
- name: Test
40+
- name: Build wheels
4141
run: |
42-
pytest
42+
source $HOME/.poetry/env
43+
poetry build
4344
44-
- name: Build package
45-
env:
46-
PYTHON_VERSION: ${{ matrix.python-version }}
47-
run: |
48-
python setup.py bdist_wheel --python-tag py${PYTHON_VERSION//.}
45+
build-docs:
4946

50-
- name: Test install package
51-
run: |
52-
pip install virtualenv
53-
virtualenv installable
54-
source installable/bin/activate
47+
runs-on: ubuntu-latest
48+
strategy:
49+
matrix:
50+
python-version: [3.8]
51+
52+
steps:
53+
- uses: actions/checkout@v2
54+
- name: Set up Python ${{ matrix.python-version }}
55+
uses: actions/setup-python@v2
56+
with:
57+
python-version: ${{ matrix.python-version }}
58+
59+
- name: Cache pip
60+
uses: actions/cache@v2
61+
with:
62+
path: ~/.cache/pip
63+
key: ${{ runner.os }}-pip-${{ hashFiles('docs/source/requirements.txt') }}-${ GITHUB_REF }
64+
restore-keys: |
65+
${{ runner.os }}-pip-
66+
${{ runner.os }}-
5567
56-
pip install dist/$(ls dist)
68+
- name: Install dependencies
69+
run: |
70+
python -m pip install --upgrade pip
71+
pip install -r docs/source/requirements.txt
5772
58-
mkdir test_install
59-
cd test_install
60-
python -c "import datastream"
73+
- name: Build html
74+
run: |
75+
(cd docs && make html)

dev_requirements.txt

-3
This file was deleted.

patch-python3.6.sh

-17
This file was deleted.

0 commit comments

Comments
 (0)