Skip to content

Commit 324e1b7

Browse files
committed
Migrate to use repo-config
Now this project uses repo-config: https://github.com/frequenz-floss/frequenz-repo-config-python The files were updated by generating the project using the cookiecutter template. Some dependencies needed to be upgraded as part of the process. Now all dependencies are pinned and kept at the pyproject.toml file. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 19487b8 commit 324e1b7

File tree

18 files changed

+261
-272
lines changed

18 files changed

+261
-272
lines changed

.cookiecutter-replay.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"cookiecutter": {
3+
"type": "lib",
4+
"name": "channels",
5+
"description": "Channel implementations for Python",
6+
"title": "Frequenz channels",
7+
"keywords": "channel",
8+
"github_org": "frequenz-floss",
9+
"license": "MIT",
10+
"author_name": "Frequenz Energy-as-a-Service GmbH",
11+
"author_email": "[email protected]",
12+
"python_package": "frequenz.channels",
13+
"pypi_package_name": "frequenz-channels",
14+
"github_repo_name": "frequenz-channels-python",
15+
"default_codeowners": "@frequenz-floss/python-sdk-team",
16+
"_extensions": [
17+
"jinja2_time.TimeExtension",
18+
"local_extensions.default_codeowners",
19+
"local_extensions.github_repo_name",
20+
"local_extensions.keywords",
21+
"local_extensions.pypi_package_name",
22+
"local_extensions.python_package",
23+
"local_extensions.src_path",
24+
"local_extensions.title"
25+
],
26+
"_template": "gh:frequenz-floss/frequenz-repo-config-python"
27+
}
28+
}

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ name: Report something is not working properly 🐛
55
description:
66
Use this if there is something that is not working properly. If you are not
77
sure or you need help making something work, please ask a question instead.
8-
labels: priority:❓, type:bug
8+
labels:
9+
- "priority:❓"
10+
- "type:bug"
911
body:
1012
- type: markdown
1113
attributes:
@@ -59,6 +61,6 @@ body:
5961
label: Extra information
6062
description:
6163
Please write here any extra information you think it might be relevant,
62-
e.g., if this didn't happened before, or if you suspect where the
63-
problem might be.
64+
e.g., if this didn't happen before, or if you suspect where the problem
65+
might be.
6466
placeholder: Any extra information you think it might be relevant.

.github/ISSUE_TEMPLATE/feature.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33

44
name: Request a feature or enhancement ✨
55
description: Use this if something is missing or could be done better or more easily.
6-
labels: part:❓, priority:❓, type:enhancement
6+
labels:
7+
- "part:❓"
8+
- "priority:❓"
9+
- "type:enhancement"
710
body:
811
- type: markdown
912
attributes:

.github/RELEASE_NOTES.template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Frequenz Channels Release Notes
1+
# Frequenz channels Release Notes
22

33
## Summary
44

55
<!-- Here goes a general summary of what this release is about -->
66

77
## Upgrading
88

9-
<!-- Here goes notes on how to upgrade from previous versions, including if there are any deprecations and what they should be replaced with -->
9+
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
1010

1111
## New Features
1212

.github/labeler.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"part:docs":
1010
- "**/*.md"
1111
- "docs/**"
12+
- "examples/**"
1213
- LICENSE
1314

