Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
09e8eb6
Build fixes/tweaks for (optional) shared libs, reduced footprint
sarnold Jul 17, 2021
9507c0b
Add pure cmake build system
madebr Nov 13, 2018
e0c1c1e
Export Abc_RealMain if building shared libabc
madebr Nov 13, 2018
3fc1784
new: dev: update original cmake cfg and sources, add tox/update ci files
sarnold Nov 1, 2021
a82225e
fix: make clang build work, mainly C++ type/literal errors
sarnold Nov 7, 2021
5c6daa2
chg: dev: cleanup windows builds and sources, update workflows
sarnold Nov 7, 2021
63fb48c
Silence warning about unused variables
madebr Nov 13, 2018
9f25a1e
new: dev: demonstrate tox/ci workflow options, cleanup build cfg
sarnold Nov 10, 2021
5bb52d2
fix: dev: run manual cmake commands from build dir on macos
sarnold Jul 23, 2023
eb22bac
post-rebase generate/update CMakeLists.txt files, update tox file
sarnold Jul 23, 2023
e8e2bad
fix timespec redefinition errors on windows
sarnold Jul 23, 2023
1b30a60
chg: dev: add (new) generated cmake sources
sarnold Dec 1, 2023
4d9c870
chg: dev: update python versions, add CPUS env var to tox file
sarnold Dec 1, 2023
5da957b
fix: dev: address toolchain requirement changes
sarnold Dec 1, 2023
cc1e562
fix: dev: cleanup desktop and ci workflows
sarnold Dec 3, 2023
e532ae1
chg: usr: update devenv file and conda-dev workflow, update win path
sarnold Dec 3, 2023
0d70dab
chg: revert to latest action and package versions
sarnold Dec 9, 2023
992ed27
fix: dev: relax ifdef check in cmd.c and make it windows-specific
sarnold Dec 10, 2023
3ef8651
chg: dev: cleanup coverage, .gitignore, and tox cmds
sarnold Feb 3, 2025
cad2565
chg: dev: (re)generate, update all cmake build files
sarnold Feb 3, 2025
518754e
chg: dev: update workflow actions, add dependabot.yml, bump OS versions
sarnold Feb 15, 2025
a2fb71e
chg: dev: cleanup cmake and tox files, include gia tests
sarnold Feb 17, 2025
521322a
chg: dev: install or vendor googletest as needed, set gtest libs
sarnold Feb 17, 2025
f8e6edf
fix: dev: adjust for workflow environments, fix gia_test working dire…
sarnold Feb 19, 2025
1b0e36d
chg: dev: cleanup readme and xcode setup, use internal gtest for xcode
sarnold Feb 21, 2025
7bb44c6
fix: dev: cleanup googletest bits for consistent paths to gtest libs
sarnold Feb 23, 2025
e10e71d
fix: dev: try fetching googletest on windows instead of conda pkgs
sarnold Feb 23, 2025
6cad9b7
fix: dev: refactor symbol visibility, use ABC_DLL to expose public API
sarnold Feb 24, 2025
ee5ce14
chg: dev: use static libs and local gtest in windows conda env
sarnold Feb 24, 2025
fe0f644
chg: dev: use C++ namespace for msys2 builds, workflow and tox cleanup
sarnold Feb 25, 2025
7d532c7
fix: dev: cleanup llvm coverage in smoke workflow, sort out version path
sarnold Mar 7, 2025
3f3c3d2
fix: dev: prep msvc cl and github environment for conda on windows
sarnold Mar 8, 2025
1a2a9e0
fix: dev: add latest modules to cmake build modules
sarnold Mar 9, 2025
fd49eba
chg: dev: post-rebase (re)generate cmake files
sarnold Mar 25, 2025
37501ce
fix: dev: rename conflicting Win32 symbol, cleanup whitespace
sarnold Mar 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions .github/workflows/build-posix-cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Build Posix CMake

on:
push:
branches:
- master
pull_request:

jobs:
Expand All @@ -13,6 +15,9 @@ jobs:
use_namespace: [false, true]

runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash

env:
CMAKE_ARGS: ${{ matrix.use_namespace && '-DABC_USE_NAMESPACE=xxx' || '' }}
Expand All @@ -24,7 +29,10 @@ jobs:
- name: Git Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Update CMake
uses: jwlawson/[email protected]

- name: Install brew dependencies
run: |
Expand All @@ -37,8 +45,13 @@ jobs:
if: ${{ !contains(matrix.os, 'macos') }}

- name: Configure CMake
run: |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ${CMAKE_ARGS} -B build
run: >
cmake -S . -B build
-G Ninja
${CMAKE_ARGS}
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=./staging
-DVENDOR_GTEST=ON

- name: Build CMake
run: |
Expand All @@ -50,7 +63,7 @@ jobs:

- name: Test Executable
run: |
./build/abc -c "r i10.aig; b; ps; b; rw -l; rw -lz; b; rw -lz; b; ps; cec"
./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: |
Expand All @@ -60,8 +73,7 @@ jobs:

- name: Stage Executable
run: |
mkdir staging
cp build/abc build/libabc.a staging/
cmake --build build --target install

- name: Upload pacakge artifact
uses: actions/upload-artifact@v4
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/build-posix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Build Posix

on:
push:
branches:
- master
pull_request:

jobs:
Expand Down Expand Up @@ -33,12 +35,13 @@ jobs:

- name: Install APT dependencies
run: |
sudo apt install -y libreadline-dev
sudo apt-get -y -qq update
sudo apt-get install -y libreadline-dev
if: ${{ !contains(matrix.os, 'macos') }}

- name: Build Executable
run: |
make -j3 ${MAKE_ARGS} abc
make -j3 ABC_USE_PIC=1 ${MAKE_ARGS} abc

- name: Test Executable
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Build Windows

on:
push:
branches:
- master
pull_request:

jobs:
Expand Down
173 changes: 173 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
name: ci

on:
workflow_dispatch:
pull_request:
push:
branches:
- master
- develop
paths-ignore:
- '**.md'
- '**.rst'
- '**.sh'

jobs:
ci_build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash

strategy:
fail-fast: false
matrix:
python-version: ['3.11']

name: [
windows-2019-cl,
ubuntu-22.04-gcc-10,
ubuntu-24.04-gcc-13,
ubuntu-22.04-clang-15,
macOS-13-gcc,
macOS-13-clang,
]

include:
- name: windows-2019-cl
os: windows-2019
compiler: cl

- name: ubuntu-22.04-gcc-10
os: ubuntu-22.04
compiler: gcc
version: "10"
toxcmd: soname,tests

- name: ubuntu-24.04-gcc-13
os: ubuntu-24.04
compiler: gcc
version: "13"
toxcmd: libs

- name: ubuntu-22.04-clang-15
os: ubuntu-22.04
compiler: clang
version: "15"
toxcmd: clang

- name: macOS-13-gcc
os: macOS-13
compiler: gcc
version: "12"
toxcmd: abc,tests

- name: macOS-13-clang
os: macOS-13
compiler: xcode
version: "15.1"
toxcmd: "ctestwin -- Xcode"

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v2
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 -yqq software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
sudo apt-get -qq update
sudo apt-get install -y libreadline-dev ncurses-dev libgtest-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 }} clang++-${{ matrix.version }} llvm-${{ matrix.version }}-tools lld-${{ matrix.version }}
echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV
echo "LLVM_VER_DIR=/usr/lib/llvm-${{ matrix.version }}" >> $GITHUB_ENV
fi

- name: Build and test Linux
if: runner.os == 'Linux'
env:
CC: ${{ env.CC }}
CXX: ${{ env.CXX }}
LLVM_VER_DIR: ${{ env.LLVM_VER_DIR }}
PREFIX: ../staging
run: |
tox -e ${{ matrix.toxcmd }}

- uses: actions/upload-artifact@v4
if: matrix.name == 'ubuntu-22.04-clang-15'
with:
name: src_coverage_data
path: |
build/coverage/html
build/coverage/lcov.info

