Skip to content

Add support for Python 3.12 and improve CI to test several versions of Python #521

Add support for Python 3.12 and improve CI to test several versions of Python

Add support for Python 3.12 and improve CI to test several versions of Python #521

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Poetry
run: |
pip install poetry
poetry config virtualenvs.in-project true
- 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 ruff check --output-format=github .
- name: Run Ruff (formater)
run: |
poetry run ruff format
- name: Execute Mypy
run: |
mkdir -p .mypy_cache
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@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
pip install poetry
poetry config virtualenvs.in-project true
- name: Install dependencies
id: install-dependencies
run: poetry install --extras=all
- name: Execute Python tests
id: execute-tests
run: |
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() && 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@v4
if: matrix.python-version == 3.12
EventFile:
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}