Skip to content

Commit

Permalink
Add basic CI test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicoretti committed Feb 5, 2024
1 parent 6598a0d commit 18675cc
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 31 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI Checks

on:
workflow_call:


jobs:

unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: [ "3.11" ]

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

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/[email protected]
with:
python-version: ${{ matrix.python-version }}

- name: Run Tests
run: |
poetry run nox -s unit-tests
integration-tests:
name: Integration Tests
runs-on: ubuntu-20.04
strategy:
fail-fast: true
matrix:
python-version: [ "3.11" ]

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

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/[email protected]
with:
python-version: ${{ matrix.python-version }}

- name: Run Tests
run: |
poetry run nox -s integration-tests
17 changes: 1 addition & 16 deletions .github/workflows/ci-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,5 @@ on:
- cron: "0 0 1/7 * *"

jobs:

verify:
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@main
with:
python-version: "3.11"

- name: Run all checks
run: |
echo "Stub: This needs to call the checks in the future"
uses: ./.github/workflows/checks.yml
16 changes: 1 addition & 15 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,4 @@ on:
jobs:

verify:
runs-on: ubuntu-latest

steps:

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

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/[email protected]
with:
python-version: "3.11"

- name: Run all checks
run: |
echo "Stub: This needs to call the checks in the future"
uses: ./.github/workflows/checks.yml
47 changes: 47 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from __future__ import annotations
from pathlib import Path
from typing import Iterable
import nox
from nox import Session

__all__ = [
"unit_tests",
"integration_tests",
]

_ROOT : Path = Path(__file__).parent


def _test_command(path: Path) -> Iterable[str]:
base_command = ["poetry", "run"]
pytest_command = ["pytest", "-v", f"{path}"]
return base_command + pytest_command


def _unit_tests(session: Session) -> None:
command = _test_command(_ROOT / "test" / "unit")
session.run(*command)


def _integration_tests(session: Session) -> None:
command = _test_command(_ROOT / "test" / "integration")
session.run(*command)


@nox.session(name="unit-tests", python=False)
def unit_tests(session: Session) -> None:
"""Runs all unit tests"""
_unit_tests(session)


@nox.session(name="integration-tests", python=False)
def integration_tests(session: Session) -> None:
"""Runs the all integration tests"""
_integration_tests(session)


@nox.session(name="all-tests", python=False)
def all_tests(session: Session) -> None:
"""Runs all tests (Unit and Integration)"""
command = _test_command(_ROOT / "test")
session.run(*command)

0 comments on commit 18675cc

Please sign in to comment.