Skip to content

Commit 2f9a967

Browse files
authored
Migrate to Github Actions (#13)
1 parent 92287d7 commit 2f9a967

File tree

11 files changed

+192
-36
lines changed

11 files changed

+192
-36
lines changed

Diff for: .flake8

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
exclude = .venv
3+
max-line-length = 100
4+
extend-ignore = E203

Diff for: .github/workflows/ci.yml

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: ci
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
7+
jobs:
8+
test:
9+
name: test
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
build: [linux_3.8, windows_3.8, mac_3.8, linux_3.7]
14+
include:
15+
- build: linux_3.8
16+
os: ubuntu-latest
17+
python: 3.8
18+
- build: windows_3.8
19+
os: windows-latest
20+
python: 3.8
21+
- build: mac_3.8
22+
os: macos-latest
23+
python: 3.8
24+
- build: linux_3.7
25+
os: ubuntu-latest
26+
python: 3.7
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v2
30+
31+
- name: Set up Python ${{ matrix.python }}
32+
uses: actions/setup-python@v1
33+
with:
34+
python-version: ${{ matrix.python }}
35+
36+
- name: Install dependencies
37+
run: |
38+
python -m pip install --upgrade pip wheel
39+
pip install -r requirements.txt
40+
41+
# test all the builds apart from linux_3.8...
42+
- name: Test with pytest
43+
if: matrix.build != 'linux_3.8'
44+
run: pytest
45+
46+
# only do the test coverage for linux_3.8
47+
- name: Produce coverage report
48+
if: matrix.build == 'linux_3.8'
49+
run: pytest --cov=fastapi_sqlalchemy --cov-report=xml
50+
51+
- name: Upload coverage report
52+
if: matrix.build == 'linux_3.8'
53+
uses: codecov/codecov-action@v1
54+
with:
55+
file: ./coverage.xml
56+
57+
lint:
58+
name: lint
59+
runs-on: ubuntu-latest
60+
steps:
61+
- name: Checkout repository
62+
uses: actions/checkout@v2
63+
64+
- name: Set up Python
65+
uses: actions/setup-python@v1
66+
with:
67+
python-version: 3.7
68+
69+
- name: Install dependencies
70+
run: pip install flake8
71+
72+
- name: Run flake8
73+
run: flake8 --count .
74+
75+
format:
76+
name: format
77+
runs-on: ubuntu-latest
78+
steps:
79+
- name: Checkout repository
80+
uses: actions/checkout@v2
81+
82+
- name: Set up Python
83+
uses: actions/setup-python@v1
84+
with:
85+
python-version: 3.7
86+
87+
- name: Install dependencies
88+
# isort needs all of the packages to be installed so it can
89+
# tell which are third party and which are first party
90+
run: pip install -r requirements.txt
91+
92+
- name: Check formatting of imports
93+
run: isort --check-only --diff --verbose
94+
95+
- name: Check formatting of code
96+
run: black . --check --diff

Diff for: .github/workflows/release.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: release
2+
on:
3+
push:
4+
tags:
5+
- 'v[0-9]+.[0-9]+.[0-9]+'
6+
7+
jobs:
8+
create-pypi-release:
9+
name: create-pypi-release
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v2
14+
15+
- name: Set up Python 3.7
16+
uses: actions/setup-python@v1
17+
with:
18+
python-version: 3.7
19+
20+
- name: Install the dependencies
21+
run: pip install -r requirements.txt
22+
23+
- name: Build the distributions
24+
run: python setup.py sdit bdist_wheel
25+
26+
- name: Upload to PyPI
27+
uses: pypa/gh-action-pypi-publish@master
28+
with:
29+
password: ${{ secrets.PYPI_PASSWORD }}
30+
31+
create-gh-releases-release:
32+
name: create-gh-releases-release
33+
runs-on: ubuntu-latest
34+
env:
35+
VERSION:
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v2
39+
40+
- name: Get the version
41+
run: echo ::set-env name=VERSION::${GITHUB_REF#refs/tags/}
42+
43+
- name: Create release
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
uses: actions/create-release@v1
47+
with:
48+
tag_name: ${{ env.VERSION }}
49+
release_name: ${{ env.VERSION }}

Diff for: .gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ __pycache__/
88
.coverage
99
htmlcov/
1010
test.py
11-
*.egg-info
11+
*.egg-info
12+
coverage.xml

Diff for: .travis.yml

-25
This file was deleted.

Diff for: README.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
FastAPI-SQLAlchemy
22
==================
33

4-
.. image:: https://travis-ci.com/mfreeborn/fastapi-sqlalchemy.svg?branch=master
5-
:target: https://travis-ci.com/mfreeborn/fastapi-sqlalchemy
6-
.. image:: https://coveralls.io/repos/github/mfreeborn/fastapi-sqlalchemy/badge.svg?branch=master
7-
:target: https://coveralls.io/github/mfreeborn/fastapi-sqlalchemy?branch=master
4+
.. image:: https://github.com/mfreeborn/fastapi-sqlalchemy/workflows/ci/badge.svg
5+
:target: https://github.com/mfreeborn/fastapi-sqlalchemy/actions
6+
.. image:: https://codecov.io/gh/mfreeborn/fastapi-sqlalchemy/branch/master/graph/badge.svg
7+
:target: https://codecov.io/gh/mfreeborn/fastapi-sqlalchemy
88
.. image:: https://img.shields.io/pypi/v/fastapi_sqlalchemy?color=blue
99
:target: https://pypi.org/project/fastapi-sqlalchemy
1010

Diff for: fastapi_sqlalchemy/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
__all__ = ["db", "DBSessionMiddleware"]
44

5-
__version__ = "0.1.4"
5+
__version__ = "0.1.5"

Diff for: fastapi_sqlalchemy/exceptions.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ def __init__(self):
1515

1616

1717
class SessionNotInitialisedError(Exception):
18-
"""Exception raised when the user tries to create a new DB session without first initialising it."""
18+
"""Exception raised when the user creates a new DB session without first initialising it."""
1919

2020
def __init__(self):
2121
msg = """
22-
Session not initialised! Ensure that DBSessionMiddleware has been initialised before attempting
23-
database access.
22+
Session not initialised! Ensure that DBSessionMiddleware has been initialised before
23+
attempting database access.
2424
"""
2525

2626
super().__init__(msg)

Diff for: pyproject.toml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[tool.black]
2+
line-length = 100
3+
target-version = ['py37']
4+
include = '\.pyi?$'
5+
exclude = '''
6+
(
7+
| .git
8+
| .venv
9+
| build
10+
| dist
11+
)
12+
'''
13+
14+
[tool.isort]
15+
multi_line_output = 3
16+
include_trailing_comma = true
17+
force_grid_wrap = 0
18+
use_parentheses = true
19+
line_length = 100

Diff for: requirements.txt

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
1+
appdirs==1.4.3
12
atomicwrites==1.3.0
23
attrs==19.3.0
4+
black==19.10b0
35
certifi==2019.9.11
46
chardet==3.0.4
7+
click==7.1.1
58
coverage==4.5.4
9+
entrypoints==0.3
610
fastapi==0.52.0
11+
flake8==3.7.9
712
idna==2.8
813
importlib-metadata==1.5.0
14+
isort==4.3.21
15+
mccabe==0.6.1
916
more-itertools==7.2.0
1017
packaging==19.2
18+
pathspec==0.7.0
1119
pluggy==0.13.0
1220
py==1.8.0
21+
pycodestyle==2.5.0
1322
pydantic==0.32.2
23+
pyflakes==2.1.1
1424
pyparsing==2.4.2
1525
pytest==5.2.2
1626
pytest-cov==2.8.1
17-
python-coveralls==2.9.3
1827
PyYAML==5.3.1
28+
regex==2020.2.20
1929
requests==2.22.0
2030
six==1.12.0
2131
SQLAlchemy==1.3.10
2232
starlette==0.13.2
33+
toml==0.10.0
34+
typed-ast==1.4.1
2335
urllib3==1.25.6
2436
wcwidth==0.1.7
2537
zipp==3.1.0

Diff for: setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
long_description=long_description,
2525
packages=["fastapi_sqlalchemy"],
2626
python_requires=">=3.7",
27-
install_requires=["starlette >=0.12.9,<1.0.0", "SQLAlchemy>=1.2"],
27+
install_requires=["starlette >=0.12.9", "SQLAlchemy>=1.2"],
2828
classifiers=[
2929
"Development Status :: 4 - Beta",
3030
"Environment :: Web Environment",

0 commit comments

Comments
 (0)