Skip to content

Commit

Permalink
#427: Implemented GH approval for slow tests (#428)
Browse files Browse the repository at this point in the history
fixes #427
  • Loading branch information
tomuben authored Jan 17, 2025
1 parent f866efb commit c3c7fef
Show file tree
Hide file tree
Showing 28 changed files with 351 additions and 267 deletions.
1 change: 0 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
* [ ] Have you updated the changelog?
* [ ] Have you checked to ensure there aren't other open [Pull Requests](../../../../pulls) for the same update/change? <!-- markdown-link-check-disable-line -->
* [ ] Are you mentioning the issue which this PullRequest fixes ("Fixes...")
* [ ] Before you merge don't forget to run all tests for all Exasol version, by adding `[run all tests]` to the commit message
* [ ] Are the CLI usage examples up to date?
1 change: 0 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ jobs:
needs: [ cd-job ]
name: Publish Documentation
uses: ./.github/workflows/gh-pages.yml

2 changes: 1 addition & 1 deletion .github/workflows/check-release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@0.17.0
uses: exasol/python-toolbox/.github/actions/python-environment@0.20.0

- name: Check Tag Version
# make sure the pushed/created tag matched the project version
Expand Down
50 changes: 30 additions & 20 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: Checks

on:
workflow_call:
secrets:
ALTERNATIVE_GITHUB_TOKEN:
required: false

jobs:

Expand All @@ -19,7 +16,7 @@ jobs:
fetch-depth: 0

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@0.17.0
uses: exasol/python-toolbox/.github/actions/python-environment@0.20.0

- name: Check Version(s)
run: |
Expand All @@ -35,27 +32,30 @@ jobs:
uses: actions/checkout@v4

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@0.17.0
uses: exasol/python-toolbox/.github/actions/python-environment@0.20.0

- name: Build Documentation
run: |
poetry run python -m nox -s docs:build
build-matrix:
name: Generate Build Matrix
uses: ./.github/workflows/matrix-python.yml

Lint:
name: Linting (Python-${{ matrix.python-version }})
needs: [ Version-Check ]
needs: [ Version-Check, build-matrix ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}

steps:
- name: SCM Checkout
uses: actions/checkout@v4

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@0.17.0
uses: exasol/python-toolbox/.github/actions/python-environment@0.20.0
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -71,19 +71,18 @@ jobs:

Type-Check:
name: Type Checking (Python-${{ matrix.python-version }})
needs: [ Version-Check ]
needs: [ Version-Check, build-matrix ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}

steps:
- name: SCM Checkout
uses: actions/checkout@v4

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@0.17.0
uses: exasol/python-toolbox/.github/actions/python-environment@0.20.0
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -92,19 +91,18 @@ jobs:

Security:
name: Security Checks (Python-${{ matrix.python-version }})
needs: [ Version-Check ]
needs: [ Version-Check, build-matrix ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.9", "3.10", "3.11" ]
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}

steps:
- name: SCM Checkout
uses: actions/checkout@v4

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@0.17.0
uses: exasol/python-toolbox/.github/actions/python-environment@0.20.0
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -118,6 +116,18 @@ jobs:
path: .security.json
include-hidden-files: true

Tests:
name: Tests
uses: ./.github/workflows/tests_with_coverage.yml
Format:
name: Format Check
runs-on: ubuntu-latest

steps:
- name: SCM Checkout
uses: actions/checkout@v4

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@0.20.0
with:
python-version: "3.9"

- name: Run format check
run: poetry run nox -s project:format
62 changes: 47 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,56 @@
name: CI

on:
push:
branches-ignore:
- "github-pages/*"
- "gh-pages/*"
- "main"
- "master"
pull_request:
types: [opened, reopened]
schedule:
# “At 00:00 on every 7th day-of-month from 1 through 31.” (https://crontab.guru)
- cron: "0 0 1/7 * *"

jobs:

CI:
uses: ./.github/workflows/merge-gate.yml
secrets: inherit
checks:
name: Checks
uses: ./.github/workflows/checks.yml

