Skip to content

Commit 5987627

Browse files
authored
Develop (#35)
* refactor: Separate development and production dependencies in setup.py - Moved development dependencies (e.g., uvicorn) to the 'dev' extras_require - Users can now install development dependencies with `pip install fastapi_quickcrud[dev]` - Updated the setup.py file accordingly * add github action * remove chectout * update action * add different python version * add coverage * add coverage * Delete .github/workflows/coverage.yml * update readme * remove circleci * rename name * add coverage * add CD
1 parent ec019a5 commit 5987627

3 files changed

Lines changed: 235 additions & 0 deletions

File tree

.coveragerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
[report]
33
show_missing = True
44
omit =
5+
/usr/*
56
venv/*
67
tests/*
78
src/fastapi_quickcrud/misc/abstract_execute.py

.github/workflows/coverage.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Coverage
4+
5+
# Controls when the workflow will run
6+
on:
7+
push:
8+
branches: [ "main", "develop" ]
9+
pull_request:
10+
branches: [ "main", "develop" ]
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15+
jobs:
16+
Coverage:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
python-version: [ '3.10' ]
21+
services:
22+
postgres:
23+
image: postgres:11
24+
env:
25+
POSTGRES_USER: postgres
26+
POSTGRES_PASSWORD: postgres
27+
POSTGRES_DB: ci_db_test
28+
ports:
29+
- 5432:5432
30+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
31+
32+
steps:
33+
- uses: actions/checkout@master
34+
35+
- name: Set github token
36+
run: echo "GITHUB_TOKEN=${{ secrets.GIT_TOKEN }}" >> $GITHUB_ENV
37+
- name: Set coveralls token
38+
run: echo "COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }}" >> $GITHUB_ENV
39+
- name: Enable Postgres Trigram Extension
40+
run: |
41+
PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
42+
- name: pip install, make coverage
43+
env:
44+
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost/ci_db_test
45+
TEST_DATABASE_ASYNC_URL: postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
46+
run: |
47+
python -m pip install --upgrade pip
48+
pip install -r requirements.txt
49+
pip install coverage
50+
pip install coveralls
51+
python -m coverage run -m unittest
52+
coveralls

.github/workflows/release.yml

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Publish Python 🐍 distributions 📦 to PyPI
4+
5+
on:
6+
push:
7+
tags:
8+
- '**'
9+
10+
jobs:
11+
ciPython37:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: [ 3.7 ]
16+
services:
17+
postgres:
18+
image: postgres:11
19+
env:
20+
POSTGRES_USER: postgres
21+
POSTGRES_PASSWORD: postgres
22+
POSTGRES_DB: ci_db_test
23+
ports:
24+
- 5432:5432
25+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
26+
steps:
27+
- uses: actions/checkout@v3
28+
- name: Set up Python ${{ matrix.python-version }}
29+
uses: actions/setup-python@v1
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install -r requirements.txt
36+
- name: Enable Postgres Trigram Extension
37+
run: |
38+
PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
39+
- name: Test with unittest
40+
env:
41+
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost/ci_db_test
42+
TEST_DATABASE_ASYNC_URL: postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
43+
run: |
44+
python -m unittest discover -s ./tests/test_implementations
45+
ciPython38:
46+
runs-on: ubuntu-latest
47+
strategy:
48+
matrix:
49+
python-version: [ 3.8 ]
50+
services:
51+
postgres:
52+
image: postgres:11
53+
env:
54+
POSTGRES_USER: postgres
55+
POSTGRES_PASSWORD: postgres
56+
POSTGRES_DB: ci_db_test
57+
ports:
58+
- 5432:5432
59+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
60+
steps:
61+
- uses: actions/checkout@v3
62+
- name: Set up Python ${{ matrix.python-version }}
63+
uses: actions/setup-python@v1
64+
with:
65+
python-version: ${{ matrix.python-version }}
66+
- name: Install dependencies
67+
run: |
68+
python -m pip install --upgrade pip
69+
pip install -r requirements.txt
70+
- name: Enable Postgres Trigram Extension
71+
run: |
72+
PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
73+
- name: Test with unittest
74+
env:
75+
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost/ci_db_test
76+
TEST_DATABASE_ASYNC_URL: postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
77+
run: |
78+
python -m unittest discover -s ./tests/test_implementations
79+
ciPython39:
80+
runs-on: ubuntu-latest
81+
strategy:
82+
matrix:
83+
python-version: [ 3.9 ]
84+
services:
85+
postgres:
86+
image: postgres:11
87+
env:
88+
POSTGRES_USER: postgres
89+
POSTGRES_PASSWORD: postgres
90+
POSTGRES_DB: ci_db_test
91+
ports:
92+
- 5432:5432
93+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
94+
steps:
95+
- uses: actions/checkout@v3
96+
- name: Set up Python ${{ matrix.python-version }}
97+
uses: actions/setup-python@v1
98+
with:
99+
python-version: ${{ matrix.python-version }}
100+
- name: Install dependencies
101+
run: |
102+
python -m pip install --upgrade pip
103+
pip install -r requirements.txt
104+
- name: Enable Postgres Trigram Extension
105+
run: |
106+
PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
107+
- name: Test with unittest
108+
env:
109+
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost/ci_db_test
110+
TEST_DATABASE_ASYNC_URL: postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
111+
run: |
112+
python -m unittest discover -s ./tests/test_implementations
113+
ciPython310:
114+
runs-on: ubuntu-latest
115+
strategy:
116+
matrix:
117+
python-version: [ '3.10' ]
118+
services:
119+
postgres:
120+
image: postgres:11
121+
env:
122+
POSTGRES_USER: postgres
123+
POSTGRES_PASSWORD: postgres
124+
POSTGRES_DB: ci_db_test
125+
ports:
126+
- 5432:5432
127+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
128+
steps:
129+
- uses: actions/checkout@v3
130+
- name: Set up Python ${{ matrix.python-version }}
131+
uses: actions/setup-python@v1
132+
with:
133+
python-version: ${{ matrix.python-version }}
134+
- name: Install dependencies
135+
run: |
136+
python -m pip install --upgrade pip
137+
pip install -r requirements.txt
138+
- name: Enable Postgres Trigram Extension
139+
run: |
140+
PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
141+
- name: Test with unittest
142+
env:
143+
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost/ci_db_test
144+
TEST_DATABASE_ASYNC_URL: postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
145+
run: |
146+
python -m unittest discover -s ./tests/test_implementations
147+
build-n-publish:
148+
needs: [ciPython37, ciPython38, ciPython39,ciPython310]
149+
name: Build and publish Python 🐍 distributions 📦 to PyPI
150+
runs-on: ubuntu-latest
151+
steps:
152+
- uses: actions/checkout@master
153+
- name: Set up Python 3.7
154+
uses: actions/setup-python@v3
155+
with:
156+
python-version: "3.7"
157+
- name: Set release version env
158+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
159+
- name: Release version
160+
run: |
161+
echo $RELEASE_VERSION
162+
echo ${{ env.RELEASE_VERSION }}
163+
- name: Install pypa/build
164+
run: >-
165+
python -m
166+
pip install
167+
build
168+
--user
169+
- name: Build a binary wheel and a source tarball
170+
run: >-
171+
python -m
172+
build
173+
--sdist
174+
--wheel
175+
--outdir dist/
176+
.
177+
- name: Publish distribution 📦 to PyPI
178+
if: startsWith(github.ref, 'refs/tags')
179+
uses: pypa/gh-action-pypi-publish@release/v1
180+
with:
181+
user: __token__
182+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)