Skip to content

Commit

Permalink
test [wheel]
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizhang committed May 2, 2024
1 parent 57c7afe commit dea0b00
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 64 deletions.
37 changes: 34 additions & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,37 @@ jobs:
needs: check-for-new-commits
if : ${{ needs.check-for-new-commits.outputs.NEW_COMMITS == 'true' }}
uses: kaizhang/SnapATAC2/.github/workflows/wheels.yml@main
with:
wheel: 'true'
nightly: 'true'

publish:
needs: build-wheel
runs-on: ubuntu-latest
permissions:
id-token: write
if: ${{ startsWith(github.ref, 'refs/tags') }}
steps:
- name: Download wheel files from artifacts
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: wheels.yml
commit: ${{ github.event.workflow_run.head_sha }}
name: dist
path: dist

- name: Delete Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view nightly > /dev/null 2>&1; then
gh release delete nightly -y --cleanup-tag
fi
- name: Create nightly release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
tag: nightly
name: Nightly Release
prerelease: true
removeArtifacts: true
artifacts: "dist/*.whl,dist/*.tar.gz"
42 changes: 30 additions & 12 deletions .github/workflows/test_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,38 @@ jobs:
path: ./wheel_files/snapatac2*.whl

build-wheel:
needs: build-and-test
if: ${{ startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[wheel]') }}
uses: kaizhang/SnapATAC2/.github/workflows/wheels.yml@main
with:
wheel: 'true'

build-docker:
needs: [build-and-test, build-wheel]
if: ${{ startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[docker]') }}
publish:
needs: build-wheel
runs-on: ubuntu-latest
permissions:
id-token: write
#if: ${{ startsWith(github.ref, 'refs/tags') }}
steps:
- name: Docker
uses: ./.github/actions/build-docker-image
with:
snapatac2-version: ${{ needs.build-and-test.outputs.VERSION }}
python-version: 3.11
username: ${{ secrets.dockerhub_username }}
password: ${{ secrets.dockerhub_token }}
- name: Download wheel files from artifacts
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: wheels.yml
commit: ${{ github.event.workflow_run.head_sha }}
name: dist
path: dist

- name: Publish to PyPI
uses: pypa/[email protected]

# build-docker:
# needs: [build-and-test, build-wheel]
# if: ${{ startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[docker]') }}
# runs-on: ubuntu-latest
# steps:
# - name: Docker
# uses: ./.github/actions/build-docker-image
# with:
# snapatac2-version: ${{ needs.build-and-test.outputs.VERSION }}
# python-version: 3.11
# username: ${{ secrets.dockerhub_username }}
# password: ${{ secrets.dockerhub_token }}
52 changes: 4 additions & 48 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@
# distribution to PyPI.
name: build-wheels
on:
workflow_call:
inputs:
wheel:
required: false
type: string
nightly:
required: false
type: string
workflow_call

jobs:
build_wheels:
name: Wheel on ${{ matrix.os }} for ${{ matrix.python_version }}
Expand Down Expand Up @@ -78,43 +72,5 @@ jobs:

- uses: actions/upload-artifact@v3
with:
path: snapatac2-python/target/wheels/*.tar.gz

publish:
needs: [build_wheels, make_sdist]
runs-on: ubuntu-latest
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || inputs.nightly
steps:
- uses: actions/checkout@v4

- name: Delete Release
if: inputs.nightly
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view nightly > /dev/null 2>&1; then
gh release delete nightly -y --cleanup-tag
fi
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- name: Publish to PyPI
uses: pypa/[email protected]
if: startsWith(github.ref, 'refs/tags')
with:
user: __token__
password: ${{ secrets.pypi_password }}

- name: Create nightly release
uses: ncipollo/release-action@v1
if: inputs.nightly
with:
allowUpdates: true
tag: nightly
name: Nightly Release
prerelease: true
removeArtifacts: true
artifacts: "dist/*.whl,dist/*.tar.gz"
name: dist
path: snapatac2-python/target/wheels/*.tar.gz
2 changes: 1 addition & 1 deletion snapatac2-python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ features = ["extension-module", "anyhow"]

[lib]
name = "snapatac2"
crate-type = ["cdylib"]
crate-type = ["cdylib"]

0 comments on commit dea0b00

Please sign in to comment.