Skip to content

Merge pull request #2 from abstra-app/ci/add-github-actions-checks #5

Merge pull request #2 from abstra-app/ci/add-github-actions-checks

Merge pull request #2 from abstra-app/ci/add-github-actions-checks #5

Workflow file for this run

name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
test:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Run tests with pytest
run: |
pytest --cov=abstra_json_sql --cov-report=xml --cov-report=term -v
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.python-version == '3.12'
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
lint:
name: Lint (Ruff)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: 'pip'
- name: Install ruff
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Run ruff check
run: ruff check .
- name: Run ruff format check
run: ruff format --check .
typecheck:
name: Type Check (Pyright)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyright
- name: Run pyright
run: pyright abstra_json_sql
all-checks-passed:
name: All Checks Passed
runs-on: ubuntu-latest
needs: [test, lint, typecheck]
if: always()
steps:
- name: Check all jobs
run: |
if [ "${{ needs.test.result }}" != "success" ] || \
[ "${{ needs.lint.result }}" != "success" ] || \
[ "${{ needs.typecheck.result }}" != "success" ]; then
echo "One or more checks failed"
exit 1
fi
echo "All checks passed successfully!"