Update manual_build.sh #214
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: CI | |
on: | |
push: | |
pull_request: | |
jobs: | |
build: | |
strategy: | |
matrix: | |
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: | | |
3.12 | |
3.11 | |
3.10 | |
3.9 | |
3.8 | |
- name: Discover python | |
run: | | |
echo "PYTHONS=$(python .github/workflows/pydiscovery.py --min-version 3.8 --delimiter ' ' --root-dir ${{ runner.tool_cache }}/Python)" >> "$GITHUB_ENV" | |
- name: Cache Rust target directory | |
uses: actions/cache@v3 | |
with: | |
key: ${{ runner.os }} | |
path: | | |
~/.cargo | |
target | |
- name: Run Cargo test | |
if: "startsWith(matrix.platform, 'ubuntu')" | |
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: > | |
-o dist -i ${{ env.PYTHONS }} | |
--release ${{ startsWith(matrix.platform, 'ubuntu') && '--sdist' || '' }} | |
${{ startsWith(matrix.platform, 'macos') && '--target universal2-apple-darwin' || '' }} | |
- name: Run Python test | |
if: "!startsWith(matrix.platform, 'windows')" | |
run: | | |
python -c "import subprocess, glob, os; file = glob.glob(os.path.join('dist', '*cp38*.whl'))[0]; subprocess.check_output(['pip', 'install', file])" | |
pip install pytest | |
mv hugedict hugedict2 | |
pytest -xs tests/ | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ matrix.platform }} | |
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/cp38-cp38/bin \ | |
-e PYTHON_HOME=/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@v4 | |
with: | |
name: wheels-manylinux | |
path: dist | |
release: | |
name: Release PyPI.org | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/heads/dev-ci') | |
needs: [build] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: wheels-manylinux | |
path: dist | |
- uses: actions/download-artifact@v4 | |
with: | |
name: wheels-ubuntu-22.04 | |
path: dist | |
- uses: actions/download-artifact@v4 | |
with: | |
name: wheels-macos-12 | |
path: dist | |
- uses: actions/download-artifact@v4 | |
with: | |
name: wheels-windows-2022 | |
path: dist | |
- name: release | |
run: | | |
pip install twine --break-system-packages | |
twine upload --skip-existing dist/* -u $PYPI_USER -p $PYPI_PWD | |
env: | |
PYPI_USER: __token__ | |
PYPI_PWD: ${{ secrets.PYPI_TOKEN }} |