Skip to content

Commit

Permalink
new: dev: demonstrate tox/ci workflow options, cleanup build cfg
Browse files Browse the repository at this point in the history
* define HAVE_STRUCT_TIMESPEC and _XKEYCHECK_H on msvc
* avoid LIBSTDCXX linking (msvc only), pass build config to all steps
* add optional lto support; note clang lto requires llvm-config and lld
* add llvm source-based coverage build, fix uninitialzed variable
* update cmake-posix workflow configure, bin path, emulate in tox
* add conda devenv file and workflow => use platform compilers and Ninja
* update build instructions in readme file, cleanup tox/ci files

Signed-off-by: Stephen L Arnold <nerdboy@gentoo.org>
  • Loading branch information
sarnold committed Jul 23, 2023
1 parent 7717534 commit 37e91a3
Show file tree
Hide file tree
Showing 112 changed files with 1,378 additions and 903 deletions.
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/actions-setup-cmake@v1.8

- 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
93 changes: 67 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
push:
branches:
- master
- develop
paths-ignore:
- '**.md'
- '**.rst'
Expand All @@ -22,46 +23,51 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8]
python-version: [3.9]

name: [
windows-2019-cl,
ubuntu-20.04-gcc,
ubuntu-20.04-clang,
ubuntu-18.04-gcc,
macOS-10.15-gcc,
macOS-10.15-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: "10"
toxcmd: build
version: "11"
toxcmd: soname,tests

- name: ubuntu-20.04-clang
os: ubuntu-20.04
compiler: clang
version: "10"
toxcmd: clang

- name: ubuntu-18.04-gcc
os: ubuntu-18.04
compiler: gcc
version: "9"
toxcmd: abc,tests
- name: ubuntu-22.04-clang
os: ubuntu-22.04
compiler: clang
version: "12"
toxcmd: build

- name: macOS-10.15-gcc
os: macOS-10.15
- name: macOS-11-gcc
os: macOS-11
compiler: gcc
version: "11"
toxcmd: ctest
toxcmd: abc,tests

- name: macOS-10.15-clang
os: macOS-10.15
- name: macOS-11-clang
os: macOS-11
compiler: xcode
version: "12.3"
toxcmd: clang
version: "12.4"
toxcmd: "base Xcode"

steps:
- uses: actions/checkout@v2
Expand All @@ -72,6 +78,9 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.8

- name: Install Tox
run: |
python -m pip install --upgrade pip
Expand All @@ -82,12 +91,12 @@ jobs:
run: |
sudo apt-get -y -qq update
sudo apt-get install -y libreadline-dev ncurses-dev
if [ "${{ matrix.compiler }}" = "gcc" ]; then
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 }} g++-multilib
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
Expand All @@ -97,27 +106,59 @@ jobs:
env:
CC: ${{ env.CC }}
CXX: ${{ env.CXX }}
PREFIX: ../staging
run: |
tox -e ${{ matrix.toxcmd }}
- uses: actions/upload-artifact@v2
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
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
echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=clang++-${{ 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=ON
-DABC_USE_NO_PTHREADS=ON
-DABC_USE_NO_READLINE=ON
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=${{ env.PREFIX }}
env:
CC: ${{ env.CC }}
CXX: ${{ env.CXX }}
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: |
tox -e ${{ matrix.toxcmd }}
ctest -V -C Release --test-dir build/
ls -lh staging/ || true
86 changes: 86 additions & 0 deletions .github/workflows/conda-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
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:
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 }}
PYTHON: ${{ matrix.python-version }}
PYTHONIOENCODING: utf-8
CMAKE_ARGS: ${{ matrix.use_namespace && '-DABC_USE_NAMESPACE=xxx' || '' }}

steps:
- uses: actions/checkout@v2

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

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

- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
channels: conda-forge
channel-priority: strict
use-only-tar-bz2: 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=2.1.1
conda devenv
- name: Build and test
shell: bash -l {0}
env:
PY_VER: ${{ matrix.python-version }}
run: |
source activate abc-test
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
1 change: 1 addition & 0 deletions .github/workflows/win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
push:
branches:
- master
- develop

jobs:
msys2-build:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,7 @@ tags

/arch_flags

/cmake
/cscope

.tox/
staging/
Loading

0 comments on commit 37e91a3

Please sign in to comment.