Skip to content

Commit

Permalink
Fixes from Review (together with KK)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomuben committed Jan 17, 2025
1 parent c0ffcd3 commit b78bb8e
Show file tree
Hide file tree
Showing 17 changed files with 111 additions and 76 deletions.
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

3 changes: 0 additions & 3 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 Down
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ jobs:
name: Checks
uses: ./.github/workflows/checks.yml

fast-tests:
name: Fast Tests
uses: fast-tests.yml

slow-tests-approval:
name: Slow
name: Slow Approval
runs-on: ubuntu-latest

# Even though the environment "manual-approval" will be created automatically,
Expand All @@ -25,32 +29,28 @@ jobs:
# to the approve-merge job's input requirements (needs).
steps:
- name: Tests
run: |
echo "Slow tests approved"
run: echo "Slow tests approved"

slow-tests:
needs: slow-tests-approval
name: Slow Tests
uses: ./.github/workflows/slow_tests.yml

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

metrics:
needs: [ fast-tests, checks ]
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: [ metrics, slow-tests ]
needs: [ checks, fast-tests, slow-tests ]

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

Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,13 @@ jobs:
include-hidden-files: true

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

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

test-shell-scripts:
uses: ./.github/workflows/test_shell_scripts.yml
name: Test Shell Scripts
uses: test-shell-scripts.yml
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ jobs:
name: Checks
uses: ./.github/workflows/checks.yml

slow-tests:
name: Slow Tests
uses: ./.github/workflows/slow_tests.yml

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

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

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

26 changes: 15 additions & 11 deletions .github/workflows/pr-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,26 @@ jobs:
# This job can be removed if certain preconditions are met. See
# https://exasol.github.io/python-toolbox/user_guide/workflows.html#pr-merge-workflow

ci-job:
checks:
name: Checks
uses: ./.github/workflows/checks.yml
secrets: inherit

publish-docs:
name: Publish Documentation
uses: ./.github/workflows/gh-pages.yml

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

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

publish-docker-runnmer:
uses: ./.github/workflows/publish_docker_runner.yml
publish-docs:
name: Publish Documentation
uses: ./.github/workflows/gh-pages.yml

