Skip to content

Commit

Permalink
ci: replace compose with psql service container
Browse files Browse the repository at this point in the history
  • Loading branch information
thearchitector committed Nov 24, 2023
1 parent dbf80fe commit e901543
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 12 deletions.
32 changes: 27 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,32 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
experimental: [false]
include:
- python-version: "3.12"
experimental: true

services:
postgres:
image: postgres:alpine
env:
POSTGRES_PASSWORD: "password"
POSTGRES_DB: "casbin_rule"
options: >-
--health-cmd "pg_isready"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Adjust container
run: sed -i 's/3.7/${{ matrix.python-version }}/' docker-compose.yaml
- uses: actions/checkout@v4
- name: Set up PDM
uses: pdm-project/setup-pdm@v3
with:
python-version: ${{ matrix.python-version }}
cache: true
- name: Install dependencies
run: pdm install -G :all
- name: Run tests
run: docker-compose run --rm test pytest
run: pdm run pytest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
.mypy_cache
__pycache__
.pdm-build
.ruff_cache

# builds
dist
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [1.2.2] - 2023-11-24

### Fixed

- Improved and corrected static typing.

## [1.2.1] - 2023-11-23

### Added
Expand Down
9 changes: 3 additions & 6 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
version: "3"

services:
test-db:
image: postgres:12-alpine
postgres:
image: postgres:alpine
environment:
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "password"
POSTGRES_DB: "casbin_rule"
healthcheck:
Expand All @@ -18,5 +15,5 @@ services:
volumes:
- .:/casbin-tortoise
depends_on:
test-db:
postgres:
condition: service_healthy
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async def adapter():
await Tortoise.init(
{
"connections": {
"default": "postgres://postgres:password@test-db:5432/casbin"
"default": "postgres://postgres:password@postgres:5432/casbin"
},
"apps": {"my_app": {"models": ["casbin_tortoise_adapter"]}},
},
Expand Down

0 comments on commit e901543

Please sign in to comment.