Skip to content

Commit

Permalink
ci: Test packages with several versions of Python + improve Ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
otetard committed Sep 27, 2024
1 parent feba712 commit 1d1a4d3
Showing 1 changed file with 34 additions and 13 deletions.
47 changes: 34 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,54 @@ jobs:
- uses: actions/checkout@v3

- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"

- name: Install Poetry
run: |
pip install poetry
poetry config virtualenvs.in-project true
- name: Run Ruff
- name: Check `poetry.lock` consistency
run: |
poetry lock --check
- name: Install linting dependencies
run: |
poetry install --only=lint
- name: Run Ruff (linter)
run: |
poetry run pip install ruff
poetry run ruff check --output-format=github .
- uses: psf/black@stable
- name: Run Ruff (formater)
run: |
poetry run ruff format
- name: Execute Mypy
run: |
poetry run pip install mypy
mkdir -p .mypy_cache
poetry run mypy --install-types --non-interactive --hide-error-context sekoia_automation
poetry run mypy
Test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version:
- '3.10'
- '3.11'
- '3.12'

steps:
- uses: actions/checkout@v3

- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: ${{ matrix.python-version }}

- name: Install Poetry
run: |
Expand All @@ -59,20 +76,24 @@ jobs:
poetry run python -m pytest --junit-xml=junit.xml --cov-report term --cov-report xml:coverage.xml --cov=sekoia_automation
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
if: always() && matrix.python-version == 3.12
uses: actions/upload-artifact@v4
with:
name: Unit Test Results
path: junit.xml

- name: Code Coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
if: matrix.python-version == 3.12
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

EventFile:
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}

0 comments on commit 1d1a4d3

Please sign in to comment.