Skip to content

Make Tintype VS Code mocks safe for Jest hoisting #5

Make Tintype VS Code mocks safe for Jest hoisting

Make Tintype VS Code mocks safe for Jest hoisting #5

Workflow file for this run

name: Release
# Build platform-specific wheels + sdist and publish to (Test)PyPI.
#
# Publishing uses OIDC Trusted Publishing, so no API tokens are stored in
# GitHub secrets. This requires one-time configuration on each index:
#
# 1. On https://pypi.org and https://test.pypi.org, go to the project's
# "Publishing" settings (or create a pending publisher if the project
# does not yet exist) and add a Trusted Publisher with:
# - Owner: <github-org-or-user>
# - Repository name: tintype
# - Workflow name: release.yml
# - Environment name: pypi (for PyPI)
# testpypi (for TestPyPI)
# See https://docs.pypi.org/trusted-publishers/ for details.
#
# 2. In this repo's GitHub settings, create two environments named
# "pypi" and "testpypi" (Settings -> Environments -> New environment).
# Optionally add required reviewers for the "pypi" environment so that
# production releases require manual approval.
on:
push:
tags:
- 'v*'
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
# Cancel in-progress runs for the same ref on tag pushes and manual runs,
# but NOT on release: published events — we don't want to cancel a real
# PyPI publish mid-flight.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name != 'release' }}
jobs:
build_wheels:
name: build_wheels (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- name: Build wheels
uses: pypa/cibuildwheel@v3.4.1
env:
CIBW_BUILD: "cp312-* cp313-*"
CIBW_SKIP: "*-manylinux_i686 *-musllinux*"
CIBW_ARCHS_MACOS: "x86_64 arm64"
# Install libzstd inside the manylinux container (mirrors ci.yml's
# `apt install libzstd-dev` but adapted for the CentOS-based image).
CIBW_BEFORE_ALL_LINUX: "yum install -y libzstd-devel"
# macOS: the macos-latest runner (macOS 15+) ships Homebrew bottles
# targeting macOS 15, but cibuildwheel tags our wheel as macOS 11.
# delocate refuses to bundle a dylib with a higher min target than
# the wheel, so we build libzstd from source as a universal2 dylib
# targeting macOS 11.0. setup.py's find_zstd() searches
# /usr, /usr/local, /opt/homebrew in order, so /usr/local wins over
# any leftover Homebrew install.
CIBW_BEFORE_ALL_MACOS: |
brew uninstall --ignore-dependencies zstd 2>/dev/null || true
ZSTD_VERSION=1.5.6
curl -fL "https://github.com/facebook/zstd/releases/download/v${ZSTD_VERSION}/zstd-${ZSTD_VERSION}.tar.gz" | tar -xz -C /tmp
cmake -S "/tmp/zstd-${ZSTD_VERSION}/build/cmake" -B /tmp/zstd-build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-DZSTD_BUILD_SHARED=ON \
-DZSTD_BUILD_STATIC=OFF \
-DZSTD_BUILD_PROGRAMS=OFF \
-DZSTD_BUILD_TESTS=OFF \
-DCMAKE_INSTALL_PREFIX=/usr/local
cmake --build /tmp/zstd-build --parallel
sudo cmake --install /tmp/zstd-build
# Pin both x86_64 and arm64 legs to the same minimum macOS target
# that our vendored libzstd was built against (otherwise the x86_64
# default of 10.13 would be lower than the dylib's 11.0 and delocate
# would fail again).
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=11.0
- name: Upload wheels artifact
uses: actions/upload-artifact@v5
with:
name: cibw-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
build_sdist:
name: build_sdist
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- name: Build sdist
run: pipx run build --sdist
- name: Upload sdist artifact
uses: actions/upload-artifact@v5
with:
name: cibw-sdist
path: dist/*.tar.gz
publish_testpypi:
name: publish_testpypi
needs: [build_wheels, build_sdist]
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 15
environment: testpypi
permissions:
id-token: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v5
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
publish_pypi:
name: publish_pypi
needs: [build_wheels, build_sdist]
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest
timeout-minutes: 15
environment: pypi
permissions:
id-token: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v5
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1