Skip to content
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ doc/changes/changelog.md linguist-generated=true
.github/workflows/build-and-publish.yml linguist-generated=true
.github/workflows/cd.yml linguist-generated=true
.github/workflows/check-release-tag.yml linguist-generated=true
.github/workflows/checks.yml linguist-generated=true
.github/workflows/ci.yml linguist-generated=true
.github/workflows/fast-tests.yml linguist-generated=true
.github/workflows/gh-pages.yml linguist-generated=true
.github/workflows/matrix-*.yml linguist-generated=true
.github/workflows/pr-merge.yml linguist-generated=true
.github/workflows/report.yml linguist-generated=true
.github/workflows/slow-checks.yml linguist-generated=true
56 changes: 0 additions & 56 deletions .github/workflows/checks.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions .github/workflows/ci.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions .github/workflows/fast-tests-extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Fast-Tests-Extension
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no template for this workflow by intention?
Why?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! I think I understood:

  • default workflow (generated from template) is fast-tests.yml
  • The yaml renderer has been enhanced to allow (%if sections
  • Such a section includes a call to an individual workflow file if such exists.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment to this file?
Or user guide?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good suggestions. I was planning on adding the doc-related points in this PR, just wanted to get an initial response first. Think I'd do both the user guide and a comment in one of the workflow files, like fast-tests.yml


on:
workflow_call:

jobs:
lint-imports:
name: Lint Imports
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Check out Repository
id: check-out-repository
uses: actions/checkout@v6

- name: Set up Python & Poetry Environment
id: set-up-python-and-poetry-environment
uses: exasol/python-toolbox/.github/actions/python-environment@v7
with:
python-version: "3.10"
poetry-version: "2.3.0"

- name: Lint Imports
id: lint-imports
run: poetry run -- nox -s lint:import
45 changes: 45 additions & 0 deletions .github/workflows/fast-tests.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 7 additions & 16 deletions .github/workflows/merge-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ name: Merge-Gate

on:
workflow_call:
inputs:
root-event:
description: GitHub event triggering the root workflow ci.yml
required: false
type: string
default: unknown

jobs:
run-fast-checks:
Expand All @@ -16,18 +10,24 @@ jobs:
permissions:
contents: read

run-fast-tests:
name: Fast Tests
uses: ./.github/workflows/fast-tests.yml
permissions:
contents: read

fast-report:
name: Fast Report
needs:
- run-fast-checks
- run-fast-tests
uses: ./.github/workflows/report.yml
secrets: inherit
permissions:
contents: read

approve-run-slow-tests:
name: Approve Running Slow Tests?
if: ${{ inputs.root-event != 'schedule' }}
runs-on: "ubuntu-24.04"
permissions:
contents: read
Expand All @@ -48,14 +48,6 @@ jobs:
permissions:
contents: read

test-python-environment:
name: Test python-environment Action
needs:
- approve-run-slow-tests
uses: ./.github/workflows/test-python-environment.yml
permissions:
contents: read

# This job ensures inputs have been executed successfully.
allow-merge:
name: Allow Merge
Expand All @@ -67,7 +59,6 @@ jobs:
needs:
- run-fast-checks
- run-slow-checks
- test-python-environment
# To prevent accidentally merges, this step is required. For more details
# see: https://github.com/exasol/python-toolbox/issues/563
steps:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/periodic-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Periodic-Validation
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name is excellent! 💯

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I think it comes from you and/or @tkilias 😄
I took a look at #337 to see what had been discussed & with what I had in mind 😉


on:
schedule:
# At 00:00 on Saturday. (https://crontab.guru)
- cron: "0 0 * * 6"

jobs:
run-fast-checks:
name: Fast Checks
uses: ./.github/workflows/checks.yml
permissions:
contents: read

run-fast-tests:
name: Fast Tests
uses: ./.github/workflows/fast-tests.yml
permissions:
contents: read

run-slow-checks:
name: Slow Checks
uses: ./.github/workflows/slow-checks.yml
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep the name "slow-checks" or would "slow-tests" be better as pendant to "fast-tests"?

OK looking below, I think you already came to a conclusion here.

      - run-fast-checks
      - run-fast-tests
      - run-slow-checks

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way works for me -> I'd like slow-tests a bit more.
Though, right now, it's not clear what we'll allow in the current slow-checks.
I like the comments from @tkilias:

If we allowed slow-checks to not be controlled by the PTB, this would reduce how much infrastructure we need to accommodate and would be easier for the downstream projects. It's a question then of what separates slow-checks from other slower tests or checks. Like @tkilias put in this comment:

We might want to make the distinction as to what file options are put into the periodic-validation.yml for the Sonar statistics.

secrets: inherit
permissions:
contents: read

report:
name: Report
needs:
- run-fast-checks
- run-fast-tests
- run-slow-checks
uses: ./.github/workflows/report.yml
secrets: inherit
permissions:
contents: read
11 changes: 11 additions & 0 deletions .github/workflows/slow-checks-extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Slow-Checks-Extension

on:
workflow_call:

jobs:
test-python-environment:
name: Test python-environment Action
uses: ./.github/workflows/test-python-environment.yml
permissions:
contents: read
6 changes: 6 additions & 0 deletions .github/workflows/slow-checks.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .workflow-patcher.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
workflows:
- name: checks
- name: fast-tests
step_customizations:
- action: REPLACE
job: run-unit-tests
Expand Down
25 changes: 25 additions & 0 deletions exasol/toolbox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,22 @@ def check_minimum_version(cls, v: str, info: ValidationInfo) -> str:
return v


class WorkflowExtension(BaseModel):
"""
Used to define which workflow extensions are active.
The corresponding `*-extension.yml` must be defined in the project.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The corresponding `*-extension.yml` must be defined in the project.
The corresponding files `*-extension.yml` are optional
but must be added in the individual projects.

"""

fast_tests: bool = Field(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't the renderer look for the files and include them if they exist?
In this case we wouldn't need an additional configuration in the noxconfig.

There could also be options when calling nox session workflow:generate, e.g. --fast-tests-extension and --slow-checks-extension to generate an initial empty skeleton.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like your point about having the BaseConfig detect the files (instead of providing a configuration). I think that's a better/simpler way to go.

I'll think about it some more. Initially, I'm not so sure about adding on to the CLI with empty skeletons. I like @tkilias's more general suggestion to include/link to examples. We would already have 2 cases covered in the python-toolbox too, so those could be linked.

default=False,
description="If true, a job is added in the fast-test.yml to execute fast-test-extension.yml",
)
slow_checks: bool = Field(
default=False,
description="If true, a job is added in the slow-checks.yml to execute slow-checks-extension.yml",
)


class BaseConfig(BaseModel):
"""
Basic configuration for projects using the PTB
Expand Down Expand Up @@ -191,6 +207,14 @@ class BaseConfig(BaseModel):
are supported.
""",
)
workflow_extension: WorkflowExtension = Field(
default=WorkflowExtension(),
description="""
This is used to activate specific workflow extensions. In the *-extension.yml
files, projects can specify custom GitHub workflow jobs that extend what
the default PTB offers.
""",
)
model_config = ConfigDict(frozen=True, arbitrary_types_allowed=True)

