feat: add tower apps cancel command to cancel running runs
#292
Workflow file for this run
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
| # Build tower on all platforms. | |
| # | |
| # Generates both wheels (for PyPI) and archived binaries (for GitHub releases). | |
| # | |
| # Assumed to run as a subworkflow of .github/workflows/release.yml; specifically, as a local | |
| # artifacts job within `cargo-dist`. | |
| # | |
| # Shamelessly lifted from the guys who brought Ruff to the world. | |
| # https://github.com/astral-sh/ruff/ | |
| name: "[tower] Build binaries" | |
| on: | |
| workflow_call: | |
| inputs: | |
| plan: | |
| required: true | |
| type: string | |
| workflow_dispatch: | |
| pull_request: | |
| paths-ignore: | |
| - '**.md' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| PACKAGE_NAME: tower | |
| MODULE_NAME: tower | |
| EXECUTABLE_NAME: tower | |
| PYTHON_VERSION: "3.13" | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_NET_RETRY: 10 | |
| CARGO_TERM_COLOR: always | |
| RUSTUP_MAX_RETRIES: 10 | |
| jobs: | |
| sdist: | |
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-build') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| with: | |
| submodules: recursive | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1.11.0 | |
| - uses: actions/setup-python@v5.5.0 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: "Build sdist" | |
| uses: PyO3/maturin-action@v1.49.1 | |
| with: | |
| command: sdist | |
| args: --out dist | |
| - name: "Test sdist" | |
| run: | | |
| pip install dist/${{ env.PACKAGE_NAME }}-*.tar.gz --force-reinstall | |
| ${{ env.EXECUTABLE_NAME }} --help | |
| python -m ${{ env.MODULE_NAME }} --help | |
| - name: "Upload sdist" | |
| uses: actions/upload-artifact@v4.6.2 | |
| with: | |
| name: wheels-sdist | |
| path: dist | |
| macos-x86_64: | |
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-build') }} | |
| runs-on: macos-15 | |
| strategy: | |
| matrix: | |
| # Python 3.9/3.10 macOS builds require libintl from Homebrew gettext, | |
| # which is not available on macos-15 runners | |
| python-version: ["3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| with: | |
| submodules: recursive | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1.11.0 | |
| - uses: actions/setup-python@v5.5.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| architecture: x64 | |
| - name: "Build wheels - x86_64" | |
| uses: PyO3/maturin-action@v1.49.1 | |
| with: | |
| target: x86_64 | |
| args: --release --locked --out dist -i python${{ matrix.python-version }} | |
| - name: "Upload wheels" | |
| uses: actions/upload-artifact@v4.6.2 | |
| with: | |
| name: wheels-macos-x86_64-py${{ matrix.python-version }} | |
| path: dist | |
| macos-aarch64: | |
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-build') }} | |
| runs-on: macos-15 | |
| strategy: | |
| matrix: | |
| # Python 3.9/3.10 macOS builds require libintl from Homebrew gettext, | |
| # which is not available on macos-15 runners | |
| python-version: ["3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| with: | |
| submodules: recursive | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1.11.0 | |
| - uses: actions/setup-python@v5.5.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| architecture: arm64 | |
| - name: "Build wheels - aarch64" | |
| uses: PyO3/maturin-action@v1.49.1 | |
| with: | |
| target: aarch64 | |
| args: --release --locked --out dist -i python${{ matrix.python-version }} | |
| - name: "Test wheel - aarch64" | |
| run: | | |
| pip install dist/*.whl --force-reinstall | |
| ${{ env.EXECUTABLE_NAME }} --help | |
| python -m ${{ env.MODULE_NAME }} --help | |
| - name: "Upload wheels" | |
| uses: actions/upload-artifact@v4.6.2 | |
| with: | |
| name: wheels-aarch64-apple-darwin-py${{ matrix.python-version }} | |
| path: dist | |
| windows: | |
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-build') }} | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| platform: | |
| - target: x86_64-pc-windows-msvc | |
| arch: x64 | |
| # NOTE: i686 disabled due to poor support in PyArrow and friends. | |
| #- target: i686-pc-windows-msvc | |
| # arch: x86 | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| with: | |
| submodules: recursive | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1.11.0 | |
| - uses: actions/setup-python@v5.5.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| architecture: ${{ matrix.platform.arch }} | |
| - name: "Build wheels" | |
| uses: PyO3/maturin-action@v1.49.1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release --locked --out dist -i python${{ matrix.python-version }} | |
| - name: "Test wheel" | |
| shell: bash | |
| run: | | |
| python -m pip install dist/*.whl --force-reinstall | |
| ${{ env.EXECUTABLE_NAME }} --help | |
| python -m ${{ env.MODULE_NAME }} --help | |
| - name: "Upload wheels" | |
| uses: actions/upload-artifact@v4.6.2 | |
| with: | |
| name: wheels-${{ matrix.platform.target }}-py${{ matrix.python-version }} | |
| path: dist | |
| windows-aarch64: | |
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-build') }} | |
| runs-on: windows-11-arm | |
| strategy: | |
| matrix: | |
| # Python ARM64 Windows builds started with 3.11 | |
| python-version: ["3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| with: | |
| submodules: recursive | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1.11.0 | |
| - uses: actions/setup-python@v5.5.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: "Build wheels" | |
| uses: PyO3/maturin-action@v1.49.1 | |
| with: | |
| target: aarch64-pc-windows-msvc | |
| args: --release --locked --out dist -i python${{ matrix.python-version }} | |
| - name: "Test wheel" | |
| shell: bash | |
| run: | | |
| python -m pip install dist/*.whl --force-reinstall | |
| ${{ env.EXECUTABLE_NAME }} --help | |
| python -m ${{ env.MODULE_NAME }} --help | |
| - name: "Upload wheels" | |
| uses: actions/upload-artifact@v4.6.2 | |
| with: | |
| name: wheels-aarch64-pc-windows-msvc-py${{ matrix.python-version }} | |
| path: dist | |
| linux: | |
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-build') }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target: | |
| - x86_64-unknown-linux-gnu | |
| - i686-unknown-linux-gnu | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| with: | |
| submodules: recursive | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1.11.0 | |
| - uses: actions/setup-python@v5.5.0 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| architecture: x64 | |
| - name: "Build wheels" | |
| uses: PyO3/maturin-action@v1.49.1 | |
| with: | |
| manylinux: auto | |
| args: --release --locked --out dist -i python3.10 python3.11 python3.12 python3.13 python3.14 | |
| before-script-linux: | | |
| # If we're running on rhel centos, install needed packages. | |
| if command -v yum &> /dev/null; then | |
| yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic | |
| # If we're running on i686 we need to symlink libatomic | |
| # in order to build openssl with -latomic flag. | |
| if [[ ! -d "/usr/lib64" ]]; then | |
| sudo ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so | |
| fi | |
| else | |
| # If we're running on debian-based system. | |
| sudo apt update -y | |
| sudo apt-get install -y libssl-dev openssl pkg-config | |
| fi | |
| - name: "Test wheel" | |
| if: ${{ startsWith(matrix.target, 'x86_64') }} | |
| run: | | |
| PYTAG="cp$(python -c "import sys; print(f'{sys.version_info.major}{sys.version_info.minor}')")" | |
| pip install dist/*-${PYTAG}-*.whl --force-reinstall | |
| ${{ env.EXECUTABLE_NAME }} --help | |
| python -m ${{ env.MODULE_NAME }} --help | |
| - name: "Upload wheels" | |
| uses: actions/upload-artifact@v4.6.2 | |
| with: | |
| name: wheels-${{ matrix.target }} | |
| path: dist | |
| linux-cross: | |
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-build') }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| platform: | |
| - target: aarch64-unknown-linux-gnu | |
| arch: aarch64 | |
| # see https://github.com/astral-sh/ruff/issues/3791 | |
| # and https://github.com/gnzlbg/jemallocator/issues/170#issuecomment-1503228963 | |
| maturin_docker_options: -e JEMALLOC_SYS_WITH_LG_PAGE=16 -e PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| with: | |
| submodules: recursive | |
| persist-credentials: false | |
| - uses: actions/setup-python@v5.5.0 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: "Build wheels" | |
| uses: PyO3/maturin-action@v1.49.1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| manylinux: auto | |
| docker-options: ${{ matrix.platform.maturin_docker_options }} | |
| args: --release --locked --out dist -i python3.10 python3.11 python3.12 python3.13 python3.14 | |
| env: | |
| CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
| # Set the CFLAGS for the aarch64 target, defining the ARM architecture | |
| # for the ring crate's build script. This is a workaround for the | |
| # issue where the ring crate's build script is not able to detect the | |
| # ARM architecture. | |
| CFLAGS_aarch64_unknown_linux_gnu: "-march=armv8-a -D__ARM_ARCH=8" | |
| - uses: uraimo/run-on-arch-action@v2 | |
| if: ${{ matrix.platform.arch != 'ppc64' && matrix.platform.arch != 'ppc64le'}} | |
| name: Test wheel | |
| with: | |
| arch: ${{ matrix.platform.arch }} | |
| distro: ubuntu22.04 | |
| githubToken: ${{ github.token }} | |
| install: | | |
| apt-get update | |
| apt-get install -y --no-install-recommends python3 python3-pip python3-venv python3-dev cargo libffi-dev | |
| # Create and use a virtual environment to avoid the externally-managed-environment error | |
| run: | | |
| # Workaround for QEMU bug when emulating 32-bit on 64-bit hosts | |
| # See: https://github.com/docker/buildx/issues/395 | |
| # Use /tmp for CARGO_HOME (often tmpfs, which avoids the QEMU filesystem bug) | |
| export CARGO_HOME=/tmp/cargo-home | |
| python3 -m venv /tmp/venv | |
| . /tmp/venv/bin/activate | |
| PYTAG="cp$(python3 -c "import sys; print(f'{sys.version_info.major}{sys.version_info.minor}')")" | |
| pip3 install dist/*-${PYTAG}-*.whl --force-reinstall | |
| ${{ env.EXECUTABLE_NAME }} --help | |
| - name: "Upload wheels" | |
| uses: actions/upload-artifact@v4.6.2 | |
| with: | |
| name: wheels-${{ matrix.platform.target }} | |
| path: dist | |
| musllinux: | |
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-build') }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target: | |
| - x86_64-unknown-linux-musl | |
| - i686-unknown-linux-musl | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| with: | |
| submodules: recursive | |
| - uses: actions/setup-python@v5.5.0 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: "Install OpenSSL" | |
| run: sudo apt-get update && sudo apt-get install libssl-dev openssl | |
| - name: "Build wheels" | |
| uses: PyO3/maturin-action@v1.49.1 | |
| with: | |
| target: ${{ matrix.target }} | |
| manylinux: musllinux_1_2 | |
| args: --release --locked --out dist -i python3.10 python3.11 python3.12 python3.13 python3.14 | |
| - name: "Test wheel" | |
| if: matrix.target == 'x86_64-unknown-linux-musl' | |
| uses: addnab/docker-run-action@v3 | |
| with: | |
| image: alpine:latest | |
| options: -v ${{ github.workspace }}:/io -w /io | |
| run: | | |
| apk add python3 python3-dev py3-pip rust | |
| python -m venv .venv | |
| PYTAG="cp$(python -c "import sys; print(f'{sys.version_info.major}{sys.version_info.minor}')")" | |
| .venv/bin/pip3 install dist/*-${PYTAG}-*.whl --force-reinstall | |
| .venv/bin/${{ env.EXECUTABLE_NAME }} --help | |
| - name: "Upload wheels" | |
| uses: actions/upload-artifact@v4.6.2 | |
| with: | |
| name: wheels-${{ matrix.target }} | |
| path: dist | |
| musllinux-cross: | |
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-build') }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| platform: | |
| - target: aarch64-unknown-linux-musl | |
| arch: aarch64 | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| with: | |
| submodules: recursive | |
| - uses: actions/setup-python@v5.5.0 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: "Build wheels" | |
| uses: PyO3/maturin-action@v1.49.1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| manylinux: musllinux_1_2 | |
| args: --release --locked --out dist -i python3.10 python3.11 python3.12 python3.13 python3.14 | |
| - uses: uraimo/run-on-arch-action@v2 | |
| name: Test wheel | |
| with: | |
| arch: ${{ matrix.platform.arch }} | |
| distro: alpine_latest | |
| githubToken: ${{ github.token }} | |
| install: | | |
| apk add python3 python3-dev py3-pip rust | |
| run: | | |
| python -m venv .venv | |
| PYTAG="cp$(python3 -c "import sys; print(f'{sys.version_info.major}{sys.version_info.minor}')")" | |
| .venv/bin/pip3 install dist/*-${PYTAG}-*.whl --force-reinstall | |
| .venv/bin/${{ env.EXECUTABLE_NAME }} --help | |
| - name: "Upload wheels" | |
| uses: actions/upload-artifact@v4.6.2 | |
| with: | |
| name: wheels-${{ matrix.platform.target }} | |
| path: dist |