Skip to content

v1.0.3

v1.0.3 #35

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python package
on:
push:
branches: [ "main" ]
release:
types: [ published ]
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Set Python release
run: |
PYTHON_VERSION=${{ matrix.python-version }}
echo "PYTHON_RELEASE=${PYTHON_VERSION/./}" >> "$GITHUB_ENV"
- name: Lint with flake8
run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Set up Rust
run: |
cd mystiks_core
rustup toolchain install stable
rustup default stable
rustup update
- name: Set Mystiks version
run: |
RELEASE_NAME=${{ github.event.release.name }}
echo "MYSTIKS_VERSION=${RELEASE_NAME:1}" >> "$GITHUB_ENV"
if: github.event_name == 'release' && github.event.action == 'published'
- name: Update Mystiks Core version
working-directory: ./mystiks_core
run: sed -i "0,/version = \"1.0.0\"/s//version = \"${{ env.MYSTIKS_VERSION }}\"/" Cargo.toml
if: github.event_name == 'release' && github.event.action == 'published'
- name: Compile Mystiks Core
working-directory: ./mystiks_core
run: |
maturin build --release --strip
mv ./target/release/libmystiks_core.so ../mystiks/mystiks_core.cpython-${{ env.PYTHON_RELEASE }}-x86_64-linux-gnu.so
- name: Upload Mystiks Core artifact
uses: actions/upload-artifact@v4
with:
name: mystiks_core.cpython-${{ env.PYTHON_RELEASE }}-x86_64-linux-gnu.so
path: ./mystiks/mystiks_core.cpython-${{ env.PYTHON_RELEASE }}-x86_64-linux-gnu.so
if-no-files-found: error
retention-days: 1
publish:
runs-on: ubuntu-latest
needs: [ build-linux ]
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: 3.11
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Set Mystiks version
run: |
RELEASE_NAME="${{ github.event.release.name }}"
echo "MYSTIKS_VERSION=\"${RELEASE_NAME:1}\"" >> "$GITHUB_ENV"
if: github.event_name == 'release' && github.event.action == 'published'
- name: Update Mystiks version
run: sed -i "0,/version='1.0.0'/s//version='${{ env.MYSTIKS_VERSION }}'/" setup.py
if: github.event_name == 'release' && github.event.action == 'published'
- name: Download Mystiks Core (cpython-310-x86_64-linux-gnu.so)
uses: actions/download-artifact@v4
with:
name: mystiks_core.cpython-310-x86_64-linux-gnu.so
- name: Move Mystiks Core (cpython-310-x86_64-linux-gnu.so)
run: mv mystiks_core.cpython-310-x86_64-linux-gnu.so ./mystiks/mystiks_core.cpython-310-x86_64-linux-gnu.so
- name: Download Mystiks Core (cpython-311-x86_64-linux-gnu.so)
uses: actions/download-artifact@v4
with:
name: mystiks_core.cpython-311-x86_64-linux-gnu.so
- name: Move Mystiks Core (cpython-311-x86_64-linux-gnu.so)
run: mv mystiks_core.cpython-311-x86_64-linux-gnu.so ./mystiks/mystiks_core.cpython-311-x86_64-linux-gnu.so
- name: Build the package
run: python -m build
- name: Upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*
if: github.event_name == 'release' && github.event.action == 'published'
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: distribution
path: ./dist/*
if-no-files-found: error
retention-days: 90