1415
"part:tests":
@@ -18,14 +19,13 @@
1819
- "**/*.ini"
1920
- "**/*.toml"
2021
- "**/*.yaml"
21-
- "*requirements*.txt"
22+
- "**/*.yml"
2223
- ".git*"
2324
- ".git*/**"
25+
- docs/*.py
2426
- CODEOWNERS
2527
- MANIFEST.in
26-
- docs/mkdocstrings_autoapi.py
2728
- noxfile.py
28-
- setup.py
2929

3030
"part:channels":
3131
- any:

.github/workflows/ci.yaml

Lines changed: 54 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
name: frequenz-channels-python
1+
name: CI
22

33
on:
44
merge_group:
55
pull_request:
66
push:
7+
# We need to explicitly include tags because otherwise when adding
8+
# `branches-ignore` it will only trigger on branches.
79
tags:
810
- '*'
911
branches-ignore:
@@ -14,44 +16,47 @@ on:
1416
workflow_dispatch:
1517

1618
env:
17-
DEFAULT_PYTHON_VERSION: "3.11"
19+
# Please make sure this version is included in the `matrix`, as the
20+
# `matrix` section can't use `env`, so it must be entered manually
21+
DEFAULT_PYTHON_VERSION: '3.11'
22+
# It would be nice to be able to also define a DEFAULT_UBUNTU_VERSION
23+
# but sadly `env` can't be used either in `runs-on`.
1824

1925
jobs:
20-
test:
26+
nox:
27+
name: Test with nox
2128
strategy:
29+
fail-fast: false
2230
matrix:
2331
os:
2432
- ubuntu-20.04
25-
python-version:
33+
python:
2634
- "3.11"
2735
runs-on: ${{ matrix.os }}
2836

2937
steps:
30-
- name: Fetch sources
31-
uses: actions/checkout@v3
32-
33-
- name: Set up Python
34-
uses: actions/setup-python@v4
35-
with:
36-
python-version: ${{ matrix.python-version }}
37-
38-
- uses: actions/cache@v3
39-
with:
40-
path: ~/.cache/pip
41-
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('pyproject.toml') }}
42-
restore-keys: |
43-
${{ runner.os }}-${{ matrix.python-version }}-pip-
44-
45-
- name: Install required Python packages
46-
run: |
47-
python -m pip install --upgrade pip
48-
python -m pip install nox
49-
50-
- name: run nox
51-
run: nox
52-
timeout-minutes: 10
53-
54-
build-dist:
38+
- name: Fetch sources
39+
uses: actions/checkout@v3
40+
41+
- name: Set up Python
42+
uses: actions/setup-python@v4
43+
with:
44+
python-version: ${{ matrix.python }}
45+
cache: 'pip'
46+
47+
- name: Install required Python packages
48+
run: |
49+
python -m pip install --upgrade pip
50+
python -m pip install -e .[dev-noxfile]
51+
52+
- name: Run nox
53+
# To speed things up a bit we use the speciall ci_checks_max session
54+
# that uses the same venv to run multiple linting sessions
55+
run: nox -e ci_checks_max pytest_min
56+
timeout-minutes: 10
57+
58+
build:
59+
name: Build distribution packages
5560
runs-on: ubuntu-20.04
5661
steps:
5762
- name: Fetch sources
@@ -61,23 +66,25 @@ jobs:
6166
uses: actions/setup-python@v4
6267
with:
6368
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
69+
cache: 'pip'
6470

65-
- name: Install build dependencies
71+
- name: Install required Python packages
6672
run: |
6773
python -m pip install -U pip
6874
python -m pip install -U build
6975
7076
- name: Build the source and binary distribution
7177
run: python -m build
7278

73-
- name: Upload dist files
79+
- name: Upload distribution files
7480
uses: actions/upload-artifact@v3
7581
with:
76-
name: frequenz-channels-python-dist
82+
name: dist-packages
7783
path: dist/
7884
if-no-files-found: error
7985

80-
test-generate-docs:
86+
test-docs:
87+
name: Test documentation website generation
8188
if: github.event_name != 'push'
8289
runs-on: ubuntu-20.04
8390
steps:
@@ -91,11 +98,12 @@ jobs:
9198
uses: actions/setup-python@v4
9299
with:
93100
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
101+
cache: 'pip'
94102

95103
- name: Install build dependencies
96104
run: |
97105
python -m pip install -U pip
98-
python -m pip install .[docs]
106+
python -m pip install .[dev-mkdocs]
99107
100108
- name: Generate the documentation
101109
env:
@@ -107,12 +115,13 @@ jobs:
107115
- name: Upload site
108116
uses: actions/upload-artifact@v3
109117
with:
110-
name: frequenz-channels-python-site
118+
name: docs-site
111119
path: site/
112120
if-no-files-found: error
113121

114122
publish-docs:
115-
needs: ["test", "build-dist"]
123+
name: Publish documentation website to GitHub pages
124+
needs: ["nox", "build"]
116125
if: github.event_name == 'push'
117126
runs-on: ubuntu-20.04
118127
permissions:
@@ -168,12 +177,13 @@ jobs:
168177
uses: actions/setup-python@v4
169178
with:
170179
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
180+
cache: 'pip'
171181

172182
- name: Install build dependencies
173183
if: steps.mike-metadata.outputs.version
174184
run: |
175185
python -m pip install -U pip
176-
python -m pip install .[docs]
186+
python -m pip install .[dev-mkdocs]
177187
178188
- name: Fetch the gh-pages branch
179189
if: steps.mike-metadata.outputs.version
@@ -188,20 +198,21 @@ jobs:
188198
mike deploy --push --update-aliases "$VERSION" $ALIASES
189199
190200
create-github-release:
201+
name: Create GitHub release
191202
needs: ["publish-docs"]
192203
# Create a release only on tags creation
193-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
204+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
194205
permissions:
195206
# We need write permissions on contents to create GitHub releases and on
196207
# discussions to create the release announcement in the discussion forums
197208
contents: write
198209
discussions: write
199210
runs-on: ubuntu-20.04
200211
steps:
201-
- name: Download dist files
212+
- name: Download distribution files
202213
uses: actions/download-artifact@v3
203214
with:
204-
name: frequenz-channels-python-dist
215+
name: dist-packages
205216
path: dist
206217

207218
- name: Download RELEASE_NOTES.md
@@ -225,7 +236,6 @@ jobs:
225236
if echo "$REF_NAME" | grep -- -; then extra_opts=" --prerelease"; fi
226237
gh release create \
227238
-R "$REPOSITORY" \
228-
--discussion-category announcements \
229239
--notes-file RELEASE_NOTES.md \
230240
--generate-notes \
231241
$extra_opts \
@@ -237,17 +247,18 @@ jobs:
237247
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
238248

239249
publish-to-pypi:
250+
name: Publish packages to PyPI
240251
needs: ["create-github-release"]
241252
runs-on: ubuntu-20.04
242253
permissions:
243254
# For trusted publishing. See:
244255
# https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/
245256
id-token: write
246257
steps:
247-
- name: Download dist files
258+
- name: Download distribution files
248259
uses: actions/download-artifact@v3
249260
with:
250-
name: frequenz-channels-python-dist
261+
name: dist-packages
251262
path: dist
252263

253264
- name: Publish the Python distribution to PyPI

.github/workflows/labeler.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
name: Pull Request Labeler
22

3-
# XXX: !!! SECURITY WARNING !!!
4-
# pull_request_target has write access to the repo, and can read secrets. We
5-
# need to audit any external actions executed in this workflow and make sure no
6-
# checked out code is run (not even installing dependencies, as installing
7-
# dependencies usually can execute pre/post-install scripts). We should also
8-
# only use hashes to pick the action to execute (instead of tags or branches).
9-
# For more details read:
10-
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
113
on: [pull_request_target]
124

135
jobs:
@@ -18,7 +10,14 @@ jobs:
1810
runs-on: ubuntu-latest
1911
steps:
2012
- name: Labeler
21-
# Only use hashes, see the security comment above
13+
# XXX: !!! SECURITY WARNING !!!
14+
# pull_request_target has write access to the repo, and can read secrets. We
15+
# need to audit any external actions executed in this workflow and make sure no
16+
# checked out code is run (not even installing dependencies, as installing
17+
# dependencies usually can execute pre/post-install scripts). We should also
18+
# only use hashes to pick the action to execute (instead of tags or branches).
19+
# For more details read:
20+
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
2221
uses: actions/labeler@0967ca812e7fdc8f5f71402a1b486d5bd061fe20 # 4.2.0
2322
with:
2423
repo-token: "${{ secrets.GITHUB_TOKEN }}"

0 commit comments

Comments
 (0)