- name: Install and setup MacOS packages
if: runner.os == 'macOS'
run: |
brew update
#brew upgrade
if [ "${{ matrix.compiler }}" = xcode ]; then
sudo xcode-select -s /Applications/Xcode_${{ matrix.version }}.app/Contents/Developer
ls -ls /Applications/
else
brew install gcc@${{ matrix.version }}
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
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=OFF
-DABC_USE_NO_PTHREADS=ON
-DABC_USE_NO_READLINE=ON
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=${{ env.PREFIX }}
-DVENDOR_GTEST=ON
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
123 changes: 123 additions & 0 deletions .github/workflows/conda-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: CondaDev

on:
workflow_dispatch:
pull_request:
push:
branches:
- master
- develop

jobs:
conda_build:
name: abc ${{ matrix.python-version }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-24.04', 'ubuntu-22.04', 'macOS-14', 'windows-2019']
use_namespace: [false, true]
python-version: ['3.9']
include:
- os: 'ubuntu-22.04'
generator: 'Ninja'
build_type: 'Release'
extra_args: '-DBUILD_SHARED_LIBS=ON -DABC_USE_SONAME=ON'
- os: 'ubuntu-24.04'
generator: 'Ninja'
build_type: 'RelWithDebInfo'
extra_args: '-DBUILD_SHARED_LIBS=ON -DABC_USE_SONAME=ON'
- os: 'macOS-14'
generator: 'Ninja'
build_type: 'Debug'
extra_args: '-DBUILD_SHARED_LIBS=ON -DABC_USE_SONAME=ON'
- os: 'windows-2019'
generator: 'Ninja'
build_type: 'Debug'
extra_args: '-DBUILD_SHARED_LIBS=OFF -DABC_USE_NO_PTHREADS=ON -DABC_USE_NO_READLINE=ON -DVENDOR_GTEST=ON'
env:
OS: ${{ matrix.os }}
PY_VER: ${{ matrix.python-version }}
PYTHONIOENCODING: utf-8
CMAKE_ARGS: ${{ matrix.use_namespace && '-DABC_USE_NAMESPACE=xxx' || '' }}

steps:
#- if: matrix.os == 'windows-2019'
#name: Install newer windows compiler
#id: install_cc
#uses: rlalik/setup-cpp-compiler@master
#with:
#compiler: g++-11.2.0

#- if: matrix.os == 'windows-2019'
#name: Use compiler
#shell: bash -l {0}
#env:
#CC: ${{ steps.install_cc.outputs.cc }}
#CXX: ${{ steps.install_cc.outputs.cxx }}
#run: |

- uses: actions/checkout@v4

- name: Setup base python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Prepare build environment for windows
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- name: Env (Windows)
if: runner.os == 'Windows'
run: |
echo "CXX=cl.exe" >> $GITHUB_ENV
echo "CC=cl.exe" >> $GITHUB_ENV

- name: Cache conda
id: cache
uses: actions/cache@v4
env:
# Increase this value to reset cache if environment.devenv.yml has not changed
CACHE_NUMBER: 2
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.devenv.yml') }}

- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
auto-activate-base: true
activate-environment: ''
channels: conda-forge,defaults
channel-priority: flexible
conda-remove-defaults: true

- name: Configure condadev environment
shell: bash -l {0}
env:
PY_VER: ${{ matrix.python-version }}
run: |
conda config --set always_yes yes --set changeps1 no
conda config --add channels conda-forge
conda install conda-devenv
conda info -a
conda devenv

- name: Build and test
shell: bash -l {0}
env:
PY_VER: ${{ matrix.python-version }}
run: |
source activate abc-test
conda info --envs
ctest --build-config "${{ matrix.build_type }}" \
--build-generator "${{ matrix.generator }}" \
--build-and-test . build \
--build-options ${CMAKE_ARGS} ${{ matrix.extra_args }} \
-DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \
--test-command ctest -V \
--build-config "${{ matrix.build_type }}" \
--rerun-failed --output-on-failure
Loading
Loading