Preparing for 1.2.2 and updating versions #192
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
name: graspologic-native CI | |
on: [push, pull_request] | |
jobs: | |
codestyle-check: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check format | |
run: | | |
cargo fmt -- --check | |
version: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Materialize build number | |
run: | | |
pip install -U pip | |
pip install toml | |
python .github/build/manifest_version.py packages/pyo3/Cargo.toml version.txt | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cargo-toml | |
path: packages/pyo3/Cargo.toml | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: version-txt | |
path: version.txt | |
build: | |
needs: ['codestyle-check', 'version'] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: cargo-toml | |
path: materialized | |
- name: Materialized Cargo Placement | |
run: | | |
mv materialized/Cargo.toml packages/pyo3/Cargo.toml | |
shell: bash | |
- name: Rust Unittests | |
run: | | |
cargo test --manifest-path packages/network_partitions/Cargo.toml | |
# the following are the actual maturin build actions. each one is different per OS, so rather than copy/paste | |
# the same steps except for the build, we conditionally do one of the builds depending on the os in question | |
# note that windows and mac don't do sdists, but ubuntu does; this is just because we don't need to repeat | |
# ourselves or overwrite the .tar.gz sdist. | |
- uses: PyO3/maturin-action@v1 | |
if: ${{ matrix.os == 'windows-latest' }} | |
name: Maturin Build for Windows | |
with: | |
maturin-version: 1.4.0 | |
command: build | |
target: x64 | |
args: -m packages/pyo3/Cargo.toml --release -i ${{env.pythonLocation}}\python.exe | |
- uses: PyO3/maturin-action@v1 | |
if: ${{ matrix.os == 'macos-latest' }} | |
name: Maturin Build for MacOS | |
with: | |
maturin-version: 1.4.0 | |
command: build | |
target: universal2-apple-darwin | |
args: -m packages/pyo3/Cargo.toml --release | |
- uses: PyO3/maturin-action@v1 | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
name: Maturin Build for Linux | |
with: | |
maturin-version: 1.4.0 | |
command: build | |
target: x64 | |
args: -m packages/pyo3/Cargo.toml --release --sdist | |
manylinux: 2014 | |
- name: Python Unittests | |
run: | | |
cd packages/pyo3 | |
pip install ../../target/wheels/*.whl | |
python -m unittest | |
shell: bash | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.os }} | |
path: | | |
target/wheels/*.whl | |
target/wheels/*.tar.gz | |
publish: | |
runs-on: ubuntu-latest | |
needs: 'build' | |
if: github.ref=='refs/heads/main' || github.ref=='refs/heads/dev' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.12 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist-ubuntu-latest | |
path: dist/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist-windows-latest | |
path: dist/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist-macos-latest | |
path: dist/ | |
- name: Generate SHA256 files for each wheel | |
run: | | |
sha256sum dist/*.whl > checksums.txt | |
sha256sum dist/*.tar.gz >> checksums.txt | |
cat checksums.txt | |
- uses: actions/download-artifact@v4 | |
with: | |
name: version-txt | |
path: version/ | |
- name: Release Tag from Version | |
run: | | |
GRASPOLOGIC_VERSION=$(cat version/version.txt) | |
echo "GRASPOLOGIC_VERSION=$GRASPOLOGIC_VERSION" >> $GITHUB_ENV | |
echo $GRASPOLOGIC_VERSION | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip setuptools wheel twine | |
- name: Publish with twine | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
twine upload dist/* | |
- name: Create Github Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.GRASPOLOGIC_VERSION }} | |
release_name: graspologic-native-${{ env.GRASPOLOGIC_VERSION }} | |
body_path: "checksums.txt" | |
prerelease: github.ref=='refs/heads/dev' | |