From 6a80db59431cf2b9ac9e17ebbb3b0fac0d15c3de Mon Sep 17 00:00:00 2001 From: Jean-Marc Fontaine Date: Sat, 6 Apr 2024 19:45:21 +0000 Subject: [PATCH] Add QA GitHub Actions workflow --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++++++++ .pre-commit-config.yaml | 5 +++-- spacemk/exporters/base.py | 2 +- 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a0070c1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,32 @@ +name: CI +run-name: "CI (${{ github.event_name == 'pull_request' && format('pr: #{0}', github.event.number) || format('{0}: {1}', startsWith(github.event.ref, 'refs/tags') && 'tag' || 'branch', github.ref_name) }})" +on: push +jobs: + nox: + runs-on: ${{ matrix.os }} + strategy: + matrix: + nox_sessions: ["ruff", "tests"] + os: ["macos-latest", "ubuntu-latest", "windows-latest"] + python-version: ["3.10", "3.11", "3.12"] + name: ${{ matrix.nox_sessions }} (${{ matrix.python-version }}, ${{ matrix.os }}) + steps: + - name: Check the repository out + uses: actions/checkout@v4 + - name: Install Python + uses: actions/setup-python@v5 + with: + architecture: x64 + python-version: ${{ matrix.python-version }} + - name: Install nox and poetry + run: | + pipx install nox poetry + pipx inject nox nox-poetry + pipx inject poetry poetry-plugin-export + - name: Restore nox cache + uses: actions/cache@v4 + with: + key: nox-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.nox_sessions }}-${{ hashFiles('poetry.lock') }}-${{ hashFiles('noxfile.py') }} + path: .nox + - name: Run ${{ matrix.nox_sessions }} nox session + run: nox -rs ${{ matrix.nox_sessions }}-${{ matrix.python-version }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 92c60c8..8e433c8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,9 +16,10 @@ repos: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.6 + rev: v0.3.5 hooks: - id: ruff + args: [--fix] - repo: https://github.com/codespell-project/codespell rev: v2.2.6 @@ -44,7 +45,7 @@ repos: rev: 3.0.38 hooks: - id: checkov - args: ['--skip-framework', 'dockerfile', '--quiet'] + args: ["--skip-framework", "dockerfile", "--quiet"] - repo: https://github.com/antonbabenko/pre-commit-terraform rev: v1.83.6 diff --git a/spacemk/exporters/base.py b/spacemk/exporters/base.py index 5f64cd9..3b53ad3 100644 --- a/spacemk/exporters/base.py +++ b/spacemk/exporters/base.py @@ -142,7 +142,7 @@ def _save_report_to_file(self, data: dict) -> None: for key, value in sorted(pivoted_entity_type_data.items()): worksheet.write(0, column, key) worksheet.write_column(1, column, value) - column += 1 + column += 1 # noqa: SIM113 workbook.close()