CD #35
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: CD | |
on: | |
workflow_dispatch: | |
release: | |
types: | |
- published | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
FORCE_COLOR: 3 | |
CIBW_BUILD_VERBOSITY: 2 | |
CIBW_BUILD_FRONTEND: 'pip' | |
CIBW_SKIP: "pp* *musllinux*" | |
jobs: | |
sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install dependencies | |
run: | | |
python -m pip install build | |
- name: Build source distribution | |
run: | | |
python -m build --sdist --outdir dist/ | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: source_distribution | |
path: dist | |
windows_wheels: | |
name: Windows wheels (amd64) | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Set up Go toolchain | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.21.6' | |
cache: false | |
- name: Install MinGW compiler(s) | |
run: choco install mingw | |
- uses: pypa/cibuildwheel@v2.16.5 | |
with: | |
package-dir: . | |
output-dir: wheelhouse | |
env: | |
CIBW_ARCHS_WINDOWS: AMD64 | |
CIBW_TEST_COMMAND: > | |
hugo version | |
hugo env --logLevel debug | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows_wheels | |
path: ./wheelhouse/*.whl | |
if-no-files-found: error | |
linux_amd64_wheels: | |
name: Linux wheels (amd64) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- uses: pypa/cibuildwheel@v2.16.5 | |
with: | |
package-dir: . | |
output-dir: wheelhouse | |
env: | |
CIBW_ARCHS_LINUX: x86_64 | |
CIBW_BEFORE_ALL_LINUX: > | |
yum install -y wget && | |
wget https://golang.org/dl/go1.21.6.linux-amd64.tar.gz && | |
mkdir $HOME/go_installed && | |
tar -C $HOME/go_installed/ -xzf go1.21.6.linux-amd64.tar.gz && | |
export PATH="$HOME/go_installed/go/bin:$PATH" && | |
go version | |
CIBW_ENVIRONMENT_LINUX: PATH=$PATH:$HOME/go_installed/go/bin | |
CIBW_REPAIR_WHEEL_COMMAND_LINUX: '' | |
CIBW_TEST_COMMAND: > | |
hugo version | |
hugo env --logLevel debug | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux_amd64_wheels | |
path: ./wheelhouse/*.whl | |
if-no-files-found: error | |
linux_aarch64_wheels: | |
name: Linux wheels (aarch64) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Set up QEMU for emulation | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- uses: pypa/cibuildwheel@v2.16.5 | |
with: | |
package-dir: . | |
output-dir: wheelhouse | |
env: | |
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_REPAIR_WHEEL_COMMAND_LINUX: '' | |
CIBW_TEST_COMMAND: > | |
hugo version | |
hugo env --logLevel debug | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux_aarch64_wheels | |
path: ./wheelhouse/*.whl | |
if-no-files-found: error | |
repair_linux_wheels: | |
name: Repair Linux wheels | |
runs-on: ubuntu-latest | |
needs: [linux_amd64_wheels, linux_aarch64_wheels] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Download Linux wheels for both architectures | |
uses: actions/download-artifact@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Repair Linux wheels to add conformant platform tags | |
run: | | |
mkdir wheelhouse_amd64 | |
mkdir wheelhouse_aarch64 | |
mkdir repaired_linux_wheels | |
cp linux_amd64_wheels/*.whl wheelhouse_amd64/ | |
cp linux_aarch64_wheels/*.whl wheelhouse_aarch64/ | |
python scripts/ci/tools/linux/repair_wheels.py ./wheelhouse_amd64 ./repaired_linux_wheels | |
python scripts/ci/tools/linux/repair_wheels.py ./wheelhouse_aarch64 ./repaired_linux_wheels | |
- name: Upload repaired Linux wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: repaired_linux_wheels | |
path: ./repaired_linux_wheels/*.whl | |
if-no-files-found: error | |
macos_x86_64_wheels: | |
name: macOS wheels (x86_64) | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Set up Go toolchain | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.21.6' | |
cache: false | |
check-latest: true | |
- uses: pypa/cibuildwheel@v2.16.5 | |
with: | |
package-dir: . | |
output-dir: wheelhouse | |
env: | |
CIBW_ARCHS_MACOS: x86_64 | |
CIBW_REPAIR_WHEEL_COMMAND_MACOS: '' | |
CIBW_TEST_COMMAND: > | |
hugo version | |
hugo env --logLevel debug | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos_x86_64_wheels | |
path: ./wheelhouse/*.whl | |
if-no-files-found: error | |
macos_arm64_wheels: | |
name: macOS wheels (arm64) | |
runs-on: macos-14 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Set up Go toolchain | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.21.6' | |
cache: false | |
check-latest: true | |
- uses: pypa/cibuildwheel@v2.16.5 | |
with: | |
package-dir: . | |
output-dir: wheelhouse | |
env: | |
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9" | |
CIBW_ARCHS_MACOS: arm64 | |
CIBW_REPAIR_WHEEL_COMMAND_MACOS: '' | |
CIBW_TEST_COMMAND: > | |
hugo version | |
hugo env --logLevel debug | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos_arm64_wheels | |
path: ./wheelhouse/*.whl | |
if-no-files-found: error | |
combined_macos_wheels: | |
name: Combine macOS wheels | |
runs-on: macos-latest | |
needs: [macos_x86_64_wheels, macos_arm64_wheels] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Download macOS wheels for both architectures | |
uses: actions/download-artifact@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Combine macOS wheels | |
run: | | |
mkdir wheelhouse_arm64 | |
mkdir wheelhouse_x86_64 | |
mkdir wheelhouse_universal2 | |
cp macos_x86_64_wheels/*.whl wheelhouse_x86_64/ | |
cp macos_arm64_wheels/*.whl wheelhouse_arm64/ | |
python -m pip install delocate | |
python scripts/ci/tools/macos/fuse_wheels.py ./wheelhouse_x86_64 ./wheelhouse_arm64 ./wheelhouse_universal2 | |
- name: Upload combined macOS wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: combined_macos_wheels | |
path: ./wheelhouse_universal2/*.whl | |
if-no-files-found: error | |
publish: | |
needs: [sdist, windows_wheels, repair_linux_wheels, combined_macos_wheels] | |
name: Publish to PyPI or TestPyPI | |
environment: release | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
- name: Move all artifacts to upload directory | |
run: | | |
mkdir upload | |
mv source_distribution/* windows_wheels/* repaired_linux_wheels/* combined_macos_wheels/* upload/ | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
if: github.event_name == 'release' && github.event.action == 'published' | |
with: | |
# Remember to tell (test-)pypi about this repo before publishing | |
# Remove this line to publish to PyPI | |
# repository-url: https://test.pypi.org/legacy/ | |
packages-dir: upload |