Update manifest #40
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
# 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: | |
lint: | |
runs-on: ubuntu-latest | |
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 flake8 | |
- name: Lint with flake8 | |
run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
build: | |
runs-on: ubuntu-latest | |
needs: [ lint ] | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Windows toolchains | |
run: | | |
sudo apt update | |
sudo apt install binutils-mingw-w64-x86-64 gcc-mingw-w64-x86-64 -y | |
- 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 | |
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: Set up Rust | |
run: | | |
cd mystiks_core | |
rustup toolchain install stable | |
rustup default stable | |
rustup update | |
rustup target add x86_64-pc-windows-gnu | |
- 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 for Linux | |
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 for Linux | |
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 | |
- name: Compile Mystiks Core for Windows | |
working-directory: ./mystiks_core | |
run: | | |
maturin build --release --strip --target x86_64-pc-windows-gnu -i ${{ matrix.python-version }} | |
mv ./target/x86_64-pc-windows-gnu/release/mystiks_core.dll ../mystiks/mystiks_core.cp${{ env.PYTHON_RELEASE }}-win_amd64.pyd | |
- name: Upload Mystiks Core artifact for Windows | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mystiks_core.cp${{ env.PYTHON_RELEASE }}-win_amd64.pyd | |
path: ./mystiks/mystiks_core.cp${{ env.PYTHON_RELEASE }}-win_amd64.pyd | |
if-no-files-found: error | |
retention-days: 1 | |
publish: | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
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' | |
# Download and move Mystiks Core for Python 3.10 on Linux | |
- 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 | |
# Download and move Mystiks Core for Python 3.11 on Linux | |
- 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 | |
# Download and move Mystiks Core for Python 3.10 on Windows | |
- name: Download Mystiks Core (cp310-win_amd64.pyd) | |
uses: actions/download-artifact@v4 | |
with: | |
name: mystiks_core.cp310-win_amd64.pyd | |
- name: Move Mystiks Core (cp310-win_amd64.pyd) | |
run: mv mystiks_core.cp310-win_amd64.pyd ./mystiks/mystiks_core.cp310-win_amd64.pyd | |
# Download and move Mystiks Core for Python 3.11 on Windows | |
- name: Download Mystiks Core (cp311-win_amd64.pyd) | |
uses: actions/download-artifact@v4 | |
with: | |
name: mystiks_core.cp311-win_amd64.pyd | |
- name: Move Mystiks Core (cp311-win_amd64.pyd) | |
run: mv mystiks_core.cp311-win_amd64.pyd ./mystiks/mystiks_core.cp311-win_amd64.pyd | |
- 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 |