Skip to content

Commit

Permalink
πŸ€– Build wheels for linux/s390x target (#89)
Browse files Browse the repository at this point in the history
* πŸ€– Build for s390x
* 🚧 Add `CIBW_SKIP` environment variable
* πŸ–₯️ Set up s390x wheels for publishing
* βœ… Use `pipx` to run the linter
* πŸ™ Add notes about `s390x` support
* 🚧 Run wheel builder on schedule
  • Loading branch information
agriyakhetarpal committed Apr 26, 2024
1 parent a04cac6 commit fdd88cd
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 36 deletions.
80 changes: 47 additions & 33 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
release:
types:
- published
schedule:
- cron: '0 0 * * 1'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -25,8 +27,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Set up Python 3.12
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: 3.12

Expand All @@ -46,12 +47,7 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: 3.12

- name: Set up Go toolchain
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '1.22.2'
cache: false
Expand All @@ -77,14 +73,10 @@ jobs:
if-no-files-found: error

linux_amd64_wheels:
name: amd64-linux
name: amd64-manylinux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: 3.12

- uses: pypa/cibuildwheel@8d945475ac4b1aac4ae08b2fd27db9917158b6ce # v2.17.0
with:
package-dir: .
Expand All @@ -105,16 +97,11 @@ jobs:
if-no-files-found: error

linux_arm64_wheels:
name: arm64-linux
name: arm64-manylinux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: 3.12

- name: Set up QEMU for emulation
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
with:
platforms: all

Expand All @@ -137,17 +124,48 @@ jobs:
path: ./wheelhouse/*.whl
if-no-files-found: error

linux_s390x_wheels:
name: s390x-manylinux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
with:
platforms: all

- name: Build binary distribution (wheel) on Linux (s390x)
uses: pypa/cibuildwheel@8d945475ac4b1aac4ae08b2fd27db9917158b6ce # v2.17.0
with:
package-dir: .
output-dir: wheelhouse
env:
CIBW_ARCHS_LINUX: s390x
CIBW_BEFORE_ALL_LINUX: |
tarball="go1.22.2.linux-s390x.tar.gz"
curl -LJO https://golang.org/dl/$tarball
mkdir $HOME/go_installed/
tar -C $HOME/go_installed/ -xzf $tarball
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bashrc
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bash_profile
go version
CIBW_ENVIRONMENT_LINUX: PATH=$PATH:$HOME/go_installed/go/bin
CIBW_TEST_COMMAND: >
hugo version
hugo env --logLevel debug
- name: Upload wheels
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: wheels_linux_s390x
path: ./wheelhouse/*.whl
if-no-files-found: error

macos_amd64_wheels:
name: amd64-macos
runs-on: macos-13
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: 3.12

- name: Set up Go toolchain
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '1.22.2'
cache: false
Expand Down Expand Up @@ -176,12 +194,7 @@ jobs:
runs-on: macos-14
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: 3.12

- name: Set up Go toolchain
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '1.22.2'
cache: false
Expand Down Expand Up @@ -212,7 +225,8 @@ jobs:
macos_amd64_wheels,
macos_arm64_wheels,
linux_amd64_wheels,
linux_arm64_wheels
linux_arm64_wheels,
linux_s390x_wheels
]

name: Publish to PyPI or TestPyPI
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ concurrency:
env:
FORCE_COLOR: 3
CIBW_BUILD_VERBOSITY: 2
CIBW_SKIP: "pp* *musllinux*"
CIBW_BUILD_FRONTEND: "pip" # use pip for now, not build – missing buildDate otherwise

jobs:
Expand All @@ -27,7 +28,7 @@ jobs:
python-version: 3.12

- name: Run style checks
run: pipx run nox -s lint
run: pipx run pre-commit run --all-files

check_commit_message:
needs: [style]
Expand Down Expand Up @@ -117,7 +118,7 @@ jobs:
experimental:
needs: [style]
name: ${{ matrix.runs-on }}-${{ matrix.architecture }}-python-${{ matrix.python-version }}
name: zig-${{ matrix.runs-on }}-${{ matrix.architecture }}-python-${{ matrix.python-version }}
env:
CIBW_BUILD_VERBOSITY: 2
runs-on: ${{ matrix.runs-on }}
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ This project provides wheels for [Hugo](https://gohugo.io/) so that it can be us

This project, `hugo` is versioned alongside the Hugo releases and is aligned with the versioning of Hugo itself, which uses `SemVer` – but is likely versioned according to [0ver](https://0ver.org/) software standards based on their [versioning history](https://github.com/gohugoio/hugo/releases).

Binaries for `hugo` through these wheels are available for Hugo versions **0.121.2** and above, through PyPI or through releases on GitHubr. If you need an older version of `hugo` that is not available through this package, please consider using the [official Hugo binaries](https://github.com/gohugoio/hugo/releases).
Binaries for `hugo` through these wheels are available for Hugo versions **0.121.2** and above, through PyPI or through releases on GitHub. If you need an older version of `hugo` that is not available through this package, please consider using the [official Hugo binaries](https://github.com/gohugoio/hugo/releases).

Please refer to the section on [Supported platforms](#supported-platforms) for a list of wheels available for supported platforms and architectures. If it does, jump to the [Quickstart](#quickstart) section to get started.

Expand Down Expand Up @@ -120,6 +120,7 @@ A subset of the platforms supported by Hugo itself are supported by these wheels
| macOS | arm64 (Silicon) | βœ… |
| Linux | amd64 | βœ… |
| Linux | arm64 | βœ… |
| Linux | s390x | βœ… |
| Windows | x86_64 | βœ… |
| Windows | arm64 | πŸ’‘ Experimental support [^1] |
| Windows | x86 | πŸ’‘ Experimental support [^1] |
Expand Down
1 change: 1 addition & 0 deletions hugo/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"AMD64": "amd64",
"aarch64": "arm64",
"x86": "386",
"s390x": "s390x",
}[machine()]

# platform.machine returns AMD64 on Windows because the architecture is
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"AMD64": "amd64",
"aarch64": "arm64",
"x86": "386",
"s390x": "s390x",
}[platform.machine()]

# Name of the Hugo binary that will be built
Expand Down

0 comments on commit fdd88cd

Please sign in to comment.