-
Notifications
You must be signed in to change notification settings - Fork 2
Feature/825 split up workflows unit tests and periodic runs #826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
81d8ec2
40ffdb7
0f8abdd
c163f0d
e5e6bc0
4b351f7
70ec171
85b3be8
ceda85f
f823761
6193139
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| name: Fast-Tests-Extension | ||
|
|
||
| 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 | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: Periodic-Validation | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The name is excellent! 💯
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
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 |
||
| 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 | ||
| 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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| 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 | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -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. | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| """ | ||||||||
|
|
||||||||
| fast_tests: bool = Field( | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There could also be options when calling nox session
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||||||||
|
|
@@ -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] | ||||||||
|
|
@@ -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] | ||||||||
|
|
||||||||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
fast-tests.yml(%ifsectionsThere was a problem hiding this comment.
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?
There was a problem hiding this comment.
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