Skip to content

Commit bc4b51f

Browse files
Add metrics support
* Add support for reporting project metrics * Add `report` task * Add metrics workflow * Update workflows * Update documentation * Update templates * Update dependencies * Remove scriv support Related PR/Issues: * #48 --------- Co-authored-by: Umit Cavus Buyuksahin <ucbuyuksahin@gmail.com>
1 parent d04723e commit bc4b51f

28 files changed

+1266
-772
lines changed

.github/PULL_REQUEST_TEMPLATE/pull_request_template.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
* [ ] Is the title of the Pull Request correct?
77
* [ ] Is the title of the corresponding issue correct?
88
* [ ] Have you updated the changelog?
9+
* [ ] Have you updated the templates?
910
* [ ] Have you checked to ensure there aren't other open Pull Requests for the same update/change?
1011
* [ ] Are you mentioning the issue which this PullRequest fixes ("Fixes...")
1112

13+
Note: If any of the above is not relevant to your PR just check the box.
14+
1215
## 🔐 Security
1316
## 🐞 Bug
1417
## ✨ Feature

.github/workflows/build-and-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
uses: actions/checkout@v3
1818

1919
- name: Setup Python & Poetry Environment
20-
uses: exasol/python-toolbox/.github/actions/python-environment@main
20+
uses: ./.github/actions/python-environment
2121

2222
- name: Build Artifacts
2323
run: poetry build

.github/workflows/check-release-tag.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
uses: actions/checkout@v3
1515

1616
- name: Setup Python & Poetry Environment
17-
uses: exasol/python-toolbox/.github/actions/python-environment@main
17+
uses: ./.github/actions/python-environment
1818

1919
- name: Check Tag Version
2020
# make sure the pushed/created tag matched the project version

.github/workflows/checks.yml

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,63 +19,69 @@ jobs:
1919
fetch-depth: 0
2020

2121
- name: Setup Python & Poetry Environment
22-
uses: exasol/python-toolbox/.github/actions/python-environment@main
22+
uses: ./.github/actions/python-environment
2323

2424
- name: Check Version(s)
2525
run: poetry run version-check `poetry run python -c "from noxconfig import PROJECT_CONFIG; print(PROJECT_CONFIG.version_file)"`
2626

2727
build-documentation-job:
2828
name: Build Documentation
29-
needs: [version-check-job]
29+
needs: [ version-check-job ]
3030
runs-on: ubuntu-latest
3131

3232
steps:
33-
- name: SCM Checkout
34-
uses: actions/checkout@v3
33+
- name: SCM Checkout
34+
uses: actions/checkout@v3
3535

36-
- name: Setup Python & Poetry Environment
37-
uses: exasol/python-toolbox/.github/actions/python-environment@main
36+
- name: Setup Python & Poetry Environment
37+
uses: ./.github/actions/python-environment
3838

39-
- name: Build Documentation
40-
run: |
41-
poetry run python -m nox -s build-docs
39+
- name: Build Documentation
40+
run: |
41+
poetry run python -m nox -s build-docs
4242
4343
lint-job:
4444
name: Linting (Python-${{ matrix.python-version }})
45-
needs: [version-check-job]
45+
needs: [ version-check-job ]
4646
runs-on: ubuntu-latest
4747
strategy:
4848
fail-fast: false
4949
matrix:
50-
python-version: ["3.8", "3.9", "3.10", "3.11"]
50+
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
5151

5252
steps:
5353
- name: SCM Checkout
5454
uses: actions/checkout@v3
5555

5656
- name: Setup Python & Poetry Environment
57-
uses: exasol/python-toolbox/.github/actions/python-environment@main
57+
uses: ./.github/actions/python-environment
5858
with:
5959
python-version: ${{ matrix.python-version }}
6060

6161
- name: Run Tests
6262
run: poetry run nox -s lint
6363

64+
- name: Upload Artifacts
65+
uses: actions/upload-artifact@v3
66+
with:
67+
name: .lint.txt
68+
path: .lint.txt
69+
6470
type-check-job:
6571
name: Type Checking (Python-${{ matrix.python-version }})
66-
needs: [version-check-job]
72+
needs: [ version-check-job ]
6773
runs-on: ubuntu-latest
6874
strategy:
6975
fail-fast: false
7076
matrix:
71-
python-version: ["3.8", "3.9", "3.10", "3.11"]
77+
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
7278

7379
steps:
7480
- name: SCM Checkout
7581
uses: actions/checkout@v3
7682

7783
- name: Setup Python & Poetry Environment
78-
uses: exasol/python-toolbox/.github/actions/python-environment@main
84+
uses: ./.github/actions/python-environment
7985
with:
8086
python-version: ${{ matrix.python-version }}
8187

@@ -84,24 +90,30 @@ jobs:
8490

