Skip to content
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

ci: add script to generate hatch matrix #50

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/generate-hatch-matrix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set -u
outfile=$1
hatch env show --json | jq 'to_entries | map(select(.key | startswith("test")))' | jq '{include: map({"hatch-env-name": .key, "python-version": .value.python})}' > $outfile

git diff --exit-code $outfile
if [ $? -ne 0 ]; then
echo "Hatch environment matrix has changed. Please commit ${outfile}."
exit 1
fi
18 changes: 17 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ repos:
- id: conventional-pre-commit
stages: [commit-msg]

- repo: local
hooks:
- id: generate-hatch-matrix
name: generate-hatch-matrix
language: system
entry: bash .github/workflows/generate-hatch-matrix.sh
files: |
(?x)^(
.github/workflows/generate-hatch-matrix.sh|
.github/workflows/hatch-matrix.json
)$
args: [".github/workflows/hatch-matrix.json"]
pass_filenames: false
types: [file]

ci:
# autofix_commit_msg: |
# [pre-commit.ci] auto fixes from pre-commit.com hooks
Expand All @@ -42,5 +57,6 @@ ci:
# autoupdate_branch: ''
# autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: monthly
# skip: []
skip:
- generate-hatch-matrix
# submodules: false
Loading