Skip to content

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

cmake/xplatform builds using github/tox/conda workflows

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

name: Build Posix CMake
on:
push:
pull_request:
jobs:
build-posix-cmake:
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
use_namespace: [false, true]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
env:
CMAKE_ARGS: ${{ matrix.use_namespace && '-DABC_USE_NAMESPACE=xxx' || '' }}
DEMO_ARGS: ${{ matrix.use_namespace && '-DABC_NAMESPACE=xxx' || '' }}
DEMO_GCC: ${{ matrix.use_namespace && 'g++ -x c++' || 'gcc' }}
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Update CMake
uses: jwlawson/[email protected]
- name: Install brew dependencies
run: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install readline ninja
if: ${{ contains(matrix.os, 'macos') }}
- name: Install APT dependencies
run: |
sudo apt install -y libreadline-dev ninja-build
if: ${{ !contains(matrix.os, 'macos') }}
- name: Configure CMake
run: >
cmake -S . -B build
-G Ninja
${CMAKE_ARGS}
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=./staging
- name: Build CMake
run: |
cmake --build build
- name: Run Unit Tests
run: |
ctest --output-on-failure
- name: Test Executable
run: |
./build/src/base/main/abc -c "r i10.aig; b; ps; b; rw -l; rw -lz; b; rw -lz; b; ps; cec"
- name: Test Library
run: |
${DEMO_GCC} ${DEMO_ARGS} -Wall -c src/demo.c -o demo.o
g++ -o demo demo.o build/libabc.a -lm -ldl -lreadline -lpthread
./demo i10.aig
- name: Stage Executable
run: |
cmake --build build --target install
- name: Upload pacakge artifact
uses: actions/upload-artifact@v4
with:
name: package-cmake-${{ matrix.os }}-${{ matrix.use_namespace }}
path: staging/