8591
tests-job:
8692
name: Tests (Python-${{ matrix.python-version }}, Exasol-${{ matrix.exasol-version}})
87-
needs: [build-documentation-job, lint-job, type-check-job]
93+
needs: [ build-documentation-job, lint-job, type-check-job ]
8894
runs-on: ubuntu-latest
8995
env:
9096
GITHUB_TOKEN: ${{ secrets.ALTERNATIVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
9197
strategy:
9298
fail-fast: false
9399
matrix:
94-
python-version: ["3.8", "3.9", "3.10", "3.11"]
95-
exasol-version: ["7.1.9"]
100+
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
101+
exasol-version: [ "7.1.9" ]
96102

97103
steps:
98104
- name: SCM Checkout
99105
uses: actions/checkout@v3
100106

101107
- name: Setup Python & Poetry Environment
102-
uses: exasol/python-toolbox/.github/actions/python-environment@main
108+
uses: ./.github/actions/python-environment
103109
with:
104110
python-version: ${{ matrix.python-version }}
105111

106112
- name: Run Tests
107113
run: poetry run nox -s coverage -- -- --db-version ${{ matrix.exasol-version }}
114+
115+
- name: Upload Artifacts
116+
uses: actions/upload-artifact@v3
117+
with:
118+
name: .coverage
119+
path: .coverage

.github/workflows/ci-cd.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@ jobs:
99

1010
check-tag-version-job:
1111
name: Check Release Tag
12-
uses: exasol/python-toolbox/.github/workflows/check-release-tag.yml@main
12+
uses: ./.github/workflows/check-release-tag.yml
1313

1414
ci-job:
1515
name: Checks
1616
needs: [ check-tag-version-job ]
17-
uses: exasol/python-toolbox/.github/workflows/checks.yml@main
17+
uses: ./.github/workflows/checks.yml
1818

1919
cd-job:
2020
name: Continues Delivery
2121
needs: [ ci-job ]
22-
uses: exasol/python-toolbox/.github/workflows/build-and-publish.yml@main
22+
uses: ./.github/workflows/build-and-publish.yml
2323
secrets:
2424
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
2525

26+
metrics:
27+
needs: [ ci-job ]
28+
uses: ./.github/workflows/report.yml

.github/workflows/ci.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ on:
88
- "main"
99
- "master"
1010
pull_request:
11-
types: [opened, reopened]
11+
types: [ opened, reopened ]
1212
schedule:
1313
# “At 00:00 on every 7th day-of-month from 1 through 31.” (https://crontab.guru)
1414
- cron: "0 0 1/7 * *"
1515

1616
jobs:
17-
1817
ci-job:
19-
name: Checks
20-
uses: exasol/python-toolbox/.github/workflows/checks.yml@main
18+
uses: ./.github/workflows/checks.yml
19+
20+
metrics:
21+
needs: [ ci-job ]
22+
uses: ./.github/workflows/report.yml

.github/workflows/gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
uses: actions/checkout@v3
1313

1414
- name: Setup Python & Poetry Environment
15-
uses: exasol/python-toolbox/.github/actions/python-environment@main
15+
uses: ./.github/actions/python-environment
1616

1717
- name: Build Documentation
1818
run: |

.github/workflows/pr-merge.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ jobs:
1010

1111
ci-job:
1212
name: Checks
13-
uses: exasol/python-toolbox/.github/workflows/checks.yml@main
13+
uses: ./.github/workflows/checks.yml
1414

1515
publish-docs:
1616
name: Publish Documentation
17-
uses: exasol/python-toolbox/.github/workflows/gh-pages.yml@main
17+
uses: ./.github/workflows/gh-pages.yml
18+
19+
metrics:
20+
needs: [ ci-job ]
21+
uses: ./.github/workflows/report.yml

.github/workflows/report.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Status Report
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
ALTERNATIVE_GITHUB_TOKEN:
7+
required: false
8+
9+
jobs:
10+
11+
report:
12+
name: Generate Status Report
13+
runs-on: ubuntu-latest
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.ALTERNATIVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
16+
17+
steps:
18+
- name: SCM Checkout
19+
uses: actions/checkout@v3
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Setup Python & Poetry Environment
24+
uses: ./.github/actions/python-environment
25+
26+
- name: Download Artifacts
27+
uses: actions/download-artifact@v3
28+
with:
29+
path: ./artifacts
30+
31+
- name: Copy Artifacts into Root Folder
32+
working-directory: ./artifacts
33+
run: |
34+
cp .coverage/.coverage ../
35+
cp .lint.txt/.lint.txt ../
36+
37+
- name: Generate Report
38+
run: poetry run nox -s report -- -- --format json | tee metrics.json
39+
40+
- name: Upload Artifacts
41+
uses: actions/upload-artifact@v3
42+
with:
43+
name: metrics.json
44+
path: metrics.json
45+
46+
- name: Generate GitHub Summary
47+
run: |
48+
echo -e "# Summary\n" >> $GITHUB_STEP_SUMMARY
49+
poetry run nox -s report -- -- --format markdown >> $GITHUB_STEP_SUMMARY
50+
echo -e "\n\n# Coverage\n" >> $GITHUB_STEP_SUMMARY
51+
poetry run coverage report -- --format markdown >> $GITHUB_STEP_SUMMARY
52+
echo -e "\n\n# Static Code Analysis\n" >> $GITHUB_STEP_SUMMARY
53+
cat .lint.txt >> $GITHUB_STEP_SUMMARY

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.lint.json
2+
.lint.txt
3+
14
odbcconfig/odbcinst.ini
25

36
.html-documentation

0 commit comments

Comments
 (0)