publish-docker-runner:
name: Publish Runner Docker Image to Dockerhub
uses: publish-docker-runner.yml
secrets:
DOCKER_USER_NAME: ${{ secrets.DOCKER_USER_NAME }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Publish Docker Runner

on:
workflow_call:
secrets:
DOCKER_USER_NAME:
required: true
DOCKER_TOKEN:
required: true

jobs:
publish:
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@ name: Status Report

on:
workflow_call:
secrets:
ALTERNATIVE_GITHUB_TOKEN:
required: false

jobs:

report:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.ALTERNATIVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: SCM Checkout
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/slow-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Slow Tests

on:
workflow_call:

jobs:

test-db-versions-all-tests:
name: Run all tests with all supported Db Versions
uses: test-db-versions-all-tests.yml

test-python-versions:
name: Run all tests with all supported Python versions
uses: test-python-versions.yml
14 changes: 0 additions & 14 deletions .github/workflows/slow_tests.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
name: Test DB Versions with all tests

# python-version: default as specified
# database-version: all supported by ITDE
# tests: all
#
# Use the specified default version of python and call nox task run_all_tests for
# all versions of Exasol database currently supported by the ITDE.

on:
workflow_call:

jobs:
get_exasol_versions:

uses: ./.github/workflows/get_exasol_versions.yml
name: Read all supported Exasol DB versions
uses: get-exasol-versions.yml

test-db-versions-all-tests:
needs: get_exasol_versions
Expand All @@ -16,12 +23,13 @@ jobs:
exasol_version: ${{fromJson(needs.get_exasol_versions.outputs.matrix)}}
runs-on: ubuntu-latest
name: Run all tests for Exasol ${{ matrix.exasol_version }}

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: "3.10"
poetry-version: '1.8.2'
Expand All @@ -30,4 +38,4 @@ jobs:
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0

- name: Run all tests
run: poetry run nox -s "run-tests(db_version='${{ matrix.exasol_version }}')"
run: poetry run nox -s "run-all-tests(db_version='${{ matrix.exasol_version }}')"
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
name: Test DB Versions with minimal tests

# python-version: default as specified
# database-version: all supported by ITDE
# tests: minimal (subset of all tests)
#
# Use the specified default version of python and call nox task
# run_minimal_tests to execute a few selected tests for all versions of Exasol
# database currently supported by the ITDE.

on:
workflow_call:


jobs:
get_exasol_versions:
uses: ./.github/workflows/get_exasol_versions.yml
uses: get-exasol-versions.yml

test-db-versions-minimal:
name: Run Minimal Tests for Exasol ${{ matrix.exasol_version }}
Expand All @@ -21,7 +28,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 All @@ -31,4 +38,3 @@ jobs:

- name: Run Minimal Tests
run: poetry run nox -s "run-minimal-tests(db_version='${{ matrix.exasol_version }}')"

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
name: Test Python Versions with all tests

# python-version: All supported Python version
# database-version: Default
# tests: all
#
# Call nox task run_tests for all version of Python as defined in the
# python-toolbox (PTB) using the default version of the Exasol database.

on:
workflow_call:

Expand All @@ -10,7 +17,7 @@ jobs:
uses: ./.github/workflows/matrix-python.yml

test-python-version-all-tests:
name: Run Tests with Python ${{ matrix.python_version }} and Exasol ${{ matrix.exasol_version }}
name: Run Tests with Python ${{ matrix.python_version }} and Default Exasol Version
needs: [ build-matrix ]
strategy:
fail-fast: false
Expand All @@ -21,7 +28,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: ${{ matrix.python-version }}
poetry-version: '1.8.2'
Expand All @@ -30,4 +37,4 @@ jobs:
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0

- name: Run all tests
run: poetry run nox -s "run-tests(db_version='default')"
run: poetry run nox -s "run-all-tests(db_version='default')"
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@ jobs:
run: ./scripts/build/shellcheck.sh

- name: Install Test Dependencies
run: |
sudo apt-get install -y shunit2
run: sudo apt-get install -y shunit2

- name: Run shunit2 based Shell Tests
run: shunit2 scripts/health_test.sh

- name: Run Starter Script Tests
run: starter_scripts/test/test_scripts.sh



17 changes: 13 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,16 @@ def get_db_versions() -> List[str]:
return db_versions


@nox.session(name="run-tests", python=False)
@nox.session(name="run-all-tests", python=False)
@nox.parametrize("db_version", get_db_versions())
def run_tests(session: nox.Session, db_version: str):
"""Run the tests in the poetry environment"""
def run_all_tests(session: nox.Session, db_version: str):
"""
Run all tests using the specified version of Exasol database or all versions currently supported by the ITDE.
This nox tasks runs 3 different groups of tests for the ITDE:
1. new unit tests (using pytest framework)
2. new integration tests (also using pytest)
3. old tests (mainly integration tests) using python module "unitest"
"""
env = {"EXASOL_VERSION": db_version}
session.run("pytest", "./test/unit")
session.run("pytest", "./test/integration", env=env)
Expand All @@ -56,7 +62,10 @@ def run_tests(session: nox.Session, db_version: str):
@nox.session(name="run-minimal-tests", python=False)
@nox.parametrize("db_version", get_db_versions())
def run_minimal_tests(session: nox.Session, db_version: str):
"""Run the minimal tests in the poetry environment"""
"""
This nox task runs selected tests from new unit tests and selected old and new integration tests using the
specified version of Exasol database or all versions currently supported by the ITDE.
"""
env = {"EXASOL_VERSION": db_version}
minimal_tests = {
"old-itest": [
Expand Down

0 comments on commit b78bb8e

Please sign in to comment.