Skip to content

Commit 18bf66c

Browse files
committed
chore: add github workflows
1 parent 35558d3 commit 18bf66c

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed

.github/workflows/pytest.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Pytest
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ master ]
7+
paths:
8+
- 'fastapi_user_auth/**'
9+
- 'tests/**'
10+
pull_request:
11+
branches: [ master ]
12+
paths:
13+
- 'fastapi_user_auth/**'
14+
- 'tests/**'
15+
16+
jobs:
17+
test:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
python-version: [ "3.7", "3.8", "3.9", "3.10" ]
22+
fail-fast: false
23+
24+
steps:
25+
- uses: actions/checkout@v3
26+
- name: Set up Python
27+
uses: actions/setup-python@v3
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
- uses: actions/cache@v3
31+
id: cache
32+
with:
33+
path: ${{ env.pythonLocation }}
34+
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test
35+
36+
- name: Install Flit
37+
if: steps.cache.outputs.cache-hit != 'true'
38+
run: pip install flit
39+
- name: Install Dependencies
40+
if: steps.cache.outputs.cache-hit != 'true'
41+
run: flit install --symlink
42+
43+
- name: Test
44+
run: pytest
45+
# - name: Upload coverage
46+
# uses: codecov/codecov-action@v1
47+
# - name: Lint with flake8
48+
# run: |
49+
# # stop the build if there are Python syntax errors or undefined names
50+
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
51+
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
52+
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
53+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish Python Package
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types:
7+
- created
8+
9+
jobs:
10+
build-and-publish:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Set up Python
15+
uses: actions/setup-python@v3
16+
with:
17+
python-version: "3.8"
18+
- uses: actions/cache@v3
19+
id: cache
20+
with:
21+
path: ${{ env.pythonLocation }}
22+
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-publish
23+
24+
- name: Install Flit
25+
if: steps.cache.outputs.cache-hit != 'true'
26+
run: pip install flit
27+
- name: Install Dependencies
28+
if: steps.cache.outputs.cache-hit != 'true'
29+
run: flit install --symlink
30+
31+
- name: Publish to PyPI
32+
# if: startsWith(github.ref, 'refs/tags')
33+
run: flit publish
34+
env:
35+
FLIT_USERNAME: __token__
36+
FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)