Add support for a C++ test suite #239
Workflow file for this run
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: Continuous Integration | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
pull_request: | |
schedule: | |
- cron: '30 2 * * 1,4' # Every Monday and Thursday @ 2h30am UTC | |
env: | |
VCPKG_INSTALLED_DIR: /tmp/vcpkg_installed | |
ARTIFACT_NAME: distribution | |
jobs: | |
build-sdist: | |
name: Build Source Distribution | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
strategy: | |
matrix: | |
python: ["3.8"] | |
steps: | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Upgrade pip and install build | |
run: python -m pip install -U pip build | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
- name: Build source distribution | |
run: python -m build --sdist | |
- name: Upload wheel artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: ./dist/*.tar.gz | |
cpp-tests: | |
name: Execute C++ test cases | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
- name: Install C++ Compiler and cmake | |
run: | | |
sudo apt update | |
sudo apt install build-essential cmake | |
- name: Get Github Action Cache Variables | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
- name: Build shared library | |
run: | | |
cmake -S . -B build | |
cmake --build build | |
- name: Run test cases | |
run: cd build && ctest | |
build-wheels: | |
name: Build and Test Binary Wheels | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
strategy: | |
fail-fast: false | |
matrix: | |
# https://peps.python.org/pep-0425 | |
python: | |
# python version, cpython tag | |
- ["3.8", "cp38"] | |
- ["3.9", "cp39"] | |
- ["3.10", "cp310"] | |
- ["3.11", "cp311"] | |
platform: | |
# platform tag, manylinux tag, vcpkg triplet | |
- [manylinux_x86_64, manylinux_2_28, x64-linux-dynamic-cxx17-abi1-rel] | |
steps: | |
- name: Set up Python ${{ matrix.python[0] }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python[0] }} | |
- name: Upgrade pip and install virtualenv | |
run: python -m pip install -U pip virtualenv | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
- name: Get Github Action Cache Variables | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
- name: Run cibuildwheel | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: ${{ matrix.python[1] }}-${{ matrix.platform[0] }} | |
CIBW_BUILD_FRONTEND: build | |
CIBW_BEFORE_ALL_LINUX: yum install -y zip flex bison gcc-gfortran | |
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/${{ matrix.platform[1] }}_x86_64 | |
CIBW_ENVIRONMENT_LINUX: > | |
ACTIONS_CACHE_URL=${{ env.ACTIONS_CACHE_URL }} | |
ACTIONS_RUNTIME_TOKEN=${{ env.ACTIONS_RUNTIME_TOKEN }} | |
VCPKG_BINARY_SOURCES="clear;x-gha,readwrite" | |
VCPKG_TARGET_TRIPLET=${{ matrix.platform[2] }} | |
VCPKG_INSTALLED_DIR=${{ env.VCPKG_INSTALLED_DIR }} | |
LD_LIBRARY_PATH=${{ env.VCPKG_INSTALLED_DIR }}/${{ matrix.platform[2] }}/lib | |
CIBW_REPAIR_WHEEL_COMMAND_LINUX: > | |
auditwheel repair -w {dest_dir} {wheel} --exclude libarrow_python.so --exclude libarrow.so.1300 | |
CIBW_TEST_EXTRAS: test | |
CIBW_TEST_COMMAND: py.test -s -vvv --pyargs arcae | |
- name: Upload wheel artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: ./wheelhouse/*.whl | |
upload-to-test-pypi: | |
name: Upload release to Test PyPI | |
needs: [build-sdist, build-wheels] | |
runs-on: ubuntu-latest | |
environment: | |
name: release-test | |
permissions: | |
id-token: write | |
steps: | |
- name: Download distribution artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: dist | |
- name: List artifacts | |
run: ls -lh dist | |
- name: Publish package distributions to Test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
continue-on-error: true | |
upload-to-pypi: | |
name: Upload release to PyPI | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
needs: [build-sdist, build-wheels] | |
runs-on: ubuntu-latest | |
environment: | |
name: release | |
permissions: | |
id-token: write | |
steps: | |
- name: Download distribution artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: dist | |
- name: List artifacts | |
run: ls -lh dist | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |