[wheel build] test GitHub actions

This commit is contained in:
q-posev 2022-01-07 11:03:00 +01:00
parent 1a5babd403
commit f1e3d34ea4
3 changed files with 71 additions and 40 deletions

View File

@ -5,8 +5,32 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types:
- published
jobs:
get_commit_message:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Get commit message
runs-on: ubuntu-latest
outputs:
message: ${{ steps.commit_message.outputs.message }}
steps:
- name: Checkout the repo
uses: actions/checkout@v2
# Gets the correct commit message for pull request
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Get commit message
id: commit_message
run: |
set -xe
COMMIT_MSG=$(git log --no-merges -1 --oneline)
echo "::set-output name=message::$COMMIT_MSG"
trexio_ubuntu:
runs-on: ubuntu-latest
@ -14,28 +38,28 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: install dependencies
- name: install dependencies
run: |
sudo add-apt-repository ppa:kelleyk/emacs
sudo apt-get install libhdf5-dev emacs26
- name: configure with autotools
run: |
./autogen.sh
./configure --enable-silent-rules
- name: compile TREXIO
run: make -j 2
- name: check TREXIO
run: make check
- name: create virtual environment
run: |
run: |
python3 -m venv --clear pytrexio-venv
source pytrexio-venv/bin/activate
- name: install Python API
run: make python-install
# alternatively we can also run pip install trexio to check PyPI installation
@ -43,6 +67,20 @@ jobs:
- name: check Python API
run: make python-test
- name: build Python API distribution
run: make python-sdist
- name: publish Python API distribution as an artifact
needs: get_commit_message
if: >-
contains(needs.get_commit_message.outputs.message, '[wheel build]') ||
github.event_name == 'release'
uses: actions/upload-artifact@v2
with:
name: pytrexio-source
path: ./trexio-*.tar.gz
working-directory: python/dist
- name: clean
run: make clean
@ -53,23 +91,23 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: |
brew install emacs
brew install hdf5
brew install automake
- name: configure with autotools
run: |
./autogen.sh
./configure FC=gfortran-10 --enable-silent-rules
- name: compile TREXIO
run: make -j 2
- name: check TREXIO
run: make check
- name: clean
run: make clean

View File

@ -1,12 +1,13 @@
# Controls when the workflow will run
on:
# Triggers the workflow on push events but only for the master branch
push:
# run this workflow after the TREXIO CI completed
workflow_run:
workflows: [ "TREXIO CI" ]
branches: [ master ]
release:
types:
- published
- completed
# Workflow to build and publish wheels.
#
# in the get_commit_message job: Include [wheel build] in your commit message to trigger the build.
@ -15,6 +16,7 @@ name: PyPI wheels build
jobs:
get_commit_message:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Get commit message
runs-on: ubuntu-latest
outputs:
@ -56,35 +58,24 @@ jobs:
- name: Install build dependencies
run: python -m pip install -U setuptools
- name: Run SWIG to procude the wrapper code for Python
run: |
swig -python -py3 -o pytrexio_wrap.c pytrexio.i
cp pytrexio.py ../pytrexio/
working-directory: src
- name: Build distribution tarball
run: |
python setup.py sdist
mv ./dist/trexio-*.tar.gz .
- name: Download the Python API distribution tarball
uses: actions/download-artifact@v2
with:
name: pytrexio-source
path: python
- name: Build manylinux wheels
run: |
docker pull ghcr.io/q-posev/hdf5_1_12_on_${{ matrix.manylinux_tag }}:latest
docker run --rm --env PLAT=manylinux${{ matrix.manylinux_tag }} --volume `pwd`:/tmp --workdir /tmp ghcr.io/q-posev/hdf5_1_12_on_${{ matrix.manylinux_tag }} /bin/bash build_manylinux_wheels.sh trexio-*.tar.gz
working-directory: python
- name: Upload produced wheels as artifacts
uses: actions/upload-artifact@v2
with:
name: pytrexio-manylinux-${{ matrix.manylinux_tag }}
path: ./wheelhouse/*.whl
# only upload the source code tarball once
- name: Upload source code tarball as an artifact (only once)
uses: actions/upload-artifact@v2
with:
name: pytrexio-source
path: ./trexio-*.tar.gz
if: ${{ matrix.manylinux_tag == '2014_x86_64' }}
working-directory: python
build_macos_wheels:
@ -126,23 +117,25 @@ jobs:
# it is not possible to set ENV variables conditionally, so we improvise below
run: echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> $GITHUB_ENV
- name: Run SWIG to procude the wrapper code for Python
run: |
swig -python -py3 -o pytrexio_wrap.c pytrexio.i
cp pytrexio.py ../pytrexio/
working-directory: src
- name: Download the Python API distribution tarball
uses: actions/download-artifact@v2
with:
name: pytrexio-source
path: python
- name: Build wheel for a given version of CPython
run: |
source tools/set_NUMPY_INCLUDEDIR.sh
python -m build --wheel --outdir ./
delocate-wheel trexio-*.whl
working-directory: python
- name: Upload produced wheels as artifacts
uses: actions/upload-artifact@v2
with:
name: pytrexio-${{ matrix.os }}
path: ./*.whl
working-directory: python
publish_wheels: