-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (56 loc) · 2.07 KB
/
pythonapp.yml
File metadata and controls
70 lines (56 loc) · 2.07 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
64
65
66
67
68
69
70
name: Build and Test
on: [push]
env:
SECRET_KEY: secret_key_github_actions_12345_github_action_secret_key
SECURE_SSL_REDIRECT: 0
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
UV_SYSTEM_PYTHON: 1
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14-alpine
env:
POSTGRES_USER: zootable
POSTGRES_PASSWORD: zootable
POSTGRES_DB: zootable
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --mount type=tmpfs,destination=/var/lib/postgresql/data --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
with:
enable-cache: true
cache-dependency-glob: "requirements**.txt"
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.13"
- name: Install dependencies
run: |
uv pip install -r requirements.txt -r requirements-dev.txt -e .
- name: Run migrations
run: python manage.py migrate --noinput
- name: Test with pytest
run: |
pytest --cov=zoo_checks --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
with:
files: ./coverage.xml
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
- name: Ensure that we can build the image
if: github.ref != 'refs/heads/main'
run: |
docker build --pull --tag zootable .
- name: Get flyctl
if: github.ref == 'refs/heads/main'
uses: superfly/flyctl-actions/setup-flyctl@master
- name: Deploy to fly
if: github.ref == 'refs/heads/main'
run: flyctl deploy --remote-only