-
Notifications
You must be signed in to change notification settings - Fork 254
chore: update cicd workflows #160
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
e78d6ab
chore: upgrade black and ruff
marcellodebernardi 64cd634
feat: add gitleaks to pre-commit
marcellodebernardi 85312de
chore: upgrade black and ruff in pyproject.toml
marcellodebernardi ca0e447
feat: enforce version bump
marcellodebernardi db0f32b
feat: branch and pr naming checks
marcellodebernardi 4b1e5b1
feat: check for release version mismatch
marcellodebernardi da8aab1
feat: ruff require docstrings
marcellodebernardi 6267511
feat: automatic code index generation
marcellodebernardi a532689
feat: code indices for plexe/ and tests/
marcellodebernardi e78b12e
feat: include permissions in cicd workflow
marcellodebernardi 8e8ef06
fix: version check should ignore code index
marcellodebernardi 2e93248
fix: error handling in version check
marcellodebernardi 38883d0
fix: disable D102 and D103 for now
marcellodebernardi c847019
fix: disable local version bump check
marcellodebernardi 51d3487
chore: clearer comments
marcellodebernardi 343216b
fix: only run linting on changed files
marcellodebernardi b2ff0ca
Potential fix for code scanning alert no. 7: Workflow does not contai…
marcellodebernardi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| name: Plexe Version Check | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| check-version-bump: | ||
| name: Verify Version Bump | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Fetch main branch | ||
| run: git fetch origin main:main | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Install packaging module | ||
| run: pip install packaging | ||
|
|
||
| - name: Check for changes in plexe/ | ||
| id: check-changes | ||
| run: | | ||
| if git diff --name-only origin/main...HEAD | grep '^plexe/' | grep -vq 'CODE_INDEX.md$'; then | ||
| echo "has_changes=true" >> $GITHUB_OUTPUT | ||
| echo "✅ Changes detected in plexe/ (excluding auto-generated files)" | ||
| else | ||
| echo "has_changes=false" >> $GITHUB_OUTPUT | ||
| echo "ℹ️ No relevant changes detected in plexe/" | ||
| fi | ||
|
|
||
| - name: Verify version bump | ||
| if: steps.check-changes.outputs.has_changes == 'true' | ||
| run: | | ||
| # Extract version from current branch | ||
| CURRENT_VERSION=$(python3 -c " | ||
| import tomllib | ||
| import sys | ||
| with open('pyproject.toml', 'rb') as f: | ||
| data = tomllib.load(f) | ||
| # Try old Poetry format first, then new PEP 621 format | ||
| if 'tool' in data and 'poetry' in data['tool'] and 'version' in data['tool']['poetry']: | ||
| print(data['tool']['poetry']['version']) | ||
| elif 'project' in data and 'version' in data['project']: | ||
| print(data['project']['version']) | ||
| else: | ||
| print('❌ Error: Could not find version in pyproject.toml', file=sys.stderr) | ||
| print('Expected tool.poetry.version or project.version', file=sys.stderr) | ||
| sys.exit(1) | ||
| ") | ||
marcellodebernardi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Extract version from main branch | ||
| MAIN_VERSION=$(git show origin/main:pyproject.toml | python3 -c " | ||
| import tomllib | ||
| import sys | ||
| data = tomllib.loads(sys.stdin.read()) | ||
| # Try old Poetry format first, then new PEP 621 format | ||
| if 'tool' in data and 'poetry' in data['tool'] and 'version' in data['tool']['poetry']: | ||
| print(data['tool']['poetry']['version']) | ||
| elif 'project' in data and 'version' in data['project']: | ||
| print(data['project']['version']) | ||
| else: | ||
| print('❌ Error: Could not find version in origin/main pyproject.toml', file=sys.stderr) | ||
| print('Expected tool.poetry.version or project.version', file=sys.stderr) | ||
| sys.exit(1) | ||
| ") | ||
|
|
||
| echo "Current branch version: $CURRENT_VERSION" | ||
| echo "Main branch version: $MAIN_VERSION" | ||
|
|
||
| # Parse versions and compare | ||
| python3 << EOF | ||
| from packaging import version | ||
|
|
||
| current = version.parse("$CURRENT_VERSION") | ||
| main = version.parse("$MAIN_VERSION") | ||
|
|
||
| if current <= main: | ||
| print(f"❌ ERROR: Version must be incremented!") | ||
| print(f" Current: {current}") | ||
| print(f" Main: {main}") | ||
| print(f"") | ||
| print(f"Please bump the version in pyproject.toml") | ||
| exit(1) | ||
| else: | ||
| print(f"✅ Version properly incremented from {main} to {current}") | ||
| exit(0) | ||
| EOF | ||
|
|
||
| - name: Version check passed | ||
| if: steps.check-changes.outputs.has_changes == 'false' | ||
| run: | | ||
| echo "✅ No changes detected in plexe/, version check skipped" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,25 @@ | ||
| repos: | ||
| - repo: https://github.com/psf/black | ||
| rev: 24.10.0 | ||
| rev: 25.12.0 | ||
| hooks: | ||
| - id: black | ||
| types: [python] | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.9.1 | ||
| rev: v0.14.9 | ||
| hooks: | ||
| - id: ruff | ||
| args: [--fix] | ||
| types: [python] | ||
| - repo: https://github.com/gitleaks/gitleaks | ||
| rev: v8.30.0 | ||
| hooks: | ||
| - id: gitleaks | ||
| - repo: local | ||
| hooks: | ||
| - id: generate-code-index | ||
| name: Generate code index | ||
| entry: bash -c 'python3 scripts/generate_code_index.py --include-tests && git add plexe/CODE_INDEX.md tests/CODE_INDEX.md' | ||
marcellodebernardi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| language: system | ||
| pass_filenames: false | ||
| files: ^(plexe|tests)/.*\.py$ | ||
| stages: [pre-commit] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.