Skip to content

Add cross-platform binary builds to PR and push workflows#3

Open
Copilot wants to merge 2 commits into
masterfrom
copilot/add-binary-build-job
Open

Add cross-platform binary builds to PR and push workflows#3
Copilot wants to merge 2 commits into
masterfrom
copilot/add-binary-build-job

Conversation

Copy link
Copy Markdown

Copilot AI commented Dec 13, 2025

Enables building and downloading test binaries for all supported platforms on every PR and push to master, without waiting for release creation.

Changes

  • .github/workflows/pull_request.yml: Added build job that produces binaries for 6 platform combinations (Linux/Darwin/FreeBSD × amd64/386/arm64)
  • .github/workflows/push.yml: Added build-binaries job with identical configuration

Implementation

Reused the matrix strategy from release.yml with key differences:

  • Dynamic versioning via git describe --tags --always --dirty instead of release tag
  • Artifacts uploaded as workflow artifacts instead of release assets
  • Full git history fetch (fetch-depth: 0) enables tag-based version strings
env:
  GOOS: ${{ matrix.goos }}
  GOARCH: ${{ matrix.goarch }}
  CGO_ENABLED: 0
run: |
  VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo "dev-$(git rev-parse --short HEAD)")
  go build -ldflags "-X main.version=$VERSION" -o rss2email-${{ matrix.suffix }}

Existing lint/test jobs and release.yml unchanged.

Original prompt

Objective

Build cross-platform binaries for all supported platforms on every pull request and push to master, making them available as downloadable artifacts for testing before creating official releases.

Current State

  • pull_request.yml only runs linting and tests
  • push.yml only runs build and tests
  • release.yml builds cross-platform binaries but only when a release is created

Required Changes

1. Update .github/workflows/pull_request.yml

Add a new job that builds binaries for all platforms using the same matrix strategy as release.yml:

  • Linux (amd64, 386)
  • Darwin/macOS (amd64, arm64)
  • FreeBSD (amd64, 386)

The binaries should:

  • Be built with CGO_ENABLED=0
  • Use version string from git describe --tags (or similar)
  • Be uploaded as workflow artifacts with appropriate names (e.g., rss2email-linux-amd64, rss2email-darwin-arm64, etc.)

This job should run in addition to the existing lint and test jobs.

2. Update .github/workflows/push.yml

Add the same binary building job as in pull_request.yml so that pushes to master also produce downloadable test binaries.

Implementation Notes

  • Reuse the matrix strategy from release.yml (lines 11-31)
  • Build step should be similar to release.yml line 45, but use a dynamic version (e.g., from git describe)
  • Use actions/upload-artifact@v4 to make binaries downloadable
  • Keep all existing jobs (lint, test) - just add the build job
  • No need to upload to releases - artifacts are for testing only

Success Criteria

  • Every PR run produces downloadable binaries for all 6 platform combinations
  • Every push to master produces downloadable binaries for all 6 platform combinations
  • Existing lint and test jobs continue to work
  • release.yml remains unchanged and continues to work for actual releases

This pull request was created as a result of the following prompt from Copilot chat.

Objective

Build cross-platform binaries for all supported platforms on every pull request and push to master, making them available as downloadable artifacts for testing before creating official releases.

Current State

  • pull_request.yml only runs linting and tests
  • push.yml only runs build and tests
  • release.yml builds cross-platform binaries but only when a release is created

Required Changes

1. Update .github/workflows/pull_request.yml

Add a new job that builds binaries for all platforms using the same matrix strategy as release.yml:

  • Linux (amd64, 386)
  • Darwin/macOS (amd64, arm64)
  • FreeBSD (amd64, 386)

The binaries should:

  • Be built with CGO_ENABLED=0
  • Use version string from git describe --tags (or similar)
  • Be uploaded as workflow artifacts with appropriate names (e.g., rss2email-linux-amd64, rss2email-darwin-arm64, etc.)

This job should run in addition to the existing lint and test jobs.

2. Update .github/workflows/push.yml

Add the same binary building job as in pull_request.yml so that pushes to master also produce downloadable test binaries.

Implementation Notes

  • Reuse the matrix strategy from release.yml (lines 11-31)
  • Build step should be similar to release.yml line 45, but use a dynamic version (e.g., from git describe)
  • Use actions/upload-artifact@v4 to make binaries downloadable
  • Keep all existing jobs (lint, test) - just add the build job
  • No need to upload to releases - artifacts are for testing only

Success Criteria

  • Every PR run produces downloadable binaries for all 6 platform combinations
  • Every push to master produces downloadable binaries for all 6 platform combinations
  • Existing lint and test jobs continue to work
  • release.yml remains unchanged and continues to work for actual releases

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: UberKitten <566438+UberKitten@users.noreply.github.com>
Copilot AI changed the title [WIP] Add build job for cross-platform binaries in workflows Add cross-platform binary builds to PR and push workflows Dec 13, 2025
Copilot AI requested a review from UberKitten December 13, 2025 06:02
@UberKitten UberKitten marked this pull request as ready for review December 13, 2025 07:37
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.

2 participants