From aa6ca55c3cb8784ed0c664f5c1dffdd165d6d8cb Mon Sep 17 00:00:00 2001 From: Thomas Ubensee <34603111+tomuben@users.noreply.github.com> Date: Tue, 19 Nov 2024 07:25:02 -0300 Subject: [PATCH] Restructed GH workflows for tests --- .github/workflows/checks.yml | 31 ++-------------- .github/workflows/merge-gate.yml | 30 +++------------- .github/workflows/tests.yml | 61 ++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 54 deletions(-) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index e7d35fcaf..a6bc01f16 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -119,32 +119,5 @@ jobs: include-hidden-files: true Tests: - name: 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 }} - strategy: - fail-fast: false - matrix: - python-version: ["3.9", "3.10", "3.11"] - 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.17.0 - 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: Upload Artifacts - uses: actions/upload-artifact@v4.4.0 - with: - name: coverage-python${{ matrix.python-version }} - path: .coverage - include-hidden-files: true + name: Tests + uses: ./.github/workflows/tests.yml diff --git a/.github/workflows/merge-gate.yml b/.github/workflows/merge-gate.yml index 1f9f949c7..75da3f76d 100644 --- a/.github/workflows/merge-gate.yml +++ b/.github/workflows/merge-gate.yml @@ -8,39 +8,19 @@ on: jobs: - fast-checks: - name: Fast + checks: + name: Checks uses: ./.github/workflows/checks.yml - 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" - - # 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 ] + needs: [ checks ] # Each job requires a step, so we added this dummy step. steps: - - name: Approve + - name: Approve run: | echo "Merge Approved" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 000000000..245f48be2 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,61 @@ +name: Tests + +on: + workflow_call: + secrets: + ALTERNATIVE_GITHUB_TOKEN: + required: false + +jobs: + + Tests: + name: Tests (Python-${{ matrix.python-version }}, Exasol-${{ matrix.exasol-version}}) + runs-on: ubuntu-latest + 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.17.0 + with: + python-version: ${{ matrix.python-version }} + + - name: Run Unit Tests + run: poetry run nox -s test:unit + + - name: Run Unit Tests + run: poetry run coverage report -m + + - name: Upload Artifacts + uses: actions/upload-artifact@v4.4.0 + with: + name: coverage-python${{ matrix.python-version }} + path: .coverage + include-hidden-files: true + + Slow-Tests: + 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"