-
Notifications
You must be signed in to change notification settings - Fork 39
Refactors thread generator into package, adds CI/CD, and web app #15
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
Draft
EckPhi
wants to merge
33
commits into
BalzGuenat:master
Choose a base branch
from
EckPhi:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
6771751
Expanded_main.py
cuban2 b6b4407
Add files via upload
cuban2 084d2ed
Delete Expanded_main.py
cuban2 2b28b2c
Delete expand_threads.py
cuban2 4bf1f9c
Add files via upload
cuban2 b0953da
Delete Expanded_3DPrintable_CutomeThreads.py
cuban2 0da4273
Add files via upload
cuban2 170f682
Adding threadform parameter
Autistaman cf67676
Updated readme to fix an error and add threadform
Autistaman 8ef3d50
Merge remote-tracking branch 'cuban2/master'
EckPhi 1a386d3
Merge remote-tracking branch 'Autistaman/threadform'
EckPhi f968616
Sets up project with Poetry and initial .gitignore
EckPhi 84597fb
Refactors thread generation into a Python package
EckPhi 7af498b
Adds automated test suite for thread generation
EckPhi d8be7ef
Documents CI/CD pipeline for automated releases
EckPhi f579106
Removes outdated XML output files from repository
EckPhi 4673511
Updates README and adds web generator placeholder
EckPhi 7bc5bce
Add GitHub Actions CI/CD workflows for XML and Pages
EckPhi 9c7dc11
Update .gitignore for workflow and poetry lock handling
EckPhi ca520c7
Remove legacy Fusion 360 thread XSD schema file
EckPhi 71fb416
Revise README for web generator and deployment details
EckPhi fc341ea
Add poetry.lock to enable consistent dependency installs
EckPhi c07811c
Rewrite web app for in-browser thread XML generation
EckPhi ef895f0
Add shareable URL feature to web app
EckPhi aa7c6a2
Add live app links to documentation and UI
EckPhi 5571ddb
Update workflow actions to latest major versions and set Node 24 env
EckPhi 3f4815e
Simplify XML release workflow with unified release asset upload
EckPhi 32a3b13
Switches workflow triggers from main to master branch
EckPhi 5ae4f3b
Adds source code link to project overview
EckPhi 780ed3c
Add utility for formatting numbers for display
EckPhi 23eb653
Update documentation for main→master branch and versioning
EckPhi 0316559
Refactor XML generation and validation in workflow and code
EckPhi e609e2e
Enhance UI feedback and output rendering for share action
EckPhi 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,206 @@ | ||
| # CI/CD Pipeline Documentation | ||
|
|
||
| This document explains the GitHub Actions workflow for automatically generating and releasing XML thread profiles. | ||
|
|
||
| ## Overview | ||
|
|
||
| The automated pipeline ensures that: | ||
| 1. ✅ XML files are **never committed** to the repository | ||
| 2. ✅ Every push to `master` triggers a new release | ||
| 3. ✅ Tests run before each release to ensure quality | ||
| 4. ✅ Releases are timestamped with UTC datetime | ||
| 5. ✅ Users always have access to the latest profiles | ||
|
|
||
| ## Workflow Details | ||
|
|
||
| **File:** `.github/workflows/generate-xml-release.yml` | ||
|
|
||
| ### Trigger Events | ||
|
|
||
| The workflow runs on: | ||
|
|
||
| ```yaml | ||
| on: | ||
| push: | ||
| branches: | ||
| - master # Automatic on every push to master | ||
| workflow_dispatch: # Manual trigger via GitHub UI | ||
| ``` | ||
|
|
||
| ### Pipeline Stages | ||
|
|
||
| #### 1. Setup (automatic) | ||
| - Checkout repository | ||
| - Install Python 3.11 | ||
| - Install Poetry | ||
| - Cache dependencies | ||
|
|
||
| #### 2. Generate (automatic) | ||
| - Generate XML files using `poetry run python -m customthreads.cli` | ||
| - Place artifacts in `build/xml/` directory | ||
|
|
||
| #### 3. Verify (automatic) | ||
| - Run all tests to verify code quality | ||
| - Validate generated XML structure | ||
|
|
||
| #### 4. Release (automatic) | ||
| - Create Git tag with datetime format: `v{YYYY}.{MM}.{DD}-{HHMMSS}-r{RUN_NUMBER}` | ||
| - Create GitHub Release with metadata | ||
| - Upload XML file as downloadable artifact | ||
|
|
||
| ### Versioning Scheme | ||
|
|
||
| Release versions use **calendar versioning with second precision + run number**: | ||
|
|
||
| ``` | ||
| v2026.03.29-124530-r42 | ||
| └─ 2026: Year | ||
| └─ 03: Month (March) | ||
| └─ 29: Day | ||
| └─ 124530: Time in UTC (12:45:30 UTC) | ||
| └─ r42: GitHub Actions run number | ||
| ``` | ||
|
|
||
| **Advantages:** | ||
| - Easy to see when profiles were generated | ||
| - No manual version management needed | ||
| - Chronological ordering in release history | ||
| - Preserves full timestamp accuracy | ||
|
|
||
| **Examples:** | ||
| - `v2026.03.29-000000-r7` = March 29, 2026 at midnight UTC, run 7 | ||
| - `v2026.03.29-120000-r12` = March 29, 2026 at noon UTC, run 12 | ||
| - `v2026.12.31-235959-r128` = December 31, 2026 at 23:59:59 UTC, run 128 | ||
|
|
||
| ## Using Releases | ||
|
|
||
| ### Download Options | ||
|
|
||
| 1. **GitHub UI (Recommended)** | ||
| - Visit Repository → Releases page | ||
| - Click on latest release | ||
| - Download `3DPrintedMetricThreads.xml` | ||
|
|
||
| 2. **Command Line** | ||
| ```bash | ||
| # Get latest release URL | ||
| curl -s https://api.github.com/repos/USERNAME/REPO/releases/latest | \ | ||
| grep "browser_download_url" | \ | ||
| grep ".xml" | \ | ||
| cut -d '"' -f 4 | \ | ||
| xargs wget -O | ||
| ``` | ||
|
|
||
| 3. **Direct URL (latest)** | ||
| ``` | ||
| https://github.com/USERNAME/REPO/releases/latest/download/3DPrintedMetricThreads.xml | ||
| ``` | ||
|
|
||
| ### Installation | ||
|
|
||
| After downloading, place the XML file in your Fusion 360 thread data directory (see README.md for paths). | ||
|
|
||
| ## Customizing the Workflow | ||
|
|
||
| ### Change Release Trigger | ||
|
|
||
| To manually trigger releases instead of automatic: | ||
|
|
||
| Edit `.github/workflows/generate-xml-release.yml`: | ||
| ```yaml | ||
| on: | ||
| workflow_dispatch: # Manual trigger only (remove 'push' section) | ||
| ``` | ||
|
|
||
| Then manually trigger from GitHub UI: | ||
| 1. Go to Actions → "Generate and Release XML Thread Profiles" | ||
| 2. Click "Run workflow" | ||
| 3. Select branch and click "Run workflow" | ||
|
|
||
| ### Change Release Schedule | ||
|
|
||
| To generate profiles on a schedule (e.g., weekly), add: | ||
|
|
||
| ```yaml | ||
| on: | ||
| schedule: | ||
| - cron: '0 0 * * 0' # Every Sunday at midnight UTC | ||
| workflow_dispatch: # Plus manual trigger | ||
| ``` | ||
|
|
||
| ### Customize Generated Profiles | ||
|
|
||
| Edit `src/customthreads/cli.py` configuration section: | ||
|
|
||
| ```python | ||
| pitch_start = 1.0 # Starting pitch in mm | ||
| pitch_end = 6.0 # Ending pitch in mm | ||
| pitch_step = 0.5 # Pitch interval in mm | ||
| thread_sizes = list(range(8, 51)) # Diameters 8-50mm | ||
| tolerance_offsets = [0.0, 0.1, 0.2, 0.4, 0.8] # Tolerance classes | ||
| ``` | ||
|
|
||
| Then commit and push to trigger a new release with your configuration. | ||
|
|
||
| ### Modify Release Notes | ||
|
|
||
| Edit the `body` section of `create-release` step: | ||
|
|
||
| ```yaml | ||
| - name: Create Release | ||
| with: | ||
| body: | | ||
| Your custom release notes here... | ||
| - Item 1 | ||
| - Item 2 | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Release Not Created | ||
|
|
||
| 1. Check "Actions" tab for workflow errors | ||
| 2. Verify branch is `master` (not a feature branch) | ||
| 3. Ensure `pyproject.toml` is present | ||
| 4. Check Poetry dependencies are correct | ||
|
|
||
| ### XML File Invalid | ||
|
|
||
| 1. Run tests locally: `poetry run pytest -v` | ||
| 2. Generate locally: `poetry run python -m customthreads.cli` | ||
| 3. Validate XML: `python3 -c "import xml.etree.ElementTree as ET; ET.parse('file.xml')"` | ||
|
|
||
| ### Workflow Not Triggering | ||
|
|
||
| 1. Verify `.github/workflows/generate-xml-release.yml` is in `master` branch | ||
| 2. Check repository settings → Actions permissions are enabled | ||
| 3. Ensure your GitHub token has write access to releases | ||
|
|
||
| ## Security Considerations | ||
|
|
||
| - ✅ Uses only official actions (`actions/checkout`, `actions/setup-python`) | ||
| - ✅ Read-only access to repository except for release creation | ||
| - ✅ `secrets.GITHUB_TOKEN` automatically provided by GitHub | ||
| - ✅ No external secrets or credentials needed | ||
|
|
||
| ## Performance | ||
|
|
||
| - **Runtime:** ~2-3 minutes per release | ||
| - **Test Duration:** ~3 seconds | ||
| - **XML Generation:** <1 second | ||
| - **Total Including Setup:** ~2 minutes | ||
|
|
||
| ## Future Enhancements | ||
|
|
||
| Potential improvements: | ||
| - Generate multiple XML variants (different pitch ranges, sizes) | ||
| - Create changelog from commit messages | ||
| - Upload to GitHub Pages as well | ||
| - Multi-architecture testing (Windows, macOS, Linux) | ||
| - Code coverage reports | ||
|
|
||
| ## References | ||
|
|
||
| - [GitHub Actions Documentation](https://docs.github.com/en/actions) | ||
| - [Workflow Syntax](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) | ||
| - [Poetry CI/CD Integration](https://python-poetry.org/docs/ci-cd/) | ||
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,46 @@ | ||
| name: Deploy GitHub Pages Generator | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| paths: | ||
| - web/** | ||
| - .github/workflows/deploy-pages.yml | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pages: write | ||
| id-token: write | ||
|
|
||
| concurrency: | ||
| group: pages | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Configure Pages | ||
| uses: actions/configure-pages@v6 | ||
|
|
||
| - name: Upload web artifact | ||
| uses: actions/upload-pages-artifact@v4 | ||
| with: | ||
| path: ./web | ||
|
|
||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v5 |
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,92 @@ | ||
| name: Generate and Release XML Thread Profiles | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| workflow_dispatch: # Allow manual trigger | ||
|
|
||
| env: | ||
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" | ||
|
|
||
| jobs: | ||
| generate-and-release: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| permissions: | ||
| contents: write # Permission to create releases | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Install Poetry | ||
| uses: snok/install-poetry@v1 | ||
| with: | ||
| version: latest | ||
| virtualenvs-create: true | ||
| virtualenvs-in-project: true | ||
|
|
||
| - name: Cache Poetry dependencies | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: .venv | ||
| key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-poetry- | ||
|
|
||
| - name: Install dependencies | ||
| run: poetry install | ||
|
|
||
| - name: Generate XML thread profiles | ||
| run: | | ||
| poetry run python -m customthreads.cli | ||
| # Also generate with alternative configurations (optional) | ||
| mkdir -p build/xml | ||
| mv 3DPrintedMetricThreads.xml build/xml/ | ||
|
|
||
| - name: Run tests and validate generated XML | ||
| run: | | ||
| poetry run pytest -v | ||
| python3 -c "import xml.etree.ElementTree as ET; ET.parse('build/xml/3DPrintedMetricThreads.xml'); print('✅ Generated XML is valid')" | ||
|
|
||
| - name: Create datetime-based version tag | ||
| id: version | ||
| run: | | ||
| VERSION=$(date -u +"v%Y.%m.%d-%H%M%S-r${{ github.run_number }}") | ||
| GENERATED_AT=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
| echo "generated_at=$GENERATED_AT" >> $GITHUB_OUTPUT | ||
| echo "Version: $VERSION" | ||
|
|
||
| - name: Create release and upload asset | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| draft: false | ||
| prerelease: false | ||
| name: XML Thread Profiles ${{ steps.version.outputs.version }} | ||
| tag_name: ${{ steps.version.outputs.version }} | ||
| body: | | ||
| Automatically generated 3D-printed metric thread profiles in XML format. | ||
|
|
||
| **Generated:** ${{ steps.version.outputs.generated_at }} | ||
| **Commit:** ${{ github.sha }} | ||
|
|
||
| ## Contents | ||
| - `3DPrintedMetricThreads.xml` - Thread profiles from 8mm to 50mm diameter, pitches 1.0mm to 6.0mm, 5 tolerance classes (O.0 to O.8) | ||
|
|
||
| ## Usage | ||
| 1. Download the XML file | ||
| 2. Place in Fusion 360 thread data directory (see README) | ||
| 3. Restart Fusion 360 | ||
|
|
||
| Use these profiles for 3D-printed metric threads optimized for FDM printing. | ||
| files: | | ||
| ./build/xml/3DPrintedMetricThreads.xml | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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.