-
Notifications
You must be signed in to change notification settings - Fork 14
build-n-publish-2-pypi: update gfortran provider for macOS #107
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
Conversation
+ update macOS from 13 to 15 + use gfortran installed from homebrew. Another option is https://github.com/numpy/numpy/pull/26812/files
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR updates the macOS GitHub Actions build environment to macOS 15 and switches the Fortran toolchain provisioning from manually symlinked system paths to Homebrew-installed gfortran, updating the macOS deployment target accordingly while keeping the overall build-and-publish workflow intact. Sequence diagram for the updated macOS 15 build-and-publish workflowsequenceDiagram
actor Developer
participant GitHubActions as GitHub_Actions
participant MatrixJob as build_and_publish_job
participant RunnerMac as macos_15_runner
participant Homebrew as Homebrew
participant PyPI as PyPI_Registry
Developer->>GitHubActions: push tag or release
GitHubActions->>MatrixJob: start job with matrix os ubuntu_latest, macos_15
GitHubActions->>RunnerMac: provision macos_15 runner
RunnerMac->>RunnerMac: checkout code (actions_checkout)
RunnerMac->>Homebrew: brew install gcc
Homebrew-->>RunnerMac: gcc with gfortran_15 installed
RunnerMac->>RunnerMac: ln -sf gfortran_15 to usr_local_bin_gfortran
RunnerMac->>RunnerMac: gfortran --version
RunnerMac->>RunnerMac: set CIBW_ENVIRONMENT_MACOS MACOSX_DEPLOYMENT_TARGET=15.0
RunnerMac->>RunnerMac: run cibuildwheel build
RunnerMac->>PyPI: upload built wheels
PyPI-->>Developer: macOS 15 compatible wheels available
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've found 1 issue, and left some high level feedback:
- The
brew install gccstep may fail or requiresudowhen creating/usr/local/bin/gfortranon GitHub-hosted macOS runners (which use/opt/homebrewon ARM), so consider symlinking into$(brew --prefix)/binor another writeable directory and updating PATH instead of writing to/usr/local. - Hardcoding
gfortran-15in the symlink makes the workflow brittle when Homebrew upgrades GCC; consider resolving the installed gfortran binary dynamically (e.g., vials $(brew --prefix)/bin/gfortran-* | sort | tail -n1). - Raising
MACOSX_DEPLOYMENT_TARGETto 15.0 will drop support for older macOS versions in your wheels; if that’s not intended, you may want to keep a lower deployment target while still building onmacos-15runners.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `brew install gcc` step may fail or require `sudo` when creating `/usr/local/bin/gfortran` on GitHub-hosted macOS runners (which use `/opt/homebrew` on ARM), so consider symlinking into `$(brew --prefix)/bin` or another writeable directory and updating PATH instead of writing to `/usr/local`.
- Hardcoding `gfortran-15` in the symlink makes the workflow brittle when Homebrew upgrades GCC; consider resolving the installed gfortran binary dynamically (e.g., via `ls $(brew --prefix)/bin/gfortran-* | sort | tail -n1`).
- Raising `MACOSX_DEPLOYMENT_TARGET` to 15.0 will drop support for older macOS versions in your wheels; if that’s not intended, you may want to keep a lower deployment target while still building on `macos-15` runners.
## Individual Comments
### Comment 1
<location> `.github/workflows/build-and-publish-to-pypi.yml:27-31` </location>
<code_context>
fetch-depth: 0
- - name: Provide gfortran (macOS-13)
+ - name: Symlink gfortran (macOS)
if: runner.os == 'macOS'
run: |
- # https://github.com/actions/virtual-environments/issues/2524
- # https://github.com/cbg-ethz/dce/blob/master/.github/workflows/pkgdown.yaml
- sudo ln -s /usr/local/bin/gfortran-13 /usr/local/bin/gfortran
- sudo mkdir /usr/local/gfortran
- sudo ln -s /usr/local/Cellar/gcc@13/*/lib/gcc/13 /usr/local/gfortran/lib
+ brew install gcc
+ ln -sf $(brew --prefix)/bin/gfortran-15 /usr/local/bin/gfortran
gfortran --version
</code_context>
<issue_to_address>
**issue (bug_risk):** Symlinking into /usr/local/bin without sudo on macOS runners may fail, and hardcoding gfortran-15 is brittle.
On GitHub macOS runners `/usr/local` is often not writable by the default user, so creating the symlink there without `sudo` may fail. Instead of symlinking, you could rely on `$(brew --prefix)/bin` being on `PATH`, or explicitly prepend it to `PATH` in the workflow.
Hardcoding `gfortran-15` also risks breakage when Homebrew upgrades GCC (e.g., to 16). Consider resolving the installed `gfortran-*` dynamically (e.g. via `ls $(brew --prefix)/bin/gfortran-*`) or deriving the version from a single source of truth so it doesn’t require manual updates.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
+ lower the MACOSX_DEPLOYMENT_TARGET version for better compatiability + use macos-latest instead of macos-15 for easier maintainence + grab gfortran version dynamically for easier maintainence
update macOS from 13 to 15
use gfortran installed from homebrew. Another option is https://github.com/numpy/numpy/pull/26812/files
Summary by Sourcery
Update the PyPI build workflow to use macOS 15 with a Homebrew-provided gfortran and adjust macOS deployment targeting accordingly.
CI: