Skip to content

Commit f49953e

Browse files
Chore: Update DevOps tooling from central repository [skip ci]
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent a879553 commit f49953e

File tree

5 files changed

+111
-66
lines changed

5 files changed

+111
-66
lines changed

.flake8

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[flake8]
22
max-line-length = 160
3+
extend-ignore = E203, E501

.github/workflows/notebooks.yaml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
# Run all notebooks on every push
3+
name: "🗒️ Build notebooks"
4+
5+
# yamllint disable-line rule:truthy
6+
on:
7+
workflow_dispatch:
8+
pull_request:
9+
types: [opened, reopened, edited, synchronize]
10+
11+
jobs:
12+
13+
parse-project-metadata:
14+
name: "Determine Python versions"
15+
# yamllint disable-line rule:line-length
16+
uses: os-climate/devops-reusable-workflows/.github/workflows/pyproject-toml-fetch-matrix.yaml@main
17+
18+
notebook-build:
19+
name: "Build and test Notebooks"
20+
needs: [parse-project-metadata]
21+
runs-on: ubuntu-latest
22+
continue-on-error: true
23+
# Don't run when pull request is merged
24+
if: github.event.pull_request.merged == false
25+
26+
strategy:
27+
fail-fast: false
28+
matrix: ${{ fromJson(needs.parse-project-metadata.outputs.matrix) }}
29+
steps:
30+
- name: "Checkout repository"
31+
uses: actions/checkout@v4
32+
33+
- name: "Set up Python ${{ matrix.python-version }}"
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
38+
- name: "Setup PDM for build commands"
39+
uses: pdm-project/setup-pdm@v4
40+
with:
41+
python-version: ${{ matrix.python-version }}
42+
43+
- name: "Install dependencies"
44+
run: |
45+
which python; which python3
46+
python --version; python3 --version
47+
python -m pip install --upgrade pip
48+
pdm export -o requirements.txt
49+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
50+
pip install .
51+
pip install pytest nbmake
52+
53+
- name: "Test notebooks: pytest --nbmake"
54+
run: pytest --nbmake -- **/*ipynb
55+
56+
- name: Upload logs as artefacts
57+
if: always()
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: debug-logs
61+
path: /tmp/*.log
62+
retention-days: 14

.github/workflows/release.yaml

+2-16
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
### SIGNING ###
5656

5757
- name: "Sign packages with Sigstore"
58-
uses: sigstore/[email protected].0
58+
uses: sigstore/[email protected].1
5959
with:
6060
inputs: >-
6161
./dist/*.tar.gz
@@ -86,26 +86,12 @@ jobs:
8686
name: ${{ github.ref_name }}
8787
path: dist/
8888

89-
- name: "📦 Publish release to GitHub"
90-
uses: ModeSevenIndustrialSolutions/action-automatic-releases@latest
91-
with:
92-
# Valid inputs are:
93-
# repo_token, automatic_release_tag, draft, prerelease, title, files
94-
repo_token: ${{ secrets.GITHUB_TOKEN }}
95-
prerelease: false
96-
automatic_release_tag: ${{ github.ref_name }}
97-
title: ${{ github.ref_name }}
98-
files: |
99-
dist/*.tar.gz
100-
dist/*.whl
101-
dist/*.sigstore
102-
10389
- name: "📦 Publish artefacts to GitHub"
10490
# https://github.com/softprops/action-gh-release
10591
uses: softprops/action-gh-release@v2
10692
with:
10793
token: ${{ secrets.GITHUB_TOKEN }}
108-
prerelease: true
94+
prerelease: false
10995
tag_name: ${{ github.ref_name }}
11096
name: "Test/Development Build \
11197
${{ github.ref_name }}"

.github/workflows/test-release.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ jobs:
6262
### SIGNING ###
6363

6464
- name: "Sign packages with Sigstore"
65-
uses: sigstore/[email protected]
65+
uses: sigstore/[email protected]
66+
6667
with:
6768
inputs: >-
6869
./dist/*.tar.gz

.pre-commit-config.yaml

+44-49
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ ci:
44
skip:
55
# pre-commit.ci cannot install WGET, so tomlint must be disabled
66
- tomllint
7-
# - pre-commit-update
87

98
exclude: |
109
(?x)^(
@@ -14,12 +13,6 @@ exclude: |
1413
1514
repos:
1615

17-
# - repo: https://gitlab.com/vojko.pribudic/pre-commit-update
18-
# rev: v0.1.0
19-
# hooks:
20-
# - id: pre-commit-update
21-
# args: [--dry-run]
22-
2316
- repo: local
2417
hooks:
2518
- id: tomllint
@@ -52,7 +45,6 @@ repos:
5245
args: ["--fix=lf"]
5346
- id: name-tests-test
5447
args: ["--pytest-test-first"]
55-
# Do not allow direct push to main/master branches
5648
- id: no-commit-to-branch
5749
# - id: pretty-format-json
5850
- id: requirements-txt-fixer
@@ -73,18 +65,17 @@ repos:
7365
- id: markdownlint
7466
args: ["--fix"]
7567

76-
# - repo: https://github.com/asottile/pyupgrade
77-
# rev: v3.15.0
78-
# hooks:
79-
# - id: pyupgrade
80-
# args: ['--py37-plus']
81-
8268
- repo: https://github.com/psf/black-pre-commit-mirror
8369
rev: 24.4.2
8470
hooks:
8571
- id: black
8672
- id: black-jupyter
8773

74+
# - repo: https://github.com/tomcatling/black-nb
75+
# rev: '0.7'
76+
# hooks:
77+
# - id: black-nb
78+
8879
- repo: https://github.com/jorisroovers/gitlint
8980
rev: v0.19.1
9081
hooks:
@@ -100,59 +91,34 @@ repos:
10091
rev: v0.10.0.1
10192
hooks:
10293
- id: shellcheck
103-
# Optionally only show errors and warnings
104-
# args: ["--severity=warning"]
10594

106-
# If you want to avoid flake8 errors due to unused vars or imports:
107-
# - repo: https://github.com/PyCQA/autoflake
108-
# rev: v2.0.0
109-
# hooks:
110-
# - id: autoflake
111-
# args: [
112-
# --in-place,
113-
# --remove-all-unused-imports,
114-
# --remove-unused-variables,
115-
# ]
95+
- repo: https://github.com/pycqa/pydocstyle.git
96+
rev: 6.3.0
97+
hooks:
98+
- id: pydocstyle
99+
additional_dependencies: ["tomli"]
116100

117101
- repo: https://github.com/PyCQA/isort
118102
rev: 5.13.2
119103
hooks:
120104
- id: isort
121105
args: ["--profile", "black"]
122106

123-
- repo: https://github.com/adrienverge/yamllint.git
124-
rev: v1.35.1
125-
hooks:
126-
- id: yamllint
127-
args: [
128-
"-d",
129-
"{rules: {line-length: {max: 120}},
130-
ignore-from-file: [.gitignore],
131-
}",
132-
]
133-
134107
- repo: https://github.com/Mateusz-Grzelinski/actionlint-py
135108
rev: v1.6.27.13
136109
hooks:
137110
- id: actionlint
138111

139-
# If like to embrace black styles even in the docs:
140-
# - repo: https://github.com/asottile/blacken-docs
141-
# rev: v1.13.0
142-
# hooks:
143-
# - id: blacken-docs
144-
# additional_dependencies: [black]
145-
146112
- repo: https://github.com/pycqa/flake8
147113
rev: "7.0.0"
148114
hooks:
149115
- id: flake8
150116

151-
# Check for misspells in documentation files:
152-
# - repo: https://github.com/codespell-project/codespell
153-
# rev: v2.2.2
154-
# hooks:
155-
# - id: codespell
117+
- repo: https://github.com/adrienverge/yamllint.git
118+
rev: v1.35.1
119+
hooks:
120+
- id: yamllint
121+
args: [ "-d", "{rules: {line-length: {max: 120}}, ignore-from-file: [.gitignore],}", ]
156122

157123
- repo: https://github.com/pre-commit/mirrors-mypy
158124
rev: "v1.10.0"
@@ -161,3 +127,32 @@ repos:
161127
verbose: true
162128
args: [--show-error-codes]
163129
additional_dependencies: ["pytest", "types-requests"]
130+
131+
- repo: https://github.com/astral-sh/ruff-pre-commit
132+
rev: v0.4.3
133+
hooks:
134+
- id: ruff
135+
files: ^(scripts|tests|custom_components)/.+\.py$
136+
args: [--fix, --exit-non-zero-on-fix]
137+
- id: ruff-format
138+
files: ^(scripts|tests|custom_components)/.+\.py$
139+
140+
# Check for misspellings in documentation files
141+
# - repo: https://github.com/codespell-project/codespell
142+
# rev: v2.2.2
143+
# hooks:
144+
# - id: codespell
145+
146+
# To embrace black styles, even in docs
147+
# - repo: https://github.com/asottile/blacken-docs
148+
# rev: v1.13.0
149+
# hooks:
150+
# - id: blacken-docs
151+
# additional_dependencies: [black]
152+
153+
# Automatically upgrade Python syntax for newer versions
154+
# - repo: https://github.com/asottile/pyupgrade
155+
# rev: v3.15.0
156+
# hooks:
157+
# - id: pyupgrade
158+
# args: ['--py37-plus']

0 commit comments

Comments
 (0)