From a7da7c0a7aa1b829ed87b280337bc55d29d0b2ee Mon Sep 17 00:00:00 2001 From: Nicola Coretti Date: Mon, 25 Nov 2024 15:05:14 +0100 Subject: [PATCH] Update workflows --- .github/workflows/checks.yml | 2 +- .github/workflows/merge-gate.yml | 4 -- .github/workflows/slow-checks.yml | 7 ++- .../templates/github/workflows/checks.yml | 11 +++-- .../templates/github/workflows/merge-gate.yml | 22 ++-------- .../templates/github/workflows/report.yml | 3 +- .../github/workflows/slow-checks.yml | 43 +++++++++++++++++++ 7 files changed, 59 insertions(+), 33 deletions(-) create mode 100644 exasol/toolbox/templates/github/workflows/slow-checks.yml diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 62172df60..3958ffd8d 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -118,7 +118,7 @@ jobs: include-hidden-files: true Tests: - name: Tests (Python-${{ matrix.python-version }}, Exasol-${{ matrix.exasol-version}}) + name: Unit-Tests (Python-${{ matrix.python-version }}, Exasol-${{ matrix.exasol-version}}) needs: [ Documentation, Lint, Type-Check, Security] runs-on: ubuntu-latest env: diff --git a/.github/workflows/merge-gate.yml b/.github/workflows/merge-gate.yml index 46ad5abed..f9e7aa2be 100644 --- a/.github/workflows/merge-gate.yml +++ b/.github/workflows/merge-gate.yml @@ -14,10 +14,6 @@ jobs: slow-checks: name: Slow - # Even though the environment "manual-approval" will be created automatically, - # it still needs to be configured to require interactive review. - # See project settings on GitHub (Settings / Environments / manual-approval). - environment: manual-approval uses: ./.github/workflows/slow-checks.yml # This job ensures inputs have been executed successfully. diff --git a/.github/workflows/slow-checks.yml b/.github/workflows/slow-checks.yml index 8ee3ec982..14d2fe0ef 100644 --- a/.github/workflows/slow-checks.yml +++ b/.github/workflows/slow-checks.yml @@ -9,9 +9,12 @@ on: jobs: Tests: - name: Tests (Python-${{ matrix.python-version }}, Exasol-${{ matrix.exasol-version}}) - needs: [ Documentation, Lint, Type-Check, Security] + name: Integration-Tests (Python-${{ matrix.python-version }}, Exasol-${{ matrix.exasol-version}}) runs-on: ubuntu-latest + # Even though the environment "manual-approval" will be created automatically, + # it still needs to be configured to require interactive review. + # See project settings on GitHub (Settings / Environments / manual-approval). + environment: manual-approval env: GITHUB_TOKEN: ${{ secrets.ALTERNATIVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} strategy: diff --git a/exasol/toolbox/templates/github/workflows/checks.yml b/exasol/toolbox/templates/github/workflows/checks.yml index 0083beb01..5f5bf5260 100644 --- a/exasol/toolbox/templates/github/workflows/checks.yml +++ b/exasol/toolbox/templates/github/workflows/checks.yml @@ -124,8 +124,8 @@ jobs: include-hidden-files: true Tests: - name: Tests (Python-${{ matrix.python-version }}, Exasol-${{ matrix.exasol-version}}) - needs: [ Documentation, Lint, Type-Check, Security ] + name: Unit-Tests (Python-${{ matrix.python-version }}, Exasol-${{ matrix.exasol-version}}) + needs: [ Documentation, Lint, Type-Check, Security] runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{ secrets.ALTERNATIVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} @@ -144,13 +144,12 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Run Tests and Compute Coverage - run: poetry run nox -s test:coverage -- -- --db-version ${{ matrix.exasol-version }} + - name: Run Tests and Collect Coverage + run: poetry run nox -s test:unit -- -- --coverage --db-version ${{ matrix.exasol-version }} - name: Upload Artifacts uses: actions/upload-artifact@v4.4.0 with: - name: coverage-python${{ matrix.python-version }} + name: coverage-python${{ matrix.python-version }}-fast path: .coverage include-hidden-files: true - diff --git a/exasol/toolbox/templates/github/workflows/merge-gate.yml b/exasol/toolbox/templates/github/workflows/merge-gate.yml index 1f9f949c7..f9e7aa2be 100644 --- a/exasol/toolbox/templates/github/workflows/merge-gate.yml +++ b/exasol/toolbox/templates/github/workflows/merge-gate.yml @@ -14,33 +14,17 @@ jobs: slow-checks: name: Slow - runs-on: ubuntu-latest - - # Even though the environment "manual-approval" will be created automatically, - # it still needs to be configured to require interactive review. - # See project settings on GitHub (Settings / Environments / manual-approval). - environment: manual-approval - - # Replace the steps below with the required actions - # and/or add additional jobs if required - # Note: - # If you add additional jobs, make sure they are added as a requirement - # to the approve-merge job's input requirements (needs). - steps: - - name: Tests - run: | - echo "Slow tests ran successfully" - + uses: ./.github/workflows/slow-checks.yml # This job ensures inputs have been executed successfully. approve-merge: - name: Allow Merge + name: Allow Merge runs-on: ubuntu-latest # If you need additional jobs to be part of the merge gate, add them below needs: [ fast-checks, slow-checks ] # Each job requires a step, so we added this dummy step. steps: - - name: Approve + - name: Approve run: | echo "Merge Approved" diff --git a/exasol/toolbox/templates/github/workflows/report.yml b/exasol/toolbox/templates/github/workflows/report.yml index bb7433610..c0deae394 100644 --- a/exasol/toolbox/templates/github/workflows/report.yml +++ b/exasol/toolbox/templates/github/workflows/report.yml @@ -30,7 +30,8 @@ jobs: - name: Copy Artifacts into Root Folder working-directory: ./artifacts run: | - cp coverage-python3.9/.coverage ../ + poetry run coverage combine --keep coverage-python3.9*/.coverage + cp .coverage ../ cp lint-python3.9/.lint.txt ../ cp security-python3.9/.security.json ../ diff --git a/exasol/toolbox/templates/github/workflows/slow-checks.yml b/exasol/toolbox/templates/github/workflows/slow-checks.yml new file mode 100644 index 000000000..961734b82 --- /dev/null +++ b/exasol/toolbox/templates/github/workflows/slow-checks.yml @@ -0,0 +1,43 @@ +name: Slow-Checks + +on: + workflow_call: + secrets: + ALTERNATIVE_GITHUB_TOKEN: + required: false + +jobs: + + Tests: + name: Integration-Tests (Python-${{ matrix.python-version }}, Exasol-${{ matrix.exasol-version}}) + runs-on: ubuntu-latest + # Even though the environment "manual-approval" will be created automatically, + # it still needs to be configured to require interactive review. + # See project settings on GitHub (Settings / Environments / manual-approval). + environment: manual-approval + env: + GITHUB_TOKEN: ${{ secrets.ALTERNATIVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + strategy: + fail-fast: false + matrix: + python-version: [ "3.9", "3.10", "3.11", "3.12" ] + exasol-version: [ "7.1.9" ] + + steps: + - name: SCM Checkout + uses: actions/checkout@v4 + + - name: Setup Python & Poetry Environment + uses: exasol/python-toolbox/.github/actions/python-environment@0.18.0 + with: + python-version: ${{ matrix.python-version }} + + - name: Run Tests and Collect Coverage + run: poetry run nox -s test:integration -- -- --coverage --db-version ${{ matrix.exasol-version }} + + - name: Upload Artifacts + uses: actions/upload-artifact@v4.4.0 + with: + name: coverage-python${{ matrix.python-version }}-slow + path: .coverage + include-hidden-files: true