Skip to content
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
23 changes: 23 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"rules": {
"header-min-length": [2, "always", 12],
"header-max-length": [2, "always", 72],
"footer-max-line-length": [2, "always", 72],
"type-empty": [2, "never"],
"type-enum": [2, "always", [
"feat",
"fix",
"docs",
"style",
"refactor",
"perf",
"test",
"build",
"ci",
"chore",
"revert"
]],
"body-max-line-length": [2, "always", 72],
"scope-case": [2, "always", "lower-case"]
}
}
40 changes: 39 additions & 1 deletion .github/workflows/tidy3d-python-client-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,41 @@ jobs:
run: ruff format --check --diff
- name: Run ruff check
run: ruff check tidy3d

lint-commit-messages:
needs: determine-test-scope
runs-on: ubuntu-latest
name: veryify-commit-linting
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all commits in the PR

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Install commitlint
run: npm install -D @commitlint/cli @commitlint/config-conventional

- name: Print versions
run: |
git --version
node --version
npm --version
npx commitlint --version

- name: Check commit messages (merge_group)
if: github.event_name == 'merge_group'
run: |
# For merge groups, check the commits being merged
npx commitlint --from ${{ github.event.merge_group.base_sha }} --to ${{ github.event.merge_group.head_sha }} --verbose || {
echo "Commit message linting failed; please follow the conventional commits format at https://www.conventionalcommits.org/"
exit 1
}


verify-schema-change:
name: verify-schema-change
Expand Down Expand Up @@ -480,7 +515,7 @@ jobs:
(( needs.determine-test-scope.outputs.pr_approval_state == 'true' ) &&
( needs.determine-test-scope.outputs.local_tests == 'true' ) ||
( needs.determine-test-scope.outputs.remote_tests == 'true' ))
needs: [local-tests, remote-tests, lint, verify-schema-change]
needs: [local-tests, remote-tests, lint, verify-schema-change, lint-commit-messages]
runs-on: ubuntu-latest
steps:
- name: check-passing-remote-tests
Expand All @@ -502,5 +537,8 @@ jobs:
elif [[ "${{ needs.determine-test-scope.outputs.pr_approval_state }}" == 'true' && github.event.pull_request ]]; then
echo "❌ PR requires approval."
exit 1
elif [[ github.event_name == 'merge_group' && "${{ needs.lint-commit-messages.result }}" != 'success' ]]; then
echo "❌ Linting of commit messages failed or was skipped."
exit 1
fi
echo "✅ All required test jobs passed!"
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
default_install_hook_types:
- pre-commit
- commit-msg
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.11.11"
hooks:
- id: ruff-check
args: [ --fix ]
- id: ruff-format
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.22.0
hooks:
- id: commitlint
stages: [commit-msg]
verbose: true
entry: bash -c 'commitlint --edit || exit 0'