Skip to content

build(deps): bump actions/checkout from 3 to 4 (#89) #245

build(deps): bump actions/checkout from 3 to 4 (#89)

build(deps): bump actions/checkout from 3 to 4 (#89) #245

Workflow file for this run

name: Build
on:
push:
branches:
- master
- devel
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+a[0-9]+'
pull_request:
branches:
- master
- devel
schedule:
# https://crontab.guru/#0_8_*_*_1
- cron: '0 8 * * 1'
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# windows is tested on azure for now
os: [ubuntu-20.04, windows-2019, macos-11]
steps:
- uses: actions/checkout@v4
- name: Install SWIG
if: runner.os == 'Windows'
run: choco install swig -f -y
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Get versions
id: version
run: |
python -m pip install requests
echo "::set-output name=glpk_version::$(python scripts/find_newest_glpk_release.py)"
echo "::set-output name=swigplk_version::$(python scripts/find_swiglpk_version.py)"
- name: Build wheels
uses: joerick/[email protected]
env:
NEW_GLPK_VERSION: ${{ steps.version.outputs.glpk_version }}
GLPK_HEADER_PATH: glpk-${{ steps.version.outputs.glpk_version }}/src
CIBW_ENVIRONMENT_LINUX: GLPK_HEADER_PATH=/include
CIBW_ENVIRONMENT_MACOS: PATH=$PATH:/usr/local/bin LDFLAGS="-L/usr/local/lib $LDFLAGS" LD_LIBRARY_PATH="/usr/local/lib"
# install swig before build in each python environment
# each job runs a python environment so this is equivalent to CIBW_BEFORE_ALL
CIBW_BEFORE_BUILD_LINUX: source {project}/config.sh && pre_build
CIBW_BEFORE_BUILD_MACOS: source {project}/config.sh && IS_OSX=true pre_build
CIBW_BEFORE_BUILD_WINDOWS: rm -rf glpk_build && python scripts/build_glpk.py
CIBW_ARCHS_MACOS: "arm64 x86_64"
CIBW_ARCHS_LINUX: "auto aarch64"
CIBW_SKIP: pp*-win* *-musllinux* cp36-*_aarch64 cp37-*_aarch64 pp*-*_aarch64
# install before tests
CIBW_TEST_COMMAND: cp {project}/test_swiglpk.py . && python test_swiglpk.py
CIBW_TEST_SKIP: "*_arm64"
- uses: actions/upload-artifact@v3
name: wheels
with:
name: wheels
path: ./wheelhouse/*.whl
build_sdist:
name: Build the source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Get GLPK version
id: version
run: |
python -m pip install requests
echo "::set-output name=glpk_version::$(python scripts/find_newest_glpk_release.py)"
- name: Install systems dependencies
run: sudo apt install libgmp-dev swig wget
- name: Download and unpack GLPK
env:
NEW_GLPK_VERSION: ${{ steps.version.outputs.glpk_version }}
run: |
wget "http://ftp.gnu.org/gnu/glpk/glpk-$NEW_GLPK_VERSION.tar.gz"
tar -xf glpk-$NEW_GLPK_VERSION.tar.gz
- name: Build source distribution
env:
NEW_GLPK_VERSION: ${{ steps.version.outputs.glpk_version}}
run: GLPK_HEADER_PATH=glpk-$NEW_GLPK_VERSION/src python setup.py sdist --dist-dir=./wheelhouse
- uses: actions/upload-artifact@v3
name: sdist
with:
name: sdist
path: ./wheelhouse/*.tar.gz
deploy:
name: Release to Github and deploy to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
# alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Get versions
id: version
run: |
python -m pip install requests
echo "::set-output name=glpk_version::$(python scripts/find_newest_glpk_release.py)"
echo "::set-output name=swigplk_version::$(python scripts/find_swiglpk_version.py)"
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install twine
- uses: actions/download-artifact@v3
with:
name: wheels
path: wheelhouse
- uses: actions/download-artifact@v3
with:
name: sdist
path: wheelhouse
- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run:
twine upload --skip-existing --non-interactive ./wheelhouse/*
- name: Create GitHub release
uses: actions/create-release@v1
if: steps.version.outputs.glpk_version != steps.version.outputs.swigplk_version
env:
# This token is set by gh actions
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body_path: "Release of version ${{ steps.version.glpk_version }}"
draft: false
prerelease: false