Skip to content

cmake/xplatform builds using github/tox/conda workflows #31

cmake/xplatform builds using github/tox/conda workflows

cmake/xplatform builds using github/tox/conda workflows #31

Workflow file for this run

name: ci
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
- develop
paths-ignore:
- '**.md'
- '**.rst'
- '**.sh'
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
python-version: ['3.10']
name: [
windows-2019-cl,
ubuntu-20.04-gcc,
ubuntu-20.04-clang,
ubuntu-22.04-clang,
macOS-11-gcc,
macOS-11-clang,
]
include:
- name: windows-2019-cl
os: windows-2019
compiler: cl
- name: ubuntu-20.04-gcc
os: ubuntu-20.04
compiler: gcc
version: "11"
toxcmd: soname,tests
- name: ubuntu-20.04-clang
os: ubuntu-20.04
compiler: clang
version: "10"
toxcmd: clang
- name: ubuntu-22.04-clang
os: ubuntu-22.04
compiler: clang
version: "12"
toxcmd: build
- name: macOS-11-gcc
os: macOS-11
compiler: gcc
version: "11"
toxcmd: abc,tests
- name: macOS-11-clang
os: macOS-11
compiler: xcode
version: "12.4"
toxcmd: "base -- Xcode"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1
if: runner.os == 'Windows'
- name: Install Tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Install and setup Linux packages
if: runner.os == 'Linux'
run: |
sudo apt-get -y -qq update
sudo apt-get install -y libreadline-dev ncurses-dev
if [ "${{ matrix.compiler }}" = gcc ]; then
sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
else
sudo apt-get install -y clang-${{ matrix.version }} llvm-${{ matrix.version }} lld-${{ matrix.version }} g++-multilib
echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV
fi
- name: Build and test Linux
if: runner.os == 'Linux'
env:
CC: ${{ env.CC }}
CXX: ${{ env.CXX }}
PREFIX: ../staging
run: |
tox -e ${{ matrix.toxcmd }}
- uses: actions/upload-artifact@v3
if: matrix.name == 'ubuntu-20.04-clang'
with:
name: src_coverage_data
path: |
build/coverage/html
build/coverage/lcov.info
- name: Install and setup MacOS packages
if: runner.os == 'macOS'
run: |
if [ "${{ matrix.compiler }}" = gcc ]; then
brew install gcc@${{ matrix.version }}
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
else
ls -ls /Applications/
sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app
fi
- name: Build and test MacOS
if: runner.os == 'macOS'
run: |
if [ "${{ matrix.compiler }}" = gcc ]; then
CC=${{ env.CC }} CXX=${{ env.CXX }} tox -e ${{ matrix.toxcmd }}
else
tox -e ${{ matrix.toxcmd }}
fi
- name: Configure Windows
if: runner.os == 'Windows'
run: >
cmake -S . -B build
-DBUILD_SHARED_LIBS=ON
-DABC_USE_NO_PTHREADS=ON
-DABC_USE_NO_READLINE=ON
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=${{ env.PREFIX }}
env:
CC: cl
CXX: cl
PREFIX: staging
- name: Build Windows
if: runner.os == 'Windows'
run: cmake --build build --config Release -j 2 --target install
- name: Test Windows
if: runner.os == 'Windows'
run: |
ctest -V -C Release --test-dir build/
ls -lh staging/ || true