Skip to content

Commit 9c943ee

Browse files
authored
Merge pull request #47 from Tech-JI/chore-pytest-github-action
chore: Add GitHub Actions workflow for testing
2 parents c83f2b9 + ab22540 commit 9c943ee

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/pytest.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# This workflow will install Python dependencies, run tests with a single version of Python
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Python application
5+
6+
on:
7+
push:
8+
branches: [ "dev", "main" ]
9+
pull_request:
10+
branches: [ "dev", "main" ]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
test:
17+
runs-on: ubuntu-latest
18+
19+
services:
20+
postgres:
21+
image: postgres:18
22+
env:
23+
POSTGRES_DB: coursereview
24+
POSTGRES_USER: admin
25+
POSTGRES_PASSWORD: test
26+
ports:
27+
- 5432:5432
28+
options: >-
29+
--health-cmd pg_isready
30+
--health-interval 10s
31+
--health-timeout 5s
32+
--health-retries 5
33+
34+
steps:
35+
- uses: actions/checkout@v6
36+
37+
- name: Install python
38+
uses: actions/setup-python@v6
39+
with:
40+
python-version-file: "pyproject.toml"
41+
42+
- name: Install uv
43+
uses: astral-sh/setup-uv@v7
44+
with:
45+
enable-cache: true
46+
version: "0.10.7"
47+
48+
- name: Install the project
49+
run: uv sync --group dev
50+
51+
- name: Test with pytest
52+
env:
53+
DATABASE__URL: postgres://admin:test@localhost:5432/coursereview
54+
SECRET_KEY: 02247f40-a769-4c49-9178-4c038048e7ad
55+
run: |
56+
uv run pytest

0 commit comments

Comments
 (0)