⬆️ Bump orjson from 3.10.13 to 3.10.14 in /docs #4116
Workflow file for this run
This file contains 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: Release | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
pull_request: | |
jobs: | |
# Shared tag & version number info ---------------------- | |
get-tag-xor-dev-version: | |
name: Get tags and version numbers | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.detect-new-version-tag.outputs.tag }} | |
dev-version: ${{ steps.bump-dev-version.outputs.version }} | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.13" | |
- name: Upgrade pip | |
run: | | |
pip install --constraint=.github/workflows/constraints.txt pip | |
pip --version | |
- name: Install Poetry | |
run: | | |
pip install --constraint=.github/workflows/constraints.txt poetry | |
poetry --version | |
- name: Check if there is a parent commit | |
id: check-parent-commit | |
run: | | |
echo "sha=$(git rev-parse --verify --quiet HEAD^)" >> $GITHUB_OUTPUT | |
- name: Detect new version tag | |
id: detect-new-version-tag | |
if: "steps.check-parent-commit.outputs.sha" | |
run: | | |
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) | |
git checkout HEAD~ | |
PARENT_COMMIT_VER=$(make get-project-version-number) | |
git checkout "${BRANCH_NAME}" | |
CURRENT_COMMIT_VER=$(make get-project-version-number) | |
if [[ "${PARENT_COMMIT_VER}" != "${CURRENT_COMMIT_VER}" ]]; then | |
echo "tag=${CURRENT_COMMIT_VER}" >> $GITHUB_OUTPUT | |
fi | |
- name: Bump version for developmental release | |
id: bump-dev-version | |
if: "! steps.detect-new-version-tag.outputs.tag" | |
run: | | |
poetry version patch && | |
VERSION=$(make get-project-version-number) && | |
DEV_VERSION="${VERSION}.dev.$(date +%s)" && | |
poetry version "${DEV_VERSION}" && | |
echo "version=${DEV_VERSION}" >> $GITHUB_OUTPUT | |
# Package build ---------------------- | |
package-build: | |
strategy: | |
matrix: | |
# Parallelize all macOS CPython wheel builds | |
os: ["macos-13", "macos-latest"] | |
cibw_archs_macos: ["x86_64", "universal2", "arm64"] | |
# For broader macOS major version compatibility, | |
# build all wheels against the below deployment targets | |
macosx_deployment_target: ["11.0", "12.0", "13.0", "14.0"] | |
exclude: | |
# Exclude macOS universal2 & arm64 CPython wheel builds on Intel runners | |
- os: "macos-13" | |
cibw_archs_macos: "universal2" | |
- os: "macos-13" | |
cibw_archs_macos: "arm64" | |
# Exclude macOS x86_64 CPython wheel builds on Apple Silicon runners | |
- os: "macos-latest" | |
cibw_archs_macos: "x86_64" | |
include: | |
# Parallelize all Linux aarch64 CPython wheel builds across major versions | |
# 3.9 | |
- os: "ubuntu-latest" | |
cibw_archs_linux: "aarch64" | |
cibw_skip_linux_aarch64_cpython_versions: "cp3{10,11,12,13}-*" | |
# 3.10 | |
- os: "ubuntu-latest" | |
cibw_archs_linux: "aarch64" | |
cibw_skip_linux_aarch64_cpython_versions: "cp3{9,11,12,13}-*" | |
# 3.11 | |
- os: "ubuntu-latest" | |
cibw_archs_linux: "aarch64" | |
cibw_skip_linux_aarch64_cpython_versions: "cp3{9,10,12,13}-*" | |
# 3.12 | |
- os: "ubuntu-latest" | |
cibw_archs_linux: "aarch64" | |
cibw_skip_linux_aarch64_cpython_versions: "cp3{9,10,11,13}-*" | |
# 3.13 | |
- os: "ubuntu-latest" | |
cibw_archs_linux: "aarch64" | |
cibw_skip_linux_aarch64_cpython_versions: "cp3{9,10,11,12}-*" | |
# All Linux x86_64 CPython wheel builds | |
- os: "ubuntu-latest" | |
cibw_archs_linux: "auto64" | |
# All Windows AMD64 CPython wheel builds | |
- os: "windows-2019" | |
cibw_archs_windows: "auto64" | |
name: Package build via CI buildwheel | |
runs-on: ${{ matrix.os }} | |
needs: get-tag-xor-dev-version | |
outputs: | |
is-test-package: ${{ steps.use-dev-version-for-testing.outputs.is_testing }} | |
package-version: ${{ steps.log-package-version.outputs.version }} | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.13" | |
- name: Upgrade pip | |
run: | | |
pip install --constraint=.github/workflows/constraints.txt pip | |
pip --version | |
- name: Install Poetry | |
run: | | |
pip install --constraint=.github/workflows/constraints.txt poetry | |
poetry --version | |
# Update the project version number to the dev version that was | |
# generated upstream (only used in non-release builds; else project | |
# already set to the correct version number) | |
- name: Use dev project version for testing | |
id: use-dev-version-for-testing | |
if: "needs.get-tag-xor-dev-version.outputs.dev-version" | |
run: | | |
VERSION="${{ needs.get-tag-xor-dev-version.outputs.dev-version }}" | |
poetry version "${VERSION}" | |
echo "is_testing=true" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Log package version | |
id: log-package-version | |
run: | | |
VERSION=$(make get-project-version-number) | |
echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Setup QEMU | |
if: ${{ runner.os == 'Linux' }} | |
uses: docker/setup-qemu-action@v3 | |
- name: Log wheel filename-safe MacOS deployment target identifier | |
if: "startsWith(matrix.os, 'macos')" | |
run: | | |
echo "macosx_deployment_target_wheel_string=$(echo ${{ matrix.macosx_deployment_target }} | sed 's/\./_/g')" >> $GITHUB_ENV | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9,<3.14" | |
# Disable building | |
# - PyPy wheels on all platforms due to orjson maturin wheel build incompatibility | |
# see: https://github.com/ijl/orjson/issues/177 | |
# - redundant Linux aarch64 builds (already handled by other jobs) | |
CIBW_SKIP: "pp* ${{ matrix.cibw_skip_linux_aarch64_cpython_versions }}" | |
# On a Windows runner only build 64-bit wheels | |
CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_archs_windows }} | |
# Install rust on Linux runners for orjson wheel builds which use maturin | |
# https://github.com/Daggy1234/polaroid/blob/ace9a6eee74ee9c30edd0d350d65e2f3b4d8430c/.github/workflows/publish.yml#L29 | |
CIBW_BEFORE_ALL_LINUX: > | |
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y && | |
yum install -y openssl-devel || apk add openssl-dev | |
CIBW_ENVIRONMENT_LINUX: > | |
PATH="$PATH:$HOME/.cargo/bin" | |
CARGO_NET_GIT_FETCH_WITH_CLI="true" | |
# Pass orjson build args to maturin | |
# | |
# Note: this is global to *all* maturin wheel builds which may be | |
# problematic if, in the future, multiple build dependencies use | |
# maturin and must be built from source | |
MATURIN_PEP517_ARGS: "--strip --out dist --features=unstable-simd,yyjson" | |
# On a Linux Intel runner with qemu installed, | |
# build 64-bit Intel and ARM wheels | |
CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux }} | |
# On macOS, explicitly specify (a) target architectures for correct | |
# wheel builds (metadata & file names use x86_64 by default otherwise) | |
# and (b) minimum target OS versions for broader compatibility with | |
# different OS versions | |
CIBW_ENVIRONMENT_MACOS: > | |
MACOSX_DEPLOYMENT_TARGET="${{ matrix.macosx_deployment_target }}" | |
CMAKE_OSX_DEPLOYMENT_TARGET="${{ matrix.macosx_deployment_target }}" | |
CMAKE_OSX_ARCHITECTURES="${{ matrix.cibw_archs_macos }}" | |
CIBW_ARCHS_MACOS: ${{ matrix.cibw_archs_macos }} | |
CIBW_BUILD_VERBOSITY_MACOS: 1 | |
# (2024/09/10) | |
# Correctly rename macOS wheels due to bug w/ Poetry as a build backend when cross-compiling | |
# - MACOSX_DEPLOYMENT_TARGET cross-compilation builds are incorrectly given the OS target tag of the runner OS | |
# (ex. macOS 14 => 14_0 tag when compiling for macOS <14) | |
# see: | |
# - https://cibuildwheel.pypa.io/en/stable/faq/#cross-compiling:~:text=_universal2%3Aarm64%22.-,Note,See%20this%20workflow%20for%20an%20example%20usage%20of%20wheel%20tags.,-Building%20Linux%20wheels | |
# - https://wheel.readthedocs.io/en/stable/reference/wheel_tags.html | |
CIBW_REPAIR_WHEEL_COMMAND_MACOS: > | |
pip install --upgrade pip && | |
pip install wheel>=0.44 && | |
NEW_WHEEL_FILENAME="$(wheel tags --remove --platform-tag macosx_${{ env.macosx_deployment_target_wheel_string }}_${{ matrix.cibw_archs_macos }} {wheel} | tail -n 1)" | |
NEW_WHEEL="$(dirname {wheel})/${NEW_WHEEL_FILENAME}" && | |
delocate-listdeps -v "${NEW_WHEEL}" && | |
delocate-wheel -v --require-archs {delocate_archs} -w {dest_dir} "${NEW_WHEEL}" | |
- name: Log unique benchmark file suffix (macOS) | |
if: "startsWith(matrix.os, 'macos')" | |
run: | | |
echo "benchmark_file_suffix=$(echo ${{ matrix.cibw_archs_macos }}-${{ matrix.macosx_deployment_target }} )" >> $GITHUB_ENV | |
- name: Log unique benchmark file suffix (Ubuntu) | |
if: "startsWith(matrix.os, 'ubuntu')" | |
run: | | |
echo "benchmark_file_suffix=$(echo ${{ matrix.cibw_archs_linux }}-skip-versions-${{ matrix.cibw_skip_linux_aarch64_cpython_versions }} | sed 's/\*\s\{0,1\}//g' )" >> $GITHUB_ENV | |
- name: Log unique benchmark file suffix (Windows) | |
if: "startsWith(matrix.os, 'windows')" | |
run: | | |
echo "benchmark_file_suffix=$(echo ${{ matrix.cibw_archs_windows }} )" >> $GITHUB_ENV | |
- name: Store the binary wheel | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-package-distributions-${{ matrix.os }}-${{ env.benchmark_file_suffix }} | |
path: ./wheelhouse/*.whl | |
# PyPI/TestPyPI package upload ---------------------- | |
pypi-packages-upload: | |
name: PyPI/TestPyPI package upload | |
runs-on: ubuntu-latest | |
needs: | |
- package-build | |
outputs: | |
package-version: ${{ needs.package-build.outputs.package-version }} | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.13" | |
- name: Upgrade pip | |
run: | | |
pip install --constraint=.github/workflows/constraints.txt pip | |
pip --version | |
- name: Download the ci build wheel binary wheels | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: python-package-distributions* | |
path: dist | |
merge-multiple: true | |
- name: Publish packages on PyPI | |
if: "! needs.package-build.outputs.is-test-package" | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} # pragma: allowlist secret | |
# # FIXME(teo): Re-enable this step once the following issue is resolved: | |
# # https://github.com/pypi/warehouse/issues/15149 | |
# - name: Publish packages on TestPyPI | |
# if: "needs.package-build.outputs.is-test-package" | |
# uses: pypa/[email protected] | |
# with: | |
# user: __token__ | |
# password: ${{ secrets.TEST_PYPI_TOKEN }} # pragma: allowlist secret | |
# repository_url: https://test.pypi.org/legacy/ | |
# Install Verification ---------------------- | |
verify-user-install: | |
strategy: | |
matrix: | |
os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
name: Verify package install as user | |
# FIXME(teo): Remove this conditional once the following issue is resolved: | |
# https://github.com/pypi/warehouse/issues/15149 | |
if: "! needs.package-build.outputs.is-test-package" | |
# end FIXME(teo) | |
runs-on: ${{ matrix.os }} | |
needs: pypi-packages-upload | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install package-under-test | |
run: | | |
PYPI_PACKAGE="structlog-sentry-logger==${PACKAGE_VERSION}" | |
TEST_PYPI_PACKAGE="${PYPI_PACKAGE} --index-url https://test.pypi.org/simple/" | |
function install_test_pypi() { pip install ${TEST_PYPI_PACKAGE} --no-deps && install_pypi; } | |
function install_pypi() { pip install --upgrade ${PYPI_PACKAGE}; } | |
until (install_test_pypi || install_pypi) | |
do | |
echo "Waiting for Python Package Index to serve current package-under-test: ${PYPI_PACKAGE}" | |
sleep 10 | |
done | |
pip list -v | |
env: | |
PACKAGE_VERSION: ${{ needs.pypi-packages-upload.outputs.package-version }} | |
shell: bash | |
- name: Run example script with both logging configurations | |
run: | | |
echo "Default output (JSON)" | |
python ./docs_src/pure_structlog_logging_without_sentry.py | |
echo "Cloud Logging compatibility mode (JSON)" | |
export STRUCTLOG_SENTRY_LOGGER_CLOUD_LOGGING_COMPATIBILITY_MODE_ON= | |
python ./docs_src/pure_structlog_logging_without_sentry.py | |
echo "Local development mode output (formatted) \ | |
(with Cloud Logging compatibility mode still activated)" | |
export STRUCTLOG_SENTRY_LOGGER_LOCAL_DEVELOPMENT_LOGGING_MODE_ON= | |
python ./docs_src/pure_structlog_logging_without_sentry.py | |
shell: bash | |
# Release notes publication ---------------------- | |
publish-release-notes: | |
name: Publish release notes | |
runs-on: ubuntu-latest | |
needs: | |
- get-tag-xor-dev-version | |
- verify-user-install | |
permissions: | |
pull-requests: write | |
contents: write | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Publish the release notes | |
uses: release-drafter/[email protected] | |
with: | |
publish: ${{ needs.get-tag-xor-dev-version.outputs.tag != '' }} | |
# Annotated tag to associate with the current commit | |
tag: ${{ needs.get-tag-xor-dev-version.outputs.tag }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |