Skip to content

Commit

Permalink
feat(maturin): Add maturin for building.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronmussig committed Jul 16, 2024
1 parent 8e88699 commit 64c955b
Show file tree
Hide file tree
Showing 9 changed files with 380 additions and 84 deletions.
152 changes: 152 additions & 0 deletions .github/workflows/build-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
name: Version, build, publish

on:
push:
branches:
- dev

jobs:

semantic_release_next_version:
name: Next version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: npm
node-version: lts
- run: npm install
- run: npx semantic-release --dry-run
id: semantic_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: semantic-release-dev
path: |
Cargo.toml
pyproject.toml
retention-days: 1
outputs:
version: ${{ steps.semantic_release.outputs.version }}

test_rust:
name: Build Rust
needs: semantic_release_next_version
if: needs.semantic_release_next_version.outputs.version != ''
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- run:
cargo test --release --all-features
#
# build_python_wheels:
# name: Python ${{ matrix.pyver }}@${{ matrix.os }}.whl
# needs: semantic_release_next_version
# if: needs.semantic_release_next_version.outputs.version != ''
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ubuntu-20.04, macos-11]
# pyver: [cp38, cp39, cp310, cp311]
# steps:
# - uses: actions/checkout@v4
# - uses: actions/download-artifact@v4
# with:
# name: semantic-release-dev
# - uses: pypa/[email protected]
# env:
# CIBW_BUILD: ${{matrix.pyver}}-*
# - uses: actions/upload-artifact@v3
# with:
# name: pypi
# path: wheelhouse/*.whl
# retention-days: 1
#
# build_python_dist:
# name: Python build *.tar.gz
# runs-on: ubuntu-latest
# needs: semantic_release_next_version
# if: needs.semantic_release_next_version.outputs.version != ''
# steps:
# - uses: actions/checkout@v3
# - uses: actions/download-artifact@v3
# with:
# name: semantic-release-dev
# - name: Build sdist
# run: pipx run build --sdist
# - uses: actions/upload-artifact@v3
# with:
# name: pypi
# path: dist/*.tar.gz
# retention-days: 1
#
# test_python_dist:
# name: Python test *.tar.gz
# runs-on: ubuntu-latest
# needs: build_python_dist
# steps:
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# - uses: actions/download-artifact@v3
# with:
# name: pypi
# path: dist
# - uses: actions/setup-python@v4
# with:
# python-version: '3.10'
# - run: echo "((A:1,B:2):1,(C:1,(D:3,E:4):2):2);" > test.tree
# - run: python -m pip install dendropy
# - run: python -m pip install dist/*.tar.gz
# - run: python -c "from phylodm import PhyloDM; PhyloDM.load_from_newick_path('test.tree')"
#
# semantic_release_publish:
# name: Publish to GitHub
# needs: [test_rust, test_python_dist, build_python_wheels]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# cache: npm
# node-version: 16
# - run: npm install
# - run: npx semantic-release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# upload_pypi:
# name: Publish to PyPI
# needs: [semantic_release_publish]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/download-artifact@v3
# with:
# name: pypi
# path: dist
#
# - uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.PYPI_TOKEN }}
#
# upload_crates:
# name: Publish to crates.io
# needs: [semantic_release_publish]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/download-artifact@v3
# with:
# name: semantic-release-dev
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# - run: cargo publish --allow-dirty --token ${CRATES_TOKEN}
# env:
# CRATES_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/build-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ jobs:
name: Next version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: npm
node-version: 16
node-version: lts
- run: npm install
- run: npx semantic-release --dry-run
id: semantic_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: semantic-release
path: |
Expand Down
166 changes: 166 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
#on:
# push:
# branches:
# - main
# - master
# tags:
# - '*'
# pull_request:
# workflow_dispatch:
#
#permissions:
# contents: read
#
#jobs:
# linux:
# runs-on: ${{ matrix.platform.runner }}
# strategy:
# matrix:
# platform:
# - runner: ubuntu-latest
# target: x86_64
# - runner: ubuntu-latest
# target: x86
# - runner: ubuntu-latest
# target: aarch64
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: 3.x
# - name: Build wheels
# uses: PyO3/maturin-action@v1
# with:
# target: ${{ matrix.platform.target }}
# args: --release --out dist --find-interpreter
# sccache: 'true'
# manylinux: auto
# - name: Upload wheels
# uses: actions/upload-artifact@v4
# with:
# name: wheels-linux-${{ matrix.platform.target }}
# path: dist
#
# musllinux:
# runs-on: ${{ matrix.platform.runner }}
# strategy:
# matrix:
# platform:
# - runner: ubuntu-latest
# target: x86_64
# - runner: ubuntu-latest
# target: x86
# - runner: ubuntu-latest
# target: aarch64
# - runner: ubuntu-latest
# target: armv7
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: 3.x
# - name: Build wheels
# uses: PyO3/maturin-action@v1
# with:
# target: ${{ matrix.platform.target }}
# args: --release --out dist --find-interpreter
# sccache: 'true'
# manylinux: musllinux_1_2
# - name: Upload wheels
# uses: actions/upload-artifact@v4
# with:
# name: wheels-musllinux-${{ matrix.platform.target }}
# path: dist
#
# windows:
# runs-on: ${{ matrix.platform.runner }}
# strategy:
# matrix:
# platform:
# - runner: windows-latest
# target: x64
# - runner: windows-latest
# target: x86
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: 3.x
# architecture: ${{ matrix.platform.target }}
# - name: Build wheels
# uses: PyO3/maturin-action@v1
# with:
# target: ${{ matrix.platform.target }}
# args: --release --out dist --find-interpreter
# sccache: 'true'
# - name: Upload wheels
# uses: actions/upload-artifact@v4
# with:
# name: wheels-windows-${{ matrix.platform.target }}
# path: dist
#
# macos:
# runs-on: ${{ matrix.platform.runner }}
# strategy:
# matrix:
# platform:
# - runner: macos-12
# target: x86_64
# - runner: macos-14
# target: aarch64
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: 3.x
# - name: Build wheels
# uses: PyO3/maturin-action@v1
# with:
# target: ${{ matrix.platform.target }}
# args: --release --out dist --find-interpreter
# sccache: 'true'
# - name: Upload wheels
# uses: actions/upload-artifact@v4
# with:
# name: wheels-macos-${{ matrix.platform.target }}
# path: dist
#
# sdist:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Build sdist
# uses: PyO3/maturin-action@v1
# with:
# command: sdist
# args: --out dist
# - name: Upload sdist
# uses: actions/upload-artifact@v4
# with:
# name: wheels-sdist
# path: dist
#
# release:
# name: Release
# runs-on: ubuntu-latest
# if: "startsWith(github.ref, 'refs/tags/')"
# needs: [linux, musllinux, windows, macos, sdist]
# permissions:
# # Used to upload release artifacts
# contents: write
# steps:
# - uses: actions/download-artifact@v4
# - name: Publish to PyPI
# uses: PyO3/maturin-action@v1
# env:
# MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
# with:
# command: upload
# args: --non-interactive --skip-existing wheels-*/*
# - name: Upload to GitHub Release
# uses: softprops/action-gh-release@v1
# with:
# files: |
# wasm-wheels/*.whl
# prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
#
3 changes: 2 additions & 1 deletion .releaserc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"tagFormat": "v${version}",
"branches": [
"main"
"main",
{"name": "dev", "prerelease": true}
],
"plugins": [
"@semantic-release/commit-analyzer",
Expand Down
Loading

0 comments on commit 64c955b

Please sign in to comment.