Skip to content

Commit

Permalink
uname -m ?!
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadair committed Nov 12, 2024
1 parent 04bc7fe commit 3c9cff1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
- run: python -m pip install PyYAML click
- run: echo $LOAD_BUILD_TARGETS_SCRIPT | base64 --decode > load_build_targets.py
env:
LOAD_BUILD_TARGETS_SCRIPT: aW1wb3J0IGpzb24KaW1wb3J0IG9zCmltcG9ydCByZQoKaW1wb3J0IGNsaWNrCmltcG9ydCB5YW1sCgpNQUNISU5FX1RZUEUgPSB7CiAgICAibGludXgiOiAidWJ1bnR1LWxhdGVzdCIsCiAgICAibWFjb3MiOiAibWFjb3MtMTIiLAogICAgIndpbmRvd3MiOiAid2luZG93cy1sYXRlc3QiLAp9Ck0xX1JVTk5FUiA9ICJtYWNvcy0xNCIKCkNJQldfQlVJTEQgPSBvcy5lbnZpcm9uLmdldCgiQ0lCV19CVUlMRCIsICIqIikKQ0lCV19BUkNIUyA9IG9zLmVudmlyb24uZ2V0KCJDSUJXX0FSQ0hTIiwgImF1dG8iKQoKCkBjbGljay5jb21tYW5kKCkKQGNsaWNrLm9wdGlvbigiLS10YXJnZXRzIiwgZGVmYXVsdD0iIikKZGVmIGxvYWRfYnVpbGRfdGFyZ2V0cyh0YXJnZXRzKToKICAgICIiIlNjcmlwdCB0byBsb2FkIGNpYnVpbGR3aGVlbCB0YXJnZXRzIGZvciBHaXRIdWIgQWN0aW9ucyB3b3JrZmxvdy4iIiIKICAgICMgTG9hZCBsaXN0IG9mIHRhcmdldHMKICAgIHRhcmdldHMgPSB5YW1sLmxvYWQodGFyZ2V0cywgTG9hZGVyPXlhbWwuQmFzZUxvYWRlcikKICAgIHByaW50KGpzb24uZHVtcHModGFyZ2V0cywgaW5kZW50PTIpKQoKICAgICMgQ3JlYXRlI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dGFyZ2V0X2FyZ3MucG9wKCJ0YXJnZXQiKQogICAgcmV0dXJuIHsKICAgICAgICAidGFyZ2V0IjogdGFyZ2V0LAogICAgICAgICJydW5zLW9uIjogZ2V0X29zKHRhcmdldCksCiAgICAgICAgIkNJQldfQlVJTEQiOiBnZXRfY2lid19idWlsZCh0YXJnZXQpLAogICAgICAgICJDSUJXX0FSQ0hTIjogZ2V0X2NpYndfYXJjaHModGFyZ2V0KSwKICAgICAgICAiYXJ0aWZhY3QtbmFtZSI6IGdldF9hcnRpZmFjdF9uYW1lKHRhcmdldCksCiAgICAgICAgKipleHRyYV90YXJnZXRfYXJncywKICAgIH0KCgppZiBfX25hbWVfXyA9PSAiX19tYWluX18iOgogICAgbG9hZF9idWlsZF90YXJnZXRzKCkK
- id: set-outputs
run: python load_build_targets.py --targets "${{ inputs.targets }}"
shell: sh
Expand Down Expand Up @@ -144,8 +144,13 @@ jobs:
lfs: true
submodules: ${{ inputs.submodules }}
ref: ${{ inputs.checkout_ref }}
- name: Get machine arch
if: ${{ runner.os == 'Linux' }}
id: uname_m
run: |
echo "uname_m=$(uname -m)" >> "$GITHUB_OUTPUT"
- name: Set up QEMU
if: ${{ matrix.CIBW_ARCHS == 'aarch64' }}
if: ${{ runner.os == 'Linux' && (matrix.CIBW_ARCHS != 'auto' || matrix.CIBW_ARCHS != steps.uname_m.outputs.uname_m) }}
uses: docker/setup-qemu-action@v3
with:
platforms: all
Expand Down
2 changes: 1 addition & 1 deletion tools/load_build_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_cibw_build(target):


def get_cibw_archs(target):
for arch in ["aarch64", "arm64", "universal2"]:
for arch in ["aarch64", "ppc64le", "s390x", "armv7l", "arm64", "universal2"]:
if target.endswith(arch):
return arch
return CIBW_ARCHS
Expand Down

0 comments on commit 3c9cff1

Please sign in to comment.