Resolve original name for from imports #2001
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build binaries | |
| on: | |
| push: | |
| paths: | |
| - '**/*' | |
| - '!.*' | |
| - '.github/workflows/build_binaries.yml' | |
| workflow_dispatch: | |
| workflow_call: | |
| env: | |
| PACKAGE_NAME: pyrefly | |
| BINARY_NAME: pyrefly | |
| PYTHON_VERSION: "3.12" | |
| jobs: | |
| sdist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| persist-credentials: false | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Build sdist | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| command: sdist | |
| args: --out dist | |
| working-directory: pyrefly | |
| - name: Test sdist | |
| run: | | |
| pip install pyrefly/dist/"${PACKAGE_NAME}"-*.tar.gz --force-reinstall | |
| "${BINARY_NAME}" --version | |
| "${BINARY_NAME}" --help | |
| "${BINARY_NAME}" check test.py | |
| python -m "${BINARY_NAME}" --version | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-sdist | |
| path: pyrefly/dist | |
| macos: | |
| runs-on: macos-14 | |
| strategy: | |
| matrix: | |
| platform: | |
| - target: x86_64 | |
| arch: x64 | |
| - target: aarch64 | |
| arch: arm64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| persist-credentials: false | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| architecture: ${{ matrix.platform.arch }} | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist | |
| working-directory: pyrefly | |
| - name: Test wheel | |
| if: ${{ matrix.platform.target == 'aarch64' }} | |
| run: | | |
| pip install pyrefly/dist/"${PACKAGE_NAME}"-*.whl --force-reinstall | |
| "${BINARY_NAME}" --version | |
| "${BINARY_NAME}" --help | |
| "${BINARY_NAME}" check test.py | |
| python -m "${BINARY_NAME}" --version | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-macos-${{ matrix.platform.target }} | |
| path: pyrefly/dist | |
| windows: | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| platform: | |
| - target: x86_64-pc-windows-msvc | |
| arch: x64 | |
| - target: i686-pc-windows-msvc | |
| arch: x86 | |
| - target: aarch64-pc-windows-msvc | |
| arch: x64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| persist-credentials: false | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| architecture: ${{ matrix.platform.arch }} | |
| - name: Set windows cargo home | |
| # we need to set CARGO_HOME to a high-up directory on Windows machines, since some dependencies cloned | |
| # by Cargo have long paths and will cause builds/tests to fail | |
| run: echo "CARGO_HOME=C:\\cargo" >> $env:GITHUB_ENV | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist | |
| working-directory: pyrefly | |
| - name: Test wheel | |
| if: ${{ !startsWith(matrix.platform.target, 'aarch64') }} | |
| shell: bash | |
| run: | | |
| python -m pip install pyrefly/dist/"${PACKAGE_NAME}"-*.whl --force-reinstall | |
| "${BINARY_NAME}" --version | |
| "${BINARY_NAME}" --help | |
| "${BINARY_NAME}" check test.py | |
| python -m "${BINARY_NAME}" --version | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.platform.target }} | |
| path: pyrefly/dist | |
| linux: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target: | |
| - x86_64-unknown-linux-gnu | |
| - i686-unknown-linux-gnu | |
| - aarch64-unknown-linux-gnu | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| persist-credentials: false | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| architecture: x64 | |
| - name: Build wheels | |
| if: ${{ !startsWith(matrix.target, 'aarch64') }} | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| manylinux: auto | |
| args: --release --out dist | |
| working-directory: pyrefly | |
| - name: Build wheels aarch64 | |
| if: ${{ startsWith(matrix.target, 'aarch64') }} | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| manylinux: auto | |
| args: --release --out dist | |
| working-directory: pyrefly | |
| env: | |
| # aarch64-linux builds need JEMALLOC_SYS_WITH_LG_PAGE=16, or they segfault. | |
| # See https://github.com/facebook/pyrefly/issues/380 | |
| JEMALLOC_SYS_WITH_LG_PAGE: 16 | |
| - name: Test wheel (unactivated venv) | |
| if: ${{ startsWith(matrix.target, 'x86_64') }} | |
| run: | | |
| python -m venv .venv | |
| .venv/bin/python -m pip install pyrefly/dist/"${PACKAGE_NAME}"-*.whl --force-reinstall | |
| .venv/bin/python -m "${BINARY_NAME}" --version | |
| rm -rf .venv | |
| - name: Test wheel | |
| if: ${{ startsWith(matrix.target, 'x86_64') }} | |
| run: | | |
| pip install pyrefly/dist/"${PACKAGE_NAME}"-*.whl --force-reinstall | |
| "${BINARY_NAME}" --version | |
| "${BINARY_NAME}" --help | |
| "${BINARY_NAME}" check test.py | |
| python -m "${BINARY_NAME}" --version | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.target }} | |
| path: pyrefly/dist | |
| merge: | |
| name: Merge artifacts | |
| runs-on: ubuntu-latest | |
| needs: | |
| - sdist | |
| - macos | |
| - windows | |
| - linux | |
| steps: | |
| - name: Merge artifacts | |
| uses: actions/upload-artifact/merge@v4 | |
| with: | |
| name: dist |