Skip to content

fix: Update CI step for publish #22

fix: Update CI step for publish

fix: Update CI step for publish #22

Workflow file for this run

name: Build and Test SQLNotify
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: uv.lock
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- name: Build Docker image
run: |
docker build -t sqlnotify:ci .
- name: Run tests and collect coverage inside Docker
run: |
# Create a directory to store the coverage reports
mkdir -p coverage_output
# Start services and run tests inside the sqlnotify service so dependent services (postgres) resolve
docker compose up -d postgres
docker compose run --rm \
-v "${{ github.workspace }}/coverage_output":/app/coverage_output \
sqlnotify \
bash -lc "uv run pytest --cov=sqlnotify --cov-report=xml:/app/coverage_output/coverage.xml --cov-report=lcov:/app/coverage_output/lcov.info"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage_output/coverage.xml
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Publish to PyPI (inside Docker)
run: |
docker run --rm -e PYPI_TOKEN="${{ secrets.PYPI_TOKEN }}" sqlnotify \
bash -lc "uv build && uv publish -t $PYPI_TOKEN"
- name: Compose down
run: docker compose down --remove-orphans