Merge pull request #158 from SEKOIA-IO/feat/release_1.18.1 #628
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [ opened, synchronize, reopened ] | |
jobs: | |
Lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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-matrix: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 | |
with: | |
fail_ci_if_error: true | |
files: coverage.xml | |
token: ${{ secrets.CODECOV_TOKEN }} | |
Test: | |
runs-on: ubuntu-latest | |
needs: | |
- Test-matrix | |
if: always() | |
steps: | |
- name: Successful deploy | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
- name: Failing deploy | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 | |
EventFile: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Event File | |
path: ${{ github.event_path }} |