Skip to content

Commit

Permalink
Use GITHUB_PATH to modify paths between CI steps. (pantsbuild#17882)
Browse files Browse the repository at this point in the history
Previously we used GITHUB_ENV, and interpolated the existing $PATH.

However in the containerized manylinux wheel builds this interpolated
the host $PATH into the container's $PATH. This did not seem to cause
harm in practice on the x86_64 manylinux wheel build, presumably
because the host paths happened to still be suitable in the container.
However this was exposed while working on setting up the aarch64
manylinux wheel build, where the host and container paths are
not at all compatible.
  • Loading branch information
benjyw authored Dec 26, 2022
1 parent 4374cce commit 28c2559
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 37 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/test-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,14 @@ jobs:
go-version: 1.17.1
- if: runner.os == 'Linux'
name: Download Apache `thrift` binary (Linux)
run: 'mkdir -p "$HOME/.thrift"
run: 'mkdir -p "${HOME}/.thrift"
curl --fail -L https://binaries.pantsbuild.org/bin/thrift/linux/x86_64/0.15.0/thrift
-o "$HOME/.thrift/thrift"
-o "${HOME}/.thrift/thrift"
chmod +x "$HOME/.thrift/thrift"
chmod +x "${HOME}/.thrift/thrift"
echo "PATH=${PATH}:${HOME}/.thrift" >> $GITHUB_ENV
echo "${HOME}/.thrift" >> $GITHUB_PATH
'
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -376,14 +376,14 @@ jobs:
go-version: 1.17.1
- if: runner.os == 'Linux'
name: Download Apache `thrift` binary (Linux)
run: 'mkdir -p "$HOME/.thrift"
run: 'mkdir -p "${HOME}/.thrift"
curl --fail -L https://binaries.pantsbuild.org/bin/thrift/linux/x86_64/0.15.0/thrift
-o "$HOME/.thrift/thrift"
-o "${HOME}/.thrift/thrift"
chmod +x "$HOME/.thrift/thrift"
chmod +x "${HOME}/.thrift/thrift"
echo "PATH=${PATH}:${HOME}/.thrift" >> $GITHUB_ENV
echo "${HOME}/.thrift" >> $GITHUB_PATH
'
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -447,14 +447,14 @@ jobs:
go-version: 1.17.1
- if: runner.os == 'Linux'
name: Download Apache `thrift` binary (Linux)
run: 'mkdir -p "$HOME/.thrift"
run: 'mkdir -p "${HOME}/.thrift"
curl --fail -L https://binaries.pantsbuild.org/bin/thrift/linux/x86_64/0.15.0/thrift
-o "$HOME/.thrift/thrift"
-o "${HOME}/.thrift/thrift"
chmod +x "$HOME/.thrift/thrift"
chmod +x "${HOME}/.thrift/thrift"
echo "PATH=${PATH}:${HOME}/.thrift" >> $GITHUB_ENV
echo "${HOME}/.thrift" >> $GITHUB_PATH
'
- name: Set up Python ${{ matrix.python-version }}
Expand Down
35 changes: 20 additions & 15 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,17 @@ jobs:
run: 'curl --proto ''=https'' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s --
-v -y --default-toolchain none
echo "PATH=${PATH}:${HOME}/.cargo/bin" >> $GITHUB_ENV
echo "${HOME}/.cargo/bin" >> $GITHUB_PATH
'
- name: Expose Pythons
run: echo "PATH=${PATH}:/opt/python/cp37-cp37m/bin:/opt/python/cp38-cp38/bin:/opt/python/cp39-cp39/bin"
>> $GITHUB_ENV
run: 'echo "/opt/python/cp37-cp37m/bin" >> $GITHUB_PATH
echo "/opt/python/cp38-cp38/bin" >> $GITHUB_PATH
echo "/opt/python/cp39-cp39/bin" >> $GITHUB_PATH
'
- if: github.event_name != 'pull_request'
name: Setup toolchain auth
run: 'echo TOOLCHAIN_AUTH_TOKEN="${{ secrets.TOOLCHAIN_AUTH_TOKEN }}" >> $GITHUB_ENV
Expand Down Expand Up @@ -638,14 +643,14 @@ jobs:
go-version: 1.17.1
- if: runner.os == 'Linux'
name: Download Apache `thrift` binary (Linux)
run: 'mkdir -p "$HOME/.thrift"
run: 'mkdir -p "${HOME}/.thrift"
curl --fail -L https://binaries.pantsbuild.org/bin/thrift/linux/x86_64/0.15.0/thrift
-o "$HOME/.thrift/thrift"
-o "${HOME}/.thrift/thrift"
chmod +x "$HOME/.thrift/thrift"
chmod +x "${HOME}/.thrift/thrift"
echo "PATH=${PATH}:${HOME}/.thrift" >> $GITHUB_ENV
echo "${HOME}/.thrift" >> $GITHUB_PATH
'
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -711,14 +716,14 @@ jobs:
go-version: 1.17.1
- if: runner.os == 'Linux'
name: Download Apache `thrift` binary (Linux)
run: 'mkdir -p "$HOME/.thrift"
run: 'mkdir -p "${HOME}/.thrift"
curl --fail -L https://binaries.pantsbuild.org/bin/thrift/linux/x86_64/0.15.0/thrift
-o "$HOME/.thrift/thrift"
-o "${HOME}/.thrift/thrift"
chmod +x "$HOME/.thrift/thrift"
chmod +x "${HOME}/.thrift/thrift"
echo "PATH=${PATH}:${HOME}/.thrift" >> $GITHUB_ENV
echo "${HOME}/.thrift" >> $GITHUB_PATH
'
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -784,14 +789,14 @@ jobs:
go-version: 1.17.1
- if: runner.os == 'Linux'
name: Download Apache `thrift` binary (Linux)
run: 'mkdir -p "$HOME/.thrift"
run: 'mkdir -p "${HOME}/.thrift"
curl --fail -L https://binaries.pantsbuild.org/bin/thrift/linux/x86_64/0.15.0/thrift
-o "$HOME/.thrift/thrift"
-o "${HOME}/.thrift/thrift"
chmod +x "$HOME/.thrift/thrift"
chmod +x "${HOME}/.thrift/thrift"
echo "PATH=${PATH}:${HOME}/.thrift" >> $GITHUB_ENV
echo "${HOME}/.thrift" >> $GITHUB_PATH
'
- name: Set up Python ${{ matrix.python-version }}
Expand Down
21 changes: 11 additions & 10 deletions build-support/bin/generate_github_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def install_rustup() -> Step:
"run": dedent(
"""\
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -v -y --default-toolchain none
echo "PATH=${PATH}:${HOME}/.cargo/bin" >> $GITHUB_ENV
echo "${HOME}/.cargo/bin" >> $GITHUB_PATH
"""
),
}
Expand Down Expand Up @@ -293,10 +293,10 @@ def download_apache_thrift() -> Step:
"if": "runner.os == 'Linux'",
"run": dedent(
"""\
mkdir -p "$HOME/.thrift"
curl --fail -L https://binaries.pantsbuild.org/bin/thrift/linux/x86_64/0.15.0/thrift -o "$HOME/.thrift/thrift"
chmod +x "$HOME/.thrift/thrift"
echo "PATH=${PATH}:${HOME}/.thrift" >> $GITHUB_ENV
mkdir -p "${HOME}/.thrift"
curl --fail -L https://binaries.pantsbuild.org/bin/thrift/linux/x86_64/0.15.0/thrift -o "${HOME}/.thrift/thrift"
chmod +x "${HOME}/.thrift/thrift"
echo "${HOME}/.thrift" >> $GITHUB_PATH
"""
),
}
Expand Down Expand Up @@ -618,11 +618,12 @@ def build_wheels_job(platform: Platform, python_versions: list[str]) -> Jobs:
install_rustup(),
{
"name": "Expose Pythons",
"run": (
'echo "PATH=${PATH}:'
"/opt/python/cp37-cp37m/bin:"
"/opt/python/cp38-cp38/bin:"
'/opt/python/cp39-cp39/bin" >> $GITHUB_ENV'
"run": dedent(
"""\
echo "/opt/python/cp37-cp37m/bin" >> $GITHUB_PATH
echo "/opt/python/cp38-cp38/bin" >> $GITHUB_PATH
echo "/opt/python/cp39-cp39/bin" >> $GITHUB_PATH
"""
),
},
]
Expand Down

0 comments on commit 28c2559

Please sign in to comment.