1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-07-22 10:47:43 +02:00

[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 ] branches: [ master ]
pull_request: pull_request:
branches: [ master ] branches: [ master ]
release:
types:
- published
jobs: 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: trexio_ubuntu:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -43,6 +67,20 @@ jobs:
- name: check Python API - name: check Python API
run: make python-test 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 - name: clean
run: make clean run: make clean

View File

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