Skip to content

Commit

Permalink
Work towards better builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
perara committed Dec 14, 2023
1 parent 0fbea84 commit 9c2e38a
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 71 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@ name: Build Wheels
on:
workflow_dispatch:
push:
release:
types:
- created

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-20.04, ubuntu-latest, macos-latest, windows-latest]

steps:
- name: Checkout repository
Expand All @@ -27,84 +24,26 @@ jobs:
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse

#- name: Prefix wheels with branch name
# run: |
# BRANCH_NAME=$(echo "${{ github.ref }}" | sed -r "s/^refs\/heads\///")
# for wheel in wheelhouse/*.whl; do
# mv "$wheel" "wheelhouse/${BRANCH_NAME}-$(basename $wheel)"
# done

- name: Prefix wheels with branch name
if: startsWith(github.ref, 'refs/heads/')
shell: pwsh
run: |
$branchName = "${{ github.ref }}".Replace("refs/heads/", "")
Get-ChildItem -Path wheelhouse -Filter *.whl | ForEach-Object {
$newName = "${branchName}-$($_.Name)"
Rename-Item -Path $_.FullName -NewName $newName
}
branchName=${GITHUB_REF/refs\/heads\//}
for file in wheelhouse/*.whl; do
newName="${branchName}-$(basename $file)"
mv "$file" "wheelhouse/$newName"
done
shell: bash

- uses: actions/upload-artifact@v2
with:
name: wheels
path: wheelhouse/*.whl

publish_wheels_to_release_page:
name: Publish wheels to Release Page
needs: build_wheels
if: github.event_name == 'release' && github.event.action == 'created' && github.event_name == 'disabled'
runs-on: ubuntu-latest

steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: wheels
path: wheelhouse

- name: Get release info
uses: actions/github-script@v5
id: get_release_info
with:
script: |
const { upload_url } = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: context.payload.release.tag_name,
});
return { upload_url: upload_url };
- name: Print upload URL
run: echo "Upload URL is ${{ steps.get_release_info.outputs.upload_url }}"
- name: Upload wheels to release assets
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: wheelhouse/*.whl

publish_wheels_to_pypi:
name: Publish wheels to PyPI
needs: build_wheels
if: github.event_name == 'release' && github.event.action == 'created'
runs-on: ubuntu-latest

steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: wheels
path: wheelhouse

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: wheelhouse


publish_wheels_to_gh_pages:
name: Publish wheels to GitHub Pages
runs-on: ubuntu-latest
needs: build_wheels

steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand All @@ -115,7 +54,6 @@ jobs:
name: wheels
path: wheelhouse


- name: Checkout gh-pages branch
uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -151,3 +89,56 @@ jobs:
git add wheels/*.whl wheels/index.html
git commit -m "Upload wheels to GitHub Pages and update index.html"
git push
publish_wheels_to_pypi:
name: Publish wheels to PyPI
needs: build_wheels
runs-on: ubuntu-latest

steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: wheels
path: wheelhouse

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: wheelhouse


publish_wheels_to_release_page:
name: Publish wheels to Release Page
needs: build_wheels
runs-on: ubuntu-latest

steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: wheels
path: wheelhouse

- name: Get release info
uses: actions/github-script@v5
id: get_release_info
with:
script: |
const { upload_url } = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: context.payload.release.tag_name,
});
return { upload_url: upload_url };
- name: Print upload URL
run: echo "Upload URL is ${{ steps.get_release_info.outputs.upload_url }}"

- name: Upload wheels to release assets
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: wheelhouse/*.whl
21 changes: 20 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,27 @@ include_dir = "tmu/lib/include"

[tool.cibuildwheel]
build = "*"
skip = ["*-win32", "*-manylinux_i686"]
test-skip = ""
skip = [
"pp*",
"*i686*",
#"cp*-manylinux_x86_64",
"cp*-manylinux_i686",
#"cp*-manylinux_aarch64",
"cp*-manylinux_ppc64le",
"cp*-manylinux_s390x",
"cp*-manylinux_pypy_*_x86_64",
"cp*-manylinux_pypy_*_aarch64",
"cp*-win32",
"cp*-win_amd64",
"cp*-linux_x86_64",
"cp*-macosx_x86_64",
#"cp*-macosx_arm64",
"cp*-musllinux_x86_64",
"cp*-musllinux_aarch64",
"cp*-musllinux_ppc64le",
"cp*-musllinux_s390x",
]

archs = ["auto"]
build-frontend = "build"
Expand Down

0 comments on commit 9c2e38a

Please sign in to comment.