Skip to content

Build and publish

Build and publish #39

Workflow file for this run

name: Build and publish
on:
release:
types: [published]
jobs:
deploy-windows:
runs-on: windows-2019
strategy:
matrix:
python-major-version: [3]
python-minor-version: [6, 7, 8, 9, 10, 11, 12]
env:
python-version: ${{ format('{0}.{1}', matrix.python-major-version, matrix.python-minor-version) }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install Poetry
run: |
python -m pip install --upgrade pip
python -m pip install poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.python-version }}
cache: "poetry"
cache-dependency-path: "pyproject.toml"
- name: Upgrade Poetry
if: ${{ matrix.python-minor-version >= 10 }}
run: |
pip install --upgrade poetry
- name: Install dependencies
run: |
poetry install --no-root
- name: Build
run: |
poetry build -v
poetry install --only-root
- name: Check
run: poetry run python -c "import cshogi"
- name: Publish
if: github.event_name == 'release' && github.event.action == 'published'
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: poetry run twine upload dist/*
deploy-manylinux2010:
runs-on: ubuntu-20.04
env:
CC: g++
CXX: g++
strategy:
matrix:
python-version: ["cp36-cp36m", "cp37-cp37m", "cp38-cp38", "cp39-cp39"]
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install Poetry
run: |
python -m pip install --upgrade pip
python -m pip install poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "poetry"
cache-dependency-path: "pyproject.toml"
- name: Install dependencies
run: |
poetry install --no-root
- name: Build
run: |
poetry build -f sdist
tar zvxf ./dist/*.tar.gz -C ./dist
cp $(find ./dist -name setup.py) .
export PYTHON_BIN="/opt/python/${{ matrix.python-version }}/bin"
docker run --rm -v $(pwd):/work \
-w /work quay.io/pypa/manylinux2010_x86_64 \
/bin/sh -c "\
$PYTHON_BIN/pip install numpy==1.19.5 Cython && \
$PYTHON_BIN/python setup.py bdist_wheel && \
cd dist && auditwheel repair *.whl"
- name: Publish
if: github.event_name == 'release' && github.event.action == 'published'
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: poetry run twine upload dist/wheelhouse/*
deploy-manylinux_2_24:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["cp310-cp310", "cp311-cp311"]
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install Poetry
run: |
python -m pip install --upgrade pip
python -m pip install poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "poetry"
cache-dependency-path: "pyproject.toml"
- name: Install dependencies
run: |
poetry install --no-root
- name: Build
run: |
poetry build -f sdist
tar zvxf ./dist/*.tar.gz -C ./dist
cp $(find ./dist -name setup.py) .
export PYTHON_BIN="/opt/python/${{ matrix.python-version }}/bin"
docker run --rm -v $(pwd):/work \
-w /work quay.io/pypa/manylinux_2_24_x86_64 \
/bin/sh -c "\
$PYTHON_BIN/pip install numpy Cython && \
$PYTHON_BIN/python setup.py bdist_wheel && \
cd dist && auditwheel repair *.whl"
- name: Publish
if: github.event_name == 'release' && github.event.action == 'published'
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: poetry run twine upload dist/wheelhouse/*
deploy-manylinux_2_28:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["cp312-cp312"]
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install Poetry
run: |
python -m pip install --upgrade pip
python -m pip install poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "poetry"
cache-dependency-path: "pyproject.toml"
- name: Install dependencies
run: |
poetry install --no-root
- name: Build
run: |
poetry build -f sdist
tar zvxf ./dist/*.tar.gz -C ./dist
cp $(find ./dist -name setup.py) .
export PYTHON_BIN="/opt/python/${{ matrix.python-version }}/bin"
docker run --rm -v $(pwd):/work \
-w /work quay.io/pypa/manylinux_2_28_x86_64 \
/bin/sh -c "\
$PYTHON_BIN/pip install numpy Cython && \
$PYTHON_BIN/python setup.py bdist_wheel && \
cd dist && auditwheel repair *.whl"
- name: Publish
if: github.event_name == 'release' && github.event.action == 'published'
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: poetry run twine upload dist/wheelhouse/*