Skip to content

Commit

Permalink
Merge pull request #57 from cair/github-actions
Browse files Browse the repository at this point in the history
GitHub actions
  • Loading branch information
perara authored Dec 14, 2023
2 parents 0fbea84 + ce008fd commit f38bd44
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 69 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
release:
types:
- created
- published

jobs:
build_wheels:
Expand All @@ -28,83 +29,25 @@ jobs:
run: python -m cibuildwheel --output-dir wheelhouse

#- name: Prefix wheels with branch name
# if: startsWith(github.ref, 'refs/heads/')
# run: |
# BRANCH_NAME=$(echo "${{ github.ref }}" | sed -r "s/^refs\/heads\///")
# for wheel in wheelhouse/*.whl; do
# mv "$wheel" "wheelhouse/${BRANCH_NAME}-$(basename $wheel)"
# branchName=${GITHUB_REF/refs\/heads\//}
# for file in wheelhouse/*.whl; do
# newName="${branchName}-$(basename $file)"
# mv "$file" "wheelhouse/$newName"
# 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
}
# 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 +58,6 @@ jobs:
name: wheels
path: wheelhouse


- name: Checkout gh-pages branch
uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -151,3 +93,58 @@ 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
if: github.event_name == 'release' && github.event.action == 'created'

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
if: github.event_name == 'release' && github.event.action == 'created'

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
24 changes: 21 additions & 3 deletions 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 Expand Up @@ -105,10 +124,9 @@ musllinux-s390x-image = "musllinux_1_1"

[tool.cibuildwheel.linux]
before-all = "yum install -y libffi-devel || (apt-get update && apt-get install -y libffi-dev) || (apk --no-cache add libffi-dev)"
repair-wheel-command = "auditwheel repair -w {dest_dir} {wheel}"


#repair-wheel-command = "auditwheel repair -w {dest_dir} {wheel}"

[tool.cibuildwheel.macos]
repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"

Expand Down

0 comments on commit f38bd44

Please sign in to comment.