Skip to content

Commit f13dda4

Browse files
authored
Fix project-template tests to run against unreleased PTB code (#534)
* Fix project-template tests to run against unreleased PTB code * Update documentation, as we'd expect work on a tag to be complete whereas main might be in an unreleased state * Alter slow-checks to get manual approval first & separately from tests * Apply comments per review via IDE to make clearer why certain actions are taken * Re-add line to checks.yml for fetch-depth * Fix accidentally switch to 1.7.4 instead of local github usage * Amend unreleased.md to reflect final state of change
1 parent bc4a21d commit f13dda4

File tree

12 files changed

+78
-34
lines changed

12 files changed

+78
-34
lines changed

.github/workflows/checks.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
workflow_call:
55

66
jobs:
7-
87
Version-Check:
98
name: Version
109
runs-on: ubuntu-24.04
@@ -43,6 +42,11 @@ jobs:
4342
run: |
4443
poetry run -- nox -s links:check
4544
45+
build-matrix:
46+
name: Generate Build Matrix
47+
uses: ./.github/workflows/matrix-python.yml
48+
permissions:
49+
contents: read
4650

4751
Changelog:
4852
name: Changelog Update Check
@@ -60,12 +64,6 @@ jobs:
6064
- name: Run changelog update check
6165
run: poetry run -- nox -s changelog:updated
6266

63-
build-matrix:
64-
name: Generate Build Matrix
65-
uses: ./.github/workflows/matrix-python.yml
66-
permissions:
67-
contents: read
68-
6967
Lint:
7068
name: Linting (Python-${{ matrix.python-version }})
7169
needs: [ Version-Check, build-matrix ]
@@ -75,7 +73,6 @@ jobs:
7573
strategy:
7674
fail-fast: false
7775
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
78-
7976
steps:
8077
- name: SCM Checkout
8178
uses: actions/checkout@v4
@@ -128,6 +125,7 @@ jobs:
128125
strategy:
129126
fail-fast: false
130127
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
128+
131129
steps:
132130
- name: SCM Checkout
133131
uses: actions/checkout@v4
@@ -175,6 +173,7 @@ jobs:
175173
steps:
176174
- name: SCM Checkout
177175
uses: actions/checkout@v4
176+
# The PTB has unit tests which require the fetch-depth to be 0.
178177
with:
179178
fetch-depth: 0
180179

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ on:
88
- cron: "0 0 1/7 * *"
99

1010
jobs:
11+
1112
CI:
1213
uses: ./.github/workflows/merge-gate.yml
1314
secrets: inherit
1415
permissions:
1516
contents: read
17+
1618
Metrics:
1719
needs: [ CI ]
1820
uses: ./.github/workflows/report.yml
1921
secrets: inherit
2022
permissions:
21-
contents: read
23+
contents: read

.github/workflows/matrix-python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ on:
99

1010
jobs:
1111
python_versions:
12+
runs-on: ubuntu-24.04
1213
permissions:
1314
contents: read
14-
runs-on: ubuntu-24.04
1515
steps:
1616
- name: SCM Checkout
1717
uses: actions/checkout@v4

.github/workflows/merge-gate.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,25 @@ jobs:
1111
permissions:
1212
contents: read
1313

14+
run-slow-tests:
15+
name: Run Slow Tests
16+
runs-on: ubuntu-24.04
17+
permissions:
18+
contents: read
19+
20+
# Even though the environment "manual-approval" will be created automatically,
21+
# it still needs to be configured to require interactive review.
22+
# See project settings on GitHub (Settings / Environments / manual-approval).
23+
environment: manual-approval
24+
steps:
25+
- name: Tests
26+
run: echo "Slow tests approved"
27+
1428
slow-checks:
1529
name: Slow
30+
needs: [ run-slow-tests ]
1631
uses: ./.github/workflows/slow-checks.yml
32+
secrets: inherit
1733
permissions:
1834
contents: read
1935

.github/workflows/pr-merge.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88

99
jobs:
1010

11+
# This job can be removed if certain preconditions are met. See
12+
# https://exasol.github.io/python-toolbox/user_guide/workflows.html#pr-merge-workflow
13+
1114
ci-job:
1215
name: Checks
1316
uses: ./.github/workflows/checks.yml

.github/workflows/report.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55

66
jobs:
77

8-
Report:
8+
report:
99
runs-on: ubuntu-24.04
1010
permissions:
1111
contents: read
@@ -22,7 +22,7 @@ jobs:
2222
uses: ./.github/actions/python-environment
2323

2424
- name: Download Artifacts
25-
uses: actions/download-artifact@v4.3.0
25+
uses: actions/download-artifact@v4.2.1
2626
with:
2727
path: ./artifacts
2828

@@ -32,14 +32,14 @@ jobs:
3232
- name: Validate Artifacts
3333
run: poetry run -- nox -s artifacts:validate
3434

35-
- name: Generate Report
36-
run: poetry run -- nox -s project:report -- --format json | tee metrics.json
37-
3835
- name: Upload to sonar
3936
env:
4037
SONAR_TOKEN: "${{ secrets.SONAR_TOKEN }}"
4138
run: poetry run -- nox -s sonar:check
4239

40+
- name: Generate Report
41+
run: poetry run -- nox -s project:report -- --format json | tee metrics.json
42+
4343
- name: Upload Artifacts
4444
uses: actions/upload-artifact@v4.6.2
4545
with:

.github/workflows/slow-checks.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,18 @@ on:
44
workflow_call:
55

66
jobs:
7-
87
build-matrix:
98
name: Generate Build Matrix
109
uses: ./.github/workflows/matrix-all.yml
1110
permissions:
1211
contents: read
1312

14-
Tests:
13+
tests:
1514
name: Integration-Tests (Python-${{ matrix.python-version }}, Exasol-${{ matrix.exasol-version}})
1615
needs: [ build-matrix ]
1716
runs-on: ubuntu-24.04
1817
permissions:
1918
contents: read
20-
# Even though the environment "manual-approval" will be created automatically,
21-
# it still needs to be configured to require interactive review.
22-
# See project settings on GitHub (Settings / Environments / manual-approval).
23-
environment: manual-approval
2419
env:
2520
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2621
strategy:
@@ -47,7 +42,7 @@ jobs:
4742
include-hidden-files: true
4843

4944

50-
Verify-Poetry-Installation:
45+
verify-poetry-installation:
5146
# This Job verifies if pipx installation is successful on each of the
5247
# selected GitHub Runners.
5348
strategy:
@@ -85,4 +80,4 @@ jobs:
8580
poetry run which python
8681
poetry run python --version
8782
poetry env list
88-
poetry run python --version | grep "${{ matrix.python-version }}"
83+
poetry run python --version | grep "${{ matrix.python-version }}"

doc/changes/unreleased.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ With the refactoring of the `dependency:audit`, we use `poetry export`. For how
44
be added (project-specific or globally), see the
55
[poetry export documentation](https://github.com/python-poetry/poetry-plugin-export).
66

7+
## Feature
8+
9+
* #469: Moved manual approval for slow tests to merge-gate.yml
10+
711
## Refactoring
812

913
* #517: Refactored `dependency:audit` & split up to support upcoming work
14+
15+
## Bugfix
16+
17+
* #533: Fixed project-template tests to run with unreleased PTB to better detect issues pre-release

doc/user_guide/getting_started.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ Use the following command to create a new project:
3737
.. code-block:: shell
3838
3939
cookiecutter https://github.com/exasol/python-toolbox.git \
40-
--directory project-template
40+
--checkout <latest-tag> --directory project-template
41+
42+
.. note::
43+
44+
Without option :code:`--checkout` cookiecutter will use the main branch of the PTB. In order
45+
to get reliable and reproducible results, we recommend using the tag of PTB's latest released
46+
version instead.
4147

4248
**2. Follow the interactive project setup prompt**
4349

exasol/toolbox/templates/github/workflows/merge-gate.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,25 @@ jobs:
1111
permissions:
1212
contents: read
1313

14+
run-slow-tests:
15+
name: Run Slow Tests
16+
runs-on: ubuntu-24.04
17+
permissions:
18+
contents: read
19+
20+
# Even though the environment "manual-approval" will be created automatically,
21+
# it still needs to be configured to require interactive review.
22+
# See project settings on GitHub (Settings / Environments / manual-approval).
23+
environment: manual-approval
24+
steps:
25+
- name: Tests
26+
run: echo "Slow tests approved"
27+
1428
slow-checks:
1529
name: Slow
30+
needs: [ run-slow-tests ]
1631
uses: ./.github/workflows/slow-checks.yml
32+
secrets: inherit
1733
permissions:
1834
contents: read
1935

0 commit comments

Comments
 (0)