-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (58 loc) · 1.75 KB
/
Copy pathpython-app.yml
File metadata and controls
63 lines (58 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# FlickVault CI workflow: install dependencies, lint, and smoke-test the app.
# This workflow is tuned specifically for FlickVault's FastAPI backend.
name: FlickVault Python CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
permissions:
contents: read
jobs:
changes:
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.filter.outputs.src }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
src:
- 'app/**'
- 'data/**'
- 'static/**'
- 'requirements.txt'
- '.github/workflows/python-app.yml'
- '.env.example'
build:
needs: changes
if: ${{ needs.changes.outputs.should_run == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -r requirements.txt
- name: Lint app and data packages
run: |
# Only enforce fatal Python errors / undefined names in this repo's current style.
flake8 app data --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Smoke-test FastAPI app
env:
AUTH_DISABLED: 'true'
DEV_USER_ID: 'ci-user'
run: |
python -m uvicorn app.app:app --host 127.0.0.1 --port 8000 &
uvicorn_pid=$!
trap "kill $uvicorn_pid" EXIT
sleep 6
curl -f http://127.0.0.1:8000/
curl -f http://127.0.0.1:8000/config