- Replaces GitLab CI with GitHub Actions for CI/CD. - Uses Poetry for dependency management. - Includes linting with Ruff and testing with pytest. - Uploads coverage reports to Codecov. - Removes the old .gitlab-ci.yml file.
65 lines
1.4 KiB
YAML
65 lines
1.4 KiB
YAML
name: Python CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.x'
|
|
|
|
- name: Install Poetry
|
|
run: |
|
|
curl -sSL https://install.python-poetry.org | python3 -
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
- name: Install dependencies
|
|
run: poetry install --no-root
|
|
|
|
- name: Run Ruff
|
|
run: |
|
|
poetry run ruff check
|
|
poetry run ruff format --check
|
|
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
needs: lint
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.x'
|
|
|
|
- name: Install Poetry
|
|
run: |
|
|
curl -sSL https://install.python-poetry.org | python3 -
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
- name: Install dependencies
|
|
run: poetry install --no-root
|
|
|
|
- name: Run Tests
|
|
run: poetry run pytest -v --cov=. --cov-report=xml
|
|
|
|
- name: Upload coverage to Codecov
|
|
run: bash <(curl -s https://codecov.io/bash)
|
|
env:
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|