Skip to content

Update download code #248

Update download code

Update download code #248

Workflow file for this run

name: CI
on:
push:
pull_request:
jobs:
build:
strategy:
matrix:
python: ["3.10", "3.11", "3.12"]
platform: ["ubuntu-22.04", "macos-12", "windows-2022"]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Cache Rust target directory
uses: actions/cache@v3
with:
key: ${{ runner.os }}
path: |
~/.cargo
target
- name: Run test
if: matrix.python == '3.10'
run: cargo test --no-default-features --features pyo3/auto-initialize
- uses: messense/maturin-action@v1
env:
MACOSX_DEPLOYMENT_TARGET: 10.14
with:
command: build
args: --release ${{ startsWith(matrix.platform, 'ubuntu') && startsWith(matrix.python, '3.10') && '--sdist' || '' }} -o dist -i python ${{ startsWith(matrix.platform, 'macos') && '--target universal2-apple-darwin' || '' }}
- name: Run test
if: matrix.python == '3.10' && !startsWith(matrix.platform, 'windows')
run: |
mv kgdata kgdata2
python -c "import subprocess, glob, os; file = glob.glob(os.path.join('dist', '*cp310*.whl'))[0]; subprocess.check_output(['pip', 'install', file + '[spark]'])"
pip install pytest
pytest -xs tests/
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist
build-manylinux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache Rust target directory
uses: actions/cache@v3
with:
key: ${{ runner.os }}-manylinux
path: target
- name: Build wheels
run: |
docker run --rm -w /project -v $(pwd):/project \
-e EXTRA_PATH=/opt/python/cp310-cp310/bin \
-e PYTHON_HOMES=/opt/python \
-e CARGO_NET_GIT_FETCH_WITH_CLI=false \
quay.io/pypa/manylinux2014_x86_64:latest \
bash /project/.github/workflows/build.sh -t x86_64-unknown-linux-gnu
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist
release-crate:
name: Release Crates.io
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/heads/dev-ci')
needs: [build, build-manylinux]
steps:
- uses: actions/checkout@v3
- name: Publish to Crates
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}
run: |
cargo publish --dry-run
cargo publish --no-verify || echo 'crate is already published'
release-pypi:
name: Release PyPI.org
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/heads/dev-ci')
needs: [build, build-manylinux]
steps:
- uses: actions/download-artifact@v2
with:
name: wheels
- name: Publish to PyPI
uses: messense/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
with:
command: upload
args: --skip-existing *