Metrics:
needs: [ CI ]
fast-tests:
name: Fast Tests
uses: ./.github/workflows/fast-tests.yml

slow-tests-approval:
name: Approve Slow Tests
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 approved"

slow-tests:
name: Slow Tests
needs: slow-tests-approval
uses: ./.github/workflows/slow-tests.yml
#Do not inherit secrets because ITDE Slow Tests does not need it

metrics:
name: Report Metrics
needs: [ checks, fast-tests ]
uses: ./.github/workflows/report.yml

# This job ensures inputs have been executed successfully.
approve-merge:
name: Allow Merge
runs-on: ubuntu-latest
# If you need additional jobs to be part of the merge gate, add them below
needs: [ checks, fast-tests, slow-tests ]

# Each job requires a step, so we added this dummy step.
steps:
- name: Approve
run: echo "Merge Approved"

53 changes: 53 additions & 0 deletions .github/workflows/fast-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Fast Tests

on:
workflow_call:
secrets:
ALTERNATIVE_GITHUB_TOKEN:
required: false

jobs:
build-matrix:
name: Generate Build Matrix
uses: ./.github/workflows/matrix-python.yml

fast-tests:
name: Unit-Tests (Python-${{ matrix.python-version }}, Exasol-${{ matrix.exasol-version}})
needs: [ build-matrix ]
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.ALTERNATIVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}

steps:
- name: SCM Checkout
uses: actions/checkout@v4

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@0.20.0
with:
python-version: ${{ matrix.python-version }}

- name: Run Tests and Collect Coverage
run: poetry run nox -s test:unit -- -- --coverage

- name: Upload Artifacts
uses: actions/upload-artifact@v4.4.0
with:
name: coverage-python${{ matrix.python-version }}-fast
path: .coverage
include-hidden-files: true

db-version-minimal-tests:
name: Run Db Versions Minimal Tests
uses: ./.github/workflows/test-db-versions-minimal.yml

test-docker-starter:
name: Test Docker Starter
uses: ./.github/workflows/test-docker-starter.yml

test-shell-scripts:
name: Test Shell Scripts
uses: ./.github/workflows/test-shell-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@0.17.0
uses: exasol/python-toolbox/.github/actions/python-environment@0.20.0
with:
python-version: "3.10"
poetry-version: '1.8.2'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Publish Documentation

on:
on:
workflow_call:
workflow_dispatch:

Expand All @@ -16,11 +16,11 @@ jobs:
fetch-depth: 0

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@0.17.0
uses: exasol/python-toolbox/.github/actions/python-environment@0.20.0

- name: Build Documentation
run: |
poetry run sphinx-multiversion doc/ .html-documentation
poetry run nox -s docs:multiversion
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4.6.0
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/matrix-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build Matrix (Python)

on:
workflow_call:
outputs:
matrix:
description: "Generates the python version build matrix"
value: ${{ jobs.python_versions.outputs.matrix }}

jobs:
python_versions:

runs-on: ubuntu-latest

steps:
- name: SCM Checkout
uses: actions/checkout@v4

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@0.20.0

- name: Generate matrix
run: poetry run nox -s matrix:python

- id: set-matrix
run: |
echo "matrix=$(poetry run nox -s matrix:python)" >> $GITHUB_OUTPUT
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
26 changes: 0 additions & 26 deletions .github/workflows/merge-gate.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/periodic-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Periodic Validation

on:
schedule:
# “At 00:00 on every 7th day-of-month from 1 through 31.” (https://crontab.guru)
- cron: "0 0 1/7 * *"

jobs:

checks:
name: Checks
uses: ./.github/workflows/checks.yml

fast-tests:
name: Fast Tests
uses: ./.github/workflows/fast-tests.yml

slow-tests:
name: Slow Tests
uses: ./.github/workflows/slow-tests.yml
#Do not inherit secrets because ITDE Slow Tests does not need it

metrics:
name: Report Metrics
needs: [ checks, fast-tests ]
uses: ./.github/workflows/report.yml

Loading

0 comments on commit c3c7fef

Please sign in to comment.