@computed_field # type: ignore[misc]
Expand Down Expand Up @@ -284,6 +308,7 @@ def github_template_dict(self) -> dict[str, Any]:
"minimum_python_version": self.minimum_python_version,
"os_version": self.os_version,
"python_versions": self.python_versions,
"workflow_extension": self.workflow_extension.model_dump(),
}

@computed_field # type: ignore[misc]
Expand Down
34 changes: 0 additions & 34 deletions exasol/toolbox/templates/github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,37 +187,3 @@ jobs:
- name: Build Package
id: build-package
run: poetry run -- nox -s package:check

run-unit-tests:
name: Unit Tests (Python-${{ matrix.python-versions }})
runs-on: "(( os_version ))"
permissions:
contents: read
strategy:
fail-fast: false
matrix:
python-versions: (( python_versions | tojson ))

steps:
- name: Check out Repository
id: check-out-repository
uses: actions/checkout@v6

- name: Set up Python & Poetry Environment
id: set-up-python-and-poetry-environment
uses: exasol/python-toolbox/.github/actions/python-environment@v7
with:
python-version: ${{ matrix.python-versions }}
poetry-version: "(( dependency_manager_version ))"

- name: Run Unit Tests
id: run-unit-tests
run: poetry run -- nox -s test:unit -- --coverage

- name: Upload Artifacts
id: upload-artifacts
uses: actions/upload-artifact@v7
with:
name: coverage-python${{ matrix.python-versions }}-fast
path: .coverage
include-hidden-files: true
Loading
Loading