-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
111 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,124 @@ | ||
name: Pypi-release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
push: | ||
tags: | ||
- v0.1.0 | ||
# release: | ||
# types: [published] | ||
|
||
jobs: | ||
linux: | ||
setup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: messense/maturin-action@v1 | ||
with: | ||
manylinux: auto | ||
command: build | ||
args: --release -o dist | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wheels | ||
path: dist | ||
|
||
windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: messense/maturin-action@v1 | ||
with: | ||
command: build | ||
args: --release --no-sdist -o dist | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wheels | ||
path: dist | ||
- name: Check version | ||
run: | | ||
latest=$(git tag -l | tail -1) | ||
cargo_v=$(grep -m 1 -oP 'version = "(.*)"' Cargo.toml | sed -rn 's/.*"(.*)"/v\1/p') | ||
pyproject_v=$(grep -m 1 -oP 'version = "(.*)"' pyproject.toml | sed -rn 's/.*"(.*)"/v\1/p') | ||
macos: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: messense/maturin-action@v1 | ||
with: | ||
command: build | ||
args: --release --no-sdist -o dist --universal2 | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wheels | ||
path: dist | ||
if [ ! $latest = $cargo_v ]; then | ||
exit 1 | ||
elif [ ! $latest = $pyproject_v ]; then | ||
exit 2 | ||
fi | ||
exit 0 | ||
release: | ||
name: Release | ||
linux: | ||
runs-on: ubuntu-latest | ||
if: "startsWith(github.ref, 'refs/tags/')" | ||
needs: [ macos, windows, linux ] | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.7", "3.8", "3.9", "3.10"] | ||
|
||
steps: | ||
- uses: actions/download-artifact@v2 | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install rust stable | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
name: wheels | ||
- uses: actions/setup-python@v2 | ||
toolchain: stable | ||
|
||
- name: Install Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.9" | ||
- name: Publish to PyPI | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
run: | | ||
pip install --upgrade twine | ||
twine upload --skip-existing * | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install maturin | ||
run: pip install maturin | ||
|
||
- name: Build wheel | ||
run: maturin build --release -o dist --target x86_64-unknown-linux-gnu | ||
|
||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wheels | ||
path: dist | ||
|
||
# linux: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - name: openssl? | ||
# run: export OPENSSL_DIR=$(which openssl) | ||
# - uses: messense/maturin-action@v1 | ||
# with: | ||
# manylinux: 2014 | ||
# command: build | ||
# args: --release -o dist | ||
# - name: Upload wheels | ||
# uses: actions/upload-artifact@v2 | ||
# with: | ||
# name: wheels | ||
# path: dist | ||
|
||
# windows: | ||
# runs-on: windows-latest | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - uses: messense/maturin-action@v1 | ||
# with: | ||
# command: build | ||
# args: --release --no-sdist -o dist | ||
# - name: Upload wheels | ||
# uses: actions/upload-artifact@v2 | ||
# with: | ||
# name: wheels | ||
# path: dist | ||
|
||
# macos: | ||
# runs-on: macos-latest | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - uses: messense/maturin-action@v1 | ||
# with: | ||
# command: build | ||
# args: --release --no-sdist -o dist --universal2 | ||
# - name: Upload wheels | ||
# uses: actions/upload-artifact@v2 | ||
# with: | ||
# name: wheels | ||
# path: dist | ||
|
||
# release: | ||
# name: Release | ||
# runs-on: ubuntu-latest | ||
# if: "startsWith(github.ref, 'refs/tags/')" | ||
# needs: [ macos, windows, linux, setup ] | ||
# steps: | ||
# - uses: actions/download-artifact@v2 | ||
# with: | ||
# name: wheels | ||
# - uses: actions/setup-python@v2 | ||
# with: | ||
# python-version: "3.9" | ||
# - name: Publish to PyPI | ||
# env: | ||
# TWINE_USERNAME: __token__ | ||
# TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
# run: | | ||
# pip install --upgrade twine | ||
# twine upload --skip-existing * |