-
Notifications
You must be signed in to change notification settings - Fork 46
Restructure repository for release automation and remove generated artifacts from git #51
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
5 commits
Select commit
Hold shift + click to select a range
5cd7f60
Removed generated rule files from git and move the source rules into …
thomas-bartlett 0e9460e
Improve build automation with better validation
thomas-bartlett d4a362e
Merge branch 'main' into feature/restructure-and-release-automation
thomas-bartlett 51894e4
Add read permissions for contents in validate-rules workflow
thomas-bartlett 032a647
Update error message.
thomas-bartlett 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
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 was deleted.
Oops, something went wrong.
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,71 @@ | ||
| --- | ||
| name: Build and Release IDE Bundles | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| jobs: | ||
| build-and-release: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event.release.tag_name }} | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v4 | ||
| with: | ||
| enable-cache: true | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Install dependencies | ||
| run: uv sync | ||
|
|
||
| - name: Get version from release | ||
| id: get_version | ||
| run: | | ||
| TAG="${{ github.event.release.tag_name }}" | ||
| VERSION=${TAG#v} | ||
| echo "tag=$TAG" >> $GITHUB_OUTPUT | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
| echo "Release version: $VERSION (tag: $TAG)" | ||
|
|
||
| - name: Validate rules | ||
| run: uv run python src/validate_unified_rules.py sources/ | ||
|
|
||
| - name: Validate versions match tag | ||
| run: uv run python src/validate_versions.py ${{ steps.get_version.outputs.version }} | ||
|
|
||
| - name: Generate IDE bundles | ||
| run: uv run python src/convert_to_ide_formats.py | ||
|
|
||
| - name: Create release archives | ||
| run: | | ||
| cd dist | ||
| zip -r ../ide-rules-cursor.zip .cursor/ | ||
| zip -r ../ide-rules-windsurf.zip .windsurf/ | ||
| zip -r ../ide-rules-copilot.zip .github/ | ||
| cd .. | ||
| zip -r ide-rules-all.zip dist/ | ||
| ls -lh ide-rules-*.zip | ||
|
|
||
| - name: Upload release assets | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| gh release upload "${{ steps.get_version.outputs.tag }}" \ | ||
| ide-rules-all.zip \ | ||
| ide-rules-cursor.zip \ | ||
| ide-rules-windsurf.zip \ | ||
| ide-rules-copilot.zip \ | ||
| --clobber | ||
|
|
This file was deleted.
Oops, something went wrong.
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,128 @@ | ||
| --- | ||
| name: Validate Rules | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'sources/**' | ||
| - 'src/**' | ||
| - 'pyproject.toml' | ||
| push: | ||
| branches: | ||
| - main | ||
| - develop | ||
| paths: | ||
| - 'sources/**' | ||
| - 'src/**' | ||
| - 'pyproject.toml' | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| validate: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v4 | ||
| with: | ||
| enable-cache: true | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Install dependencies | ||
| run: uv sync | ||
|
|
||
| - name: Validate unified rules | ||
| run: uv run python src/validate_unified_rules.py sources/ | ||
|
|
||
| - name: Check required core rule files exist | ||
| run: | | ||
| echo "Checking for required core rule files..." | ||
| required_files=( | ||
| "sources/core/codeguard-1-hardcoded-credentials.md" | ||
| "sources/core/codeguard-1-crypto-algorithms.md" | ||
| "sources/core/codeguard-1-digital-certificates.md" | ||
| "sources/core/codeguard-1-safe-c-functions.md" | ||
| "sources/core/codeguard-SKILLS.md.template" | ||
| ) | ||
|
|
||
| missing=0 | ||
| for file in "${required_files[@]}"; do | ||
| if [ ! -f "$file" ]; then | ||
| echo "❌ Missing required file: $file" | ||
| missing=1 | ||
| else | ||
| echo "✅ Found: $file" | ||
| fi | ||
| done | ||
|
|
||
| if [ $missing -eq 1 ]; then | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Test conversion to IDE formats | ||
| run: | | ||
| echo "Testing IDE format conversion..." | ||
| uv run python src/convert_to_ide_formats.py --output-dir test-output | ||
|
|
||
| # Check that files were generated | ||
| if [ ! -d "test-output/.cursor" ]; then | ||
| echo "❌ Cursor rules not generated" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -d "test-output/.windsurf" ]; then | ||
| echo "❌ Windsurf rules not generated" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -d "test-output/.github" ]; then | ||
| echo "❌ Copilot instructions not generated" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "✅ All IDE formats generated successfully" | ||
|
|
||
| - name: Check skills/ directory is up-to-date | ||
| run: | | ||
| echo "Checking if committed skills/ directory is up-to-date..." | ||
|
|
||
| # Save current skills | ||
| mv skills skills-committed | ||
|
|
||
| # Regenerate skills (core rules only, matching default) | ||
| uv run python src/convert_to_ide_formats.py | ||
|
|
||
| # Compare | ||
| if ! diff -r skills/ skills-committed/ > /dev/null 2>&1; then | ||
| echo "❌ The skills/ directory is out of date!" | ||
| echo "Please regenerate by running: python src/convert_to_ide_formats.py" | ||
| echo "Then: git add skills/" | ||
| mv skills-committed skills | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Restore original | ||
| rm -rf skills | ||
| mv skills-committed skills | ||
| echo "✅ Committed skills/ directory is up-to-date" | ||
|
|
||
| - name: Summary | ||
| if: success() | ||
| run: | | ||
| echo "✅ All validation checks passed!" | ||
| echo "" | ||
| echo "Rule validation: ✅" | ||
| echo "Required files: ✅" | ||
| echo "IDE conversion: ✅" | ||
| echo "Skills directory: ✅" | ||
|
|
||
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
Oops, something went wrong.
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.