Skip to content
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

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

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
aaeaf16
Build fixes/tweaks for (optional) shared libs, reduced footprint
sarnold Jul 17, 2021
7e7b0a5
Add pure cmake build system
madebr Nov 13, 2018
d333f43
Export Abc_RealMain if building shared libabc
madebr Nov 13, 2018
e22818c
new: dev: update original cmake cfg and sources, add tox/update ci files
sarnold Nov 1, 2021
8c7df74
fix: make clang build work, mainly C++ type/literal errors
sarnold Nov 7, 2021
72644b5
chg: dev: cleanup windows builds and sources, update workflows
sarnold Nov 7, 2021
ab18ccf
Silence warning about unused variables
madebr Nov 13, 2018
38ab132
new: dev: demonstrate tox/ci workflow options, cleanup build cfg
sarnold Nov 10, 2021
0e160e3
fix: dev: run manual cmake commands from build dir on macos
sarnold Jul 23, 2023
c44b3ca
post-rebase generate/update CMakeLists.txt files, update tox file
sarnold Jul 23, 2023
b163a57
fix timespec redefinition errors on windows
sarnold Jul 23, 2023
7c2de69
chg: dev: add (new) generated cmake sources
sarnold Dec 1, 2023
2fd6664
chg: dev: update python versions, add CPUS env var to tox file
sarnold Dec 1, 2023
4cf7692
fix: dev: address toolchain requirement changes
sarnold Dec 1, 2023
146b57c
fix: dev: cleanup desktop and ci workflows
sarnold Dec 3, 2023
fe8b36a
chg: usr: update devenv file and conda-dev workflow, update win path
sarnold Dec 3, 2023
44ea6ff
chg: revert to latest action and package versions
sarnold Dec 9, 2023
5569a67
fix: dev: relax ifdef check in cmd.c and make it windows-specific
sarnold Dec 10, 2023
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
29 changes: 20 additions & 9 deletions .github/workflows/build-posix-cmake.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
on: [push]
on:
workflow_dispatch:
push:

jobs:

Expand All @@ -9,6 +11,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 @@ -20,7 +25,10 @@ jobs:
- name: Git Checkout
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0

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

- name: Install brew dependencies
run: |
Expand All @@ -33,16 +41,20 @@ 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

- name: Build CMake
run: |
cmake --build build

- 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 @@ -52,11 +64,10 @@ jobs:

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

- name: Upload pacakge artifact
- name: Upload package artifact
uses: actions/upload-artifact@v1
with:
name: package
name: package-${{ matrix.os }}-${{ matrix.use_namespace }}
path: staging/
13 changes: 8 additions & 5 deletions .github/workflows/build-posix.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
on: [push]
on:
workflow_dispatch:
push:

jobs:

Expand Down Expand Up @@ -29,12 +31,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 All @@ -55,8 +58,8 @@ jobs:
mkdir staging
cp abc libabc.a staging/

- name: Upload pacakge artifact
- name: Upload package artifact
uses: actions/upload-artifact@v1
with:
name: package
name: package-${{ matrix.os }}-${{ matrix.use_namespace }}
path: staging/
6 changes: 4 additions & 2 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
on: [push]
on:
workflow_dispatch:
push:

jobs:

Expand Down Expand Up @@ -41,7 +43,7 @@ jobs:
copy _TEST/abc.exe staging/
copy UpgradeLog.htm staging/

- name: Upload pacakge artifact
- name: Upload package artifact
uses: actions/upload-artifact@v1
with:
name: package
Expand Down
165 changes: 165 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
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
89 changes: 89 additions & 0 deletions .github/workflows/conda-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: CondaDev

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

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

steps:
- uses: actions/checkout@v3

- name: Setup base python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Cache conda
id: cache
uses: actions/cache@v3
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
channel-priority: flexible

- 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 install conda-devenv=3.2.0
conda info
conda list

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