Skip to content

Commit

Permalink
ci: Adding github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanderhoof authored Jan 8, 2024
1 parent 9a04c37 commit 405151c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Python Tests

on: [push]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Cache Poetry virtualenv
uses: actions/cache@v2
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-poetry-${{ matrix.python-version }}-
- name: Install dependencies
run: poetry install

- name: Run tests
run: poetry run coverage run --source=alembic_dddl -m pytest tests/

- name: Generate coverage
run: poetry run coverage xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
6 changes: 3 additions & 3 deletions tests/src/renderer_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime
from datetime import datetime, timezone
from pathlib import Path
from textwrap import dedent
from unittest.mock import mock_open, patch
Expand Down Expand Up @@ -99,11 +99,11 @@ def test_render_with_timestamp(sample_ddl1: DDL) -> None:
ddl=sample_ddl1,
scripts_location=str(DDL_DIR),
revision_id="abcdef123",
time=datetime(2023, 1, 1, 12, 15),
time=datetime(2023, 1, 1, 12, 15, tzinfo=timezone.utc),
use_timestamps=True,
)

expected_filename = "1672571700_sample_ddl1_abcdef123.sql"
expected_filename = "1672575300_sample_ddl1_abcdef123.sql"
expected_filepath = str(DDL_DIR / expected_filename)
expected_result = f"op.run_ddl_script('{expected_filename}')"

Expand Down

0 comments on commit 405151c

Please sign in to comment.