CD #16
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: | |
pull_request: | |
push: | |
branches: | |
- main | |
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: | |
strategy: | |
fail-fast: false | |
name: Windows wheels | |
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.x' | |
cache: false | |
check-latest: true | |
- name: Install MinGW compiler(s) | |
run: choco install mingw | |
- uses: pypa/cibuildwheel@v2.16.2 | |
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_wheels: | |
strategy: | |
fail-fast: false | |
name: Linux wheels | |
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: Install GCC | |
run: sudo apt-get install gcc | |
- uses: pypa/cibuildwheel@v2.16.2 | |
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.5.linux-amd64.tar.gz && | |
mkdir go_installed && | |
tar -C go_installed/ -xzf go1.21.5.linux-amd64.tar.gz && | |
export PATH="go_installed/go/bin:$PATH" && | |
go version | |
CIBW_ENVIRONMENT_LINUX: PATH=go_installed/go/bin:$PATH | |
CIBW_ENVIRONMENT_PASS_LINUX: > | |
PATH | |
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_wheels | |
path: ./wheelhouse/*.whl | |
if-no-files-found: error | |
macos_x86_64_wheels: | |
strategy: | |
fail-fast: false | |
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.x' | |
cache: false | |
check-latest: true | |
- uses: pypa/cibuildwheel@v2.16.2 | |
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: | |
strategy: | |
fail-fast: false | |
name: macOS wheels (arm64) | |
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.x' | |
cache: false | |
check-latest: true | |
- uses: pypa/cibuildwheel@v2.16.2 | |
with: | |
package-dir: . | |
output-dir: wheelhouse | |
env: | |
CIBW_ARCHS_MACOS: arm64 | |
# These are needed to build arm64 binaries on x86_64 macOS | |
CIBW_ENVIRONMENT_MACOS: > | |
GOARCH="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/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, 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 sdist windows_wheels/* 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/ |