-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from y-crdt/deployment-workflow
Maturin Deployment Workflow
- Loading branch information
Showing
2 changed files
with
98 additions
and
51 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,70 +1,116 @@ | ||
name: Build | ||
name: Build and Release | ||
|
||
on: [push, pull_request] | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
sdist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
PACKAGE_NAME: y_py | ||
PYTHON_VERSION: "3.8" | ||
|
||
jobs: | ||
macos: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: setup python | ||
uses: actions/setup-python@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.8" | ||
|
||
- name: install dependencies | ||
run: | | ||
pip install --upgrade pip build | ||
- name: build sdist | ||
run: | | ||
python -m build --sdist . | ||
- uses: actions/upload-artifact@v2 | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
architecture: x64 | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
name: sdist | ||
path: "dist/*.tar.gz" | ||
if-no-files-found: error | ||
|
||
- name: Publish to PyPI | ||
if: startsWith(github.ref, 'refs/tags/') | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
echo $PYPI_USERNAME | ||
pip install twine | ||
python -m twine upload --skip-existing dist/*.tar.gz | ||
toolchain: stable | ||
profile: minimal | ||
default: true | ||
- name: Build wheels - x86_64 | ||
uses: messense/maturin-action@v1 | ||
with: | ||
target: x86_64 | ||
args: --release --out dist | ||
- name: Build wheels - universal2 | ||
uses: messense/maturin-action@v1 | ||
with: | ||
args: --release --universal2 --out dist --no-sdist | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wheels | ||
path: dist | ||
|
||
wheel: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
windows: | ||
runs-on: windows-latest | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
|
||
env: | ||
CIBW_BEFORE_ALL_LINUX: "curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y" | ||
CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"' | ||
CIBW_SKIP: "cp27-* cp34-* cp35-* cp36-* pp* *-win32 *-musllinux*" | ||
|
||
target: [x64, x86] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
architecture: ${{ matrix.target }} | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
default: true | ||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
|
||
- uses: actions/upload-artifact@v2 | ||
uses: messense/maturin-action@v1 | ||
with: | ||
target: ${{ matrix.target }} | ||
args: --release --out dist --no-sdist | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: ./wheelhouse/* | ||
if-no-files-found: error | ||
name: wheels | ||
path: dist | ||
|
||
- name: Publish wheels to PyPI | ||
if: startsWith(github.ref, 'refs/tags/') | ||
linux: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
target: [x86_64, i686] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
architecture: x64 | ||
- name: Build wheels | ||
uses: messense/maturin-action@v1 | ||
with: | ||
target: ${{ matrix.target }} | ||
manylinux: auto | ||
args: --release --out dist --no-sdist | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wheels | ||
path: dist | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
needs: | ||
- macos | ||
- windows | ||
- linux | ||
if: startsWith(github.ref, 'refs/tags/') | ||
steps: | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: wheels | ||
- uses: actions/setup-python@v2 | ||
- name: Publish to PyPi | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
pip install twine | ||
python -m twine upload --skip-existing ./wheelhouse/* | ||
pip install --upgrade twine | ||
twine upload --skip-existing * |
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 |
---|---|---|
|
@@ -9,3 +9,4 @@ Cargo.lock | |
docs/_* | ||
.DS_Store | ||
*.pyc | ||
dist |