Skip to content

📈 Update versions for pre-commit hooks #370

📈 Update versions for pre-commit hooks

📈 Update versions for pre-commit hooks #370

Workflow file for this run

name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_COLOR: 3
CIBW_BUILD_VERBOSITY: 2
CIBW_SKIP: "pp* *musllinux*"
CIBW_BUILD_FRONTEND: "build"
jobs:
style:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: 3.12
- name: Run style checks
run: pipx run pre-commit run --all-files
check_commit_message:
needs: [style]
name: Check for skips
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, '[buildjet]')
steps:
- name: Run BuildJet runners
run: echo "Running BuildJet runners"
build_wheels:
needs: [style]
name: ${{ matrix.runs-on }}-python-${{ matrix.python-version }}
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.12", "3.13"]
runs-on: [ubuntu-latest, macos-13, macos-14, windows-latest]
exclude:
# https://github.com/actions/setup-python/issues/808
- python-version: "3.8"
runs-on: macos-14
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Set up Go toolchain
id: setup-go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: '1.22.2'
cache: false
check-latest: true
- name: Install MinGW on Windows
if: matrix.runs-on == 'windows-latest'
run: choco install mingw
- name: Restore Hugo builder cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ./hugo_cache/
key: ${{ matrix.runs-on }}-hugo-${{ steps.setup-go.outputs.go-version }}
- name: Install Python dependencies
run: python -m pip install build virtualenv nox
- name: Build binary distribution (wheel)
run: |
python -m build --wheel . --outdir wheelhouse/
- name: Test entry points for package
run: nox -s venv
build_wheels_linux_aarch64:
needs: [check_commit_message]
name: linux-aarch64-buildjet-python-3.12
runs-on: buildjet-2vcpu-ubuntu-2204-arm
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: buildjet/setup-python@v5
- uses: buildjet/setup-go@af85c03c2736c2267d5afe4d5952023a3b64bf89 # v5.0.0
with:
go-version: '1.22.2'
cache: false
check-latest: true
- name: Build binary distribution (wheel) on Linux (aarch64)
run: |
python -m pip install cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: "cp312-*"
CIBW_ARCHS_LINUX: aarch64
CIBW_BEFORE_ALL_LINUX: bash scripts/ci/tools/linux/install_go.sh
CIBW_ENVIRONMENT_LINUX: PATH=$PATH:$HOME/go_installed/go/bin
CIBW_SKIP: "pp* *musllinux*"
CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux_2_28"
CIBW_TEST_COMMAND: |
hugo version
hugo env --logLevel debug
experimental:
needs: [style]
name: zig-${{ matrix.runs-on }}-${{ matrix.architecture }}-python-${{ matrix.python-version }}
env:
CIBW_BUILD_VERBOSITY: 2
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-latest, windows-latest]
architecture: [arm64, i686]
python-version: [3.8, 3.12, 3.13]
# Exclude i686 on Linux for all Python versions
# Test just one Python version on Windows for now
exclude:
- runs-on: ubuntu-latest
architecture: i686
- python-version: "3.8"
runs-on: windows-latest
- python-version: "3.13"
runs-on: windows-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Set up Go toolchain
id: setup-go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: '1.22.2'
cache: false
check-latest: true
- uses: goto-bus-stop/setup-zig@7ab2955eb728f5440978d5824358023be3a2802d # v2.2.0
with:
version: 0.11.0
- name: Restore Hugo builder cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ./hugo_cache/
key: ${{ matrix.runs-on }}-${{ matrix.architecture}}-hugo-experimental-${{ steps.setup-go.outputs.go-version }}
- name: Install Python dependencies
run: python -m pip install build virtualenv nox auditwheel
- name: Build binary distribution (wheel) on Linux
if: matrix.runs-on == 'ubuntu-latest'
# Cross-compile for arm64 target via Zig toolchain
env:
GOARCH: arm64
# We are on ubuntu amd64, so set target as arm64
CC: zig cc -target aarch64-linux-gnu
CXX: zig c++ -target aarch64-linux-gnu
run: |
python -m build --wheel . --outdir wheelhouse/
# can't repair arm64 wheels on Linux x86_64 right now
# auditwheel repair --plat manylinux_2_28_aarch64 -w wheelhouse/ dist/*.whl
- name: Build binary distribution (wheel) on Windows (arm64)
if: matrix.runs-on == 'windows-latest' && matrix.architecture == 'arm64'
# We need to use cibuildwheel because it has experimental support for cross-compiling
# to arm64 and setup-python does not have arm64 support on Windows right now
uses: pypa/cibuildwheel@932529cab190fafca8c735a551657247fa8f8eaf # v2.19.1
with:
package-dir: .
output-dir: wheelhouse
# Cross-compile for arm64 target via Zig toolchain
env:
GOARCH: arm64
# We are on Windows amd64, so set target as arm64
CC: zig cc -target aarch64-windows-gnu
CXX: zig c++ -target aarch64-windows-gnu
CIBW_BUILD: "cp312-*"
CIBW_ARCHS_WINDOWS: ARM64
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair -w {dest_dir} {wheel}
CIBW_TEST_SKIP: "*-win_arm64"
# Note: cibuildwheel will manage installing 32-bit Python on Windows. We
# do not need to do that manually unless we use setup-python instead.
- name: Build binary distribution (wheel) on Windows (i686)
if: matrix.runs-on == 'windows-latest' && matrix.architecture == 'i686'
uses: pypa/cibuildwheel@932529cab190fafca8c735a551657247fa8f8eaf # v2.19.1
with:
package-dir: .
output-dir: wheelhouse
# Cross-compile for i686 target via Zig toolchain
env:
GOARCH: 386
CC: zig cc -target x86-windows-gnu
CXX: zig c++ -target x86-windows-gnu
CIBW_BUILD: "cp312-*"
CIBW_ARCHS_WINDOWS: x86
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair -w {dest_dir} {wheel}
CIBW_TEST_COMMAND: |
hugo version
hugo env --logLevel debug
- name: Upload artifacts for debugging
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: wheels_${{ matrix.runs-on }}_${{ matrix.architecture }}_py${{ matrix.python-version }}
path: ./wheelhouse/*.whl
inspect_distributions:
needs: [style]
name: inspect-sdist-wheel-contents
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: 3.12
- name: Build source distribution (SDist) and binary distribution (wheel)
run: |
pipx run build --sdist --wheel . --outdir dist/
pipx run twine check dist/* --strict
- name: Build, inspect, and display contents of distributions
shell: bash
run: |
mkdir -p output/sdist
tar -xf dist/*.tar.gz -C output/sdist
echo -e '## View source distribution (SDist) contents\n' >> $GITHUB_STEP_SUMMARY
echo -e '```\n' >> $GITHUB_STEP_SUMMARY
(cd output/sdist && tree -a * | sed 's/^/ /' | tee -a $GITHUB_STEP_SUMMARY)
echo -e '\n```\n' >> $GITHUB_STEP_SUMMARY
mkdir -p output/wheel
pipx run wheel unpack dist/*.whl -d output/wheel
echo -e '## View binary distribution (wheel) contents\n' >> $GITHUB_STEP_SUMMARY
echo -e '```\n' >> $GITHUB_STEP_SUMMARY
(cd output/wheel && tree -a * | sed 's/^/ /' | tee -a $GITHUB_STEP_SUMMARY)
echo -e '\n```\n' >> $GITHUB_STEP_SUMMARY