fix: Raise exception on error when retrieving secrets #1045
This file contains hidden or 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 ] | |
| permissions: {} | |
| jobs: | |
| Lint: | |
| permissions: | |
| contents: read # for actions/checkout to fetch code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Install Python | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: "3.12" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1 | |
| with: | |
| enable-cache: true | |
| activate-environment: true | |
| - name: Check `uv.lock` consistency | |
| run: | | |
| uv lock --check | |
| - name: Install linting dependencies | |
| run: | | |
| uv sync --group=lint | |
| - name: Run Ruff (linter) | |
| run: | | |
| uv run ruff check --output-format=github . | |
| - name: Run Ruff (formatter) | |
| run: | | |
| uv run ruff format --check . | |
| - name: Execute Mypy | |
| run: | | |
| mkdir -p .mypy_cache | |
| uv run mypy | |
| Test-matrix: | |
| permissions: | |
| contents: read # for actions/checkout to fetch code | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: | |
| - '3.11' | |
| - '3.12' | |
| - '3.13' | |
| - '3.14' | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Install Python | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1 | |
| with: | |
| enable-cache: true | |
| activate-environment: true | |
| - name: Install dependencies | |
| id: install-dependencies | |
| run: uv sync --all-extras | |
| - name: Execute Python tests | |
| id: execute-tests | |
| run: | | |
| uv 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@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: Unit Test Results | |
| path: junit.xml | |
| - name: Code Coverage | |
| uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 | |
| 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@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: Event File | |
| path: ${{ github.event_path }} |