Skip to content

Commit

Permalink
Add macOS workaround to build wheels step (#11864)
Browse files Browse the repository at this point in the history
### Problem

See: #11733
This issue now happens during wheel build:  https://github.com/pantsbuild/pants/runs/2300092374?check_suite_focus=true#step:8:1129

### Solution

Apply the same solution that we use for running other things on macos to the build wheels job.
  • Loading branch information
asherf authored Apr 8, 2021
1 parent ad05694 commit aa6e897
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,9 @@ jobs:
restore-keys: '${{ runner.os }}-cargo-${{ hashFiles(''rust-toolchain'') }}-
'
- if: github.event_name == 'push' || !contains(env.COMMIT_MESSAGE, '[ci skip-build-wheels]')
- env:
ARCHFLAGS: -arch x86_64
if: github.event_name == 'push' || !contains(env.COMMIT_MESSAGE, '[ci skip-build-wheels]')
name: Build wheels and fs_util
run: '[[ "${GITHUB_EVENT_NAME}" == "pull_request" ]] && export MODE=debug
Expand Down
40 changes: 24 additions & 16 deletions build-support/bin/generate_github_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,28 @@ def expose_all_pythons() -> Sequence[Step]:
]


def get_build_wheels_step(is_macos: bool) -> Step:
step = {
"name": "Build wheels and fs_util",
"run": dedent(
# We use MODE=debug on PR builds to speed things up, given that those are only
# smoke tests of our release process.
"""\
[[ "${GITHUB_EVENT_NAME}" == "pull_request" ]] && export MODE=debug
./build-support/bin/release.sh -n
USE_PY38=true ./build-support/bin/release.sh -n
./build-support/bin/release.sh -f
"""
),
"if": DONT_SKIP_WHEELS,
}
if is_macos:
# Works around bad `-arch arm64` flag embedded in Xcode 12.x Python interpreters on
# intel machines. See: https://github.com/giampaolo/psutil/issues/1832
step["env"] = {"ARCHFLAGS": "-arch x86_64"} # type: ignore[assignment]
return step


def test_workflow_jobs(primary_python_version: str, *, cron: bool) -> Jobs:
jobs = {
"bootstrap_pants_linux": {
Expand Down Expand Up @@ -354,20 +376,6 @@ def test_workflow_jobs(primary_python_version: str, *, cron: bool) -> Jobs:
},
}
if not cron:
build_wheels_step = {
"name": "Build wheels and fs_util",
"run": dedent(
# We use MODE=debug on PR builds to speed things up, given that those are only
# smoke tests of our release process.
"""\
[[ "${GITHUB_EVENT_NAME}" == "pull_request" ]] && export MODE=debug
./build-support/bin/release.sh -n
USE_PY38=true ./build-support/bin/release.sh -n
./build-support/bin/release.sh -f
"""
),
"if": DONT_SKIP_WHEELS,
}
deploy_to_s3_step = {
"name": "Deploy to S3",
"run": "./build-support/bin/deploy_to_s3.py",
Expand All @@ -393,7 +401,7 @@ def test_workflow_jobs(primary_python_version: str, *, cron: bool) -> Jobs:
'/opt/python/cp38-cp38/bin" >> $GITHUB_ENV'
),
},
build_wheels_step,
get_build_wheels_step(is_macos=False),
deploy_to_s3_step,
],
},
Expand All @@ -408,7 +416,7 @@ def test_workflow_jobs(primary_python_version: str, *, cron: bool) -> Jobs:
# multiple Python versions, whereas that caching assumes only one primary
# Python version (marked via matrix.strategy).
*rust_caches(),
build_wheels_step,
get_build_wheels_step(is_macos=True),
deploy_to_s3_step,
],
},
Expand Down

0 comments on commit aa6e897

Please sign in to comment.