Skip to content

Create alt_build_executables.yml#145

Merged
sjswerdloff merged 1 commit intomainfrom
sjswerdloff-patch-1
May 21, 2025
Merged

Create alt_build_executables.yml#145
sjswerdloff merged 1 commit intomainfrom
sjswerdloff-patch-1

Conversation

@sjswerdloff
Copy link
Copy Markdown
Owner

@sjswerdloff sjswerdloff commented May 21, 2025

Summary by Sourcery

Introduce a manual GitHub Actions workflow to build, package, and release Windows executables for tdwii_plus_examples using Python, Poetry, and PyInstaller.

Build:

  • Use Poetry and PyInstaller to generate Windows executables and bundle configuration files
  • Zip and clean up distribution artifacts for Windows

CI:

  • Add 'Alt Build Executables' workflow to trigger manual builds

Deployment:

  • Automate creation of draft GitHub releases with packaged artifacts on the main branch

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented May 21, 2025

Reviewer's Guide

Introduce a new GitHub Actions workflow that manually builds, packages, and drafts releases of platform-specific executables using PyInstaller and Poetry.

Sequence Diagram for the Alt Build Executables Workflow Execution

sequenceDiagram
    actor Developer
    participant GA as GitHub Actions
    participant Runner as GitHub Runner (Windows)
    participant Poetry
    participant PyInstaller
    participant Artifacts as GitHub Artifact Storage
    participant GHReleases as GitHub Releases

    Developer->>GA: Manually triggers "Alt Build Executables" workflow
    GA->>Runner: Start "build" job
    Runner->>Runner: Checkout code (actions/checkout@v4)
    Runner->>Runner: Set up Python (actions/setup-python@v5)
    Runner->>Poetry: Install Poetry (snok/install-poetry@v1)
    Runner->>Poetry: Install dependencies (poetry install --with=dev)
    Runner->>PyInstaller: Build executables (e.g., tdwii_config_dump.exe, eScheduler.exe)
    PyInstaller-->>Runner: Return built executables to dist/
    Runner->>Runner: Copy configuration files to dist/
    Runner->>Runner: Create distribution package (Compress-Archive dist/ to twdii_plus_examples.zip)
    Runner->>Artifacts: Upload artifact "twdii_plus_examples.zip" (actions/upload-artifact@v4)
    Artifacts-->>Runner: Confirm upload
    alt If on 'main' branch
        Runner->>GHReleases: Create Draft Release (softprops/action-gh-release@v1)
        GHReleases-->>Runner: Confirm draft release creation
        Runner->>GHReleases: Upload "twdii_plus_examples.zip" to release files
        GHReleases-->>Runner: Confirm file upload
    end
Loading

File-Level Changes

Change Details Files
Introduce manual CI workflow with permissions
  • Add workflow_dispatch trigger for manual runs
  • Grant contents: write permission to support release creation and tagging
.github/workflows/alt_build_executables.yml
Configure OS build matrix
  • Define Windows build target in the matrix
  • Comment out macOS and Ubuntu entries for future enablement
.github/workflows/alt_build_executables.yml
Set up Python environment and dependencies
  • Checkout repository and set up Python 3.12
  • Install Poetry v2.1.1 in a project-local virtualenv
  • Install project dependencies with dev extras via Poetry
.github/workflows/alt_build_executables.yml
Build Windows executables with PyInstaller
  • Run multiple PyInstaller one-file builds for CLI and GUI scripts
  • Copy and organize TOML and JSON config files into dist/
.github/workflows/alt_build_executables.yml
Package and upload Windows artifacts
  • Compress executables and config into a single ZIP
  • Upload the ZIP as a build artifact using actions/upload-artifact
.github/workflows/alt_build_executables.yml
Draft GitHub release on main branch
  • Use softprops/action-gh-release to create a draft release
  • Tag the release with the run number
.github/workflows/alt_build_executables.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sjswerdloff sjswerdloff self-assigned this May 21, 2025
@sjswerdloff sjswerdloff merged commit 60bac48 into main May 21, 2025
1 check passed
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @sjswerdloff - I've reviewed your changes - here's some feedback:

  • Either remove or un-comment the macOS/Linux build steps to avoid dead code and keep the workflow file clean.
  • Fix the inconsistent naming between “twdii_plus_examples.zip” and “tdwii_plus_examples” to match your project’s naming convention.
  • Consider adding caching for Poetry’s virtualenv or dependencies to speed up subsequent workflow runs.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

run: |
Compress-Archive -Path "dist/config" -DestinationPath "dist/config.zip" -Force
Remove-Item -Path "dist/config" -Force
Compress-Archive -Path "dist/" -DestinationPath "./twdii_plus_examples.zip" -Force
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (typo): Inconsistent project prefix typo in zip filename

Update twdii_plus_examples.zip to tdwii_plus_examples.zip to match the project's prefix.

Suggested implementation:

        Compress-Archive -Path "dist/" -DestinationPath "./tdwii_plus_examples.zip" -Force

        Copy-Item -Path "./tdwii_plus_examples.zip" -DestinationPath "dist/" -Force

        name: tdwii_plus_examples.zip

        path: dist/tdwii_plus_examples.zip

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: twdii_plus_examples.zip
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (typo): Zip artifact name typo

Fix the typo in the artifact name to match the filename and project naming conventions.

Suggested implementation:

      with:
        name: twdii-plus-examples.zip
        path: dist/twdii_plus_examples.zip

If you want the path to also reflect hyphens (and you’ve renamed the zip earlier in the script), update any Compress-Archive and Copy-Item calls that reference twdii_plus_examples.zip to twdii-plus-examples.zip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant