Skip to content

Commit a461b36

Browse files
committed
new: dev: demonstrate tox/ci workflow options, cleanup build cfg
* 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 <[email protected]>
1 parent a588e67 commit a461b36

File tree

112 files changed

+1374
-902
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+1374
-902
lines changed

.github/workflows/build-posix-cmake.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
on: [push]
1+
on:
2+
workflow_dispatch:
3+
push:
24

35
jobs:
46

@@ -9,6 +11,9 @@ jobs:
911
use_namespace: [false, true]
1012

1113
runs-on: ${{ matrix.os }}
14+
defaults:
15+
run:
16+
shell: bash
1217

1318
env:
1419
CMAKE_ARGS: ${{ matrix.use_namespace && '-DABC_USE_NAMESPACE=xxx' || '' }}
@@ -20,7 +25,10 @@ jobs:
2025
- name: Git Checkout
2126
uses: actions/checkout@v2
2227
with:
23-
submodules: recursive
28+
fetch-depth: 0
29+
30+
- name: Update CMake
31+
uses: jwlawson/[email protected]
2432

2533
- name: Install brew dependencies
2634
run: |
@@ -33,16 +41,20 @@ jobs:
3341
if: ${{ !contains(matrix.os, 'macos') }}
3442

3543
- name: Configure CMake
36-
run: |
37-
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ${CMAKE_ARGS} -B build
44+
run: >
45+
cmake -S . -B build
46+
-G Ninja
47+
${CMAKE_ARGS}
48+
-DCMAKE_BUILD_TYPE=Release
49+
-DCMAKE_INSTALL_PREFIX=./staging
3850
3951
- name: Build CMake
4052
run: |
4153
cmake --build build
4254
4355
- name: Test Executable
4456
run: |
45-
./build/abc -c "r i10.aig; b; ps; b; rw -l; rw -lz; b; rw -lz; b; ps; cec"
57+
./build/src/base/main/abc -c "r i10.aig; b; ps; b; rw -l; rw -lz; b; rw -lz; b; ps; cec"
4658
4759
- name: Test Library
4860
run: |
@@ -52,11 +64,10 @@ jobs:
5264
5365
- name: Stage Executable
5466
run: |
55-
mkdir staging
56-
cp build/abc build/libabc.a staging/
67+
cmake --build build --target install
5768
58-
- name: Upload pacakge artifact
69+
- name: Upload package artifact
5970
uses: actions/upload-artifact@v1
6071
with:
61-
name: package
72+
name: package-${{ matrix.os }}-${{ matrix.use_namespace }}
6273
path: staging/

.github/workflows/build-posix.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
on: [push]
1+
on:
2+
workflow_dispatch:
3+
push:
24

35
jobs:
46

@@ -29,12 +31,13 @@ jobs:
2931

3032
- name: Install APT dependencies
3133
run: |
32-
sudo apt install -y libreadline-dev
34+
sudo apt-get -y -qq update
35+
sudo apt-get install -y libreadline-dev
3336
if: ${{ !contains(matrix.os, 'macos') }}
3437

3538
- name: Build Executable
3639
run: |
37-
make -j3 ${MAKE_ARGS} abc
40+
make -j3 ABC_USE_PIC=1 ${MAKE_ARGS} abc
3841
3942
- name: Test Executable
4043
run: |
@@ -55,8 +58,8 @@ jobs:
5558
mkdir staging
5659
cp abc libabc.a staging/
5760
58-
- name: Upload pacakge artifact
61+
- name: Upload package artifact
5962
uses: actions/upload-artifact@v1
6063
with:
61-
name: package
64+
name: package-${{ matrix.os }}-${{ matrix.use_namespace }}
6265
path: staging/

.github/workflows/build-windows.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
on: [push]
1+
on:
2+
workflow_dispatch:
3+
push:
24

35
jobs:
46

@@ -41,7 +43,7 @@ jobs:
4143
copy _TEST/abc.exe staging/
4244
copy UpgradeLog.htm staging/
4345
44-
- name: Upload pacakge artifact
46+
- name: Upload package artifact
4547
uses: actions/upload-artifact@v1
4648
with:
4749
name: package

.github/workflows/ci.yml

Lines changed: 67 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
push:
77
branches:
88
- master
9+
- develop
910
paths-ignore:
1011
- '**.md'
1112
- '**.rst'
@@ -22,46 +23,51 @@ jobs:
2223
strategy:
2324
fail-fast: false
2425
matrix:
25-
python-version: [3.8]
26+
python-version: [3.9]
2627

2728
name: [
29+
windows-2019-cl,
2830
ubuntu-20.04-gcc,
2931
ubuntu-20.04-clang,
30-
ubuntu-18.04-gcc,
31-
macOS-10.15-gcc,
32-
macOS-10.15-clang,
32+
ubuntu-22.04-clang,
33+
macOS-11-gcc,
34+
macOS-11-clang,
3335
]
3436

3537
include:
38+
- name: windows-2019-cl
39+
os: windows-2019
40+
compiler: cl
41+
3642
- name: ubuntu-20.04-gcc
3743
os: ubuntu-20.04
3844
compiler: gcc
39-
version: "10"
40-
toxcmd: build
45+
version: "11"
46+
toxcmd: soname,tests
4147

4248
- name: ubuntu-20.04-clang
4349
os: ubuntu-20.04
4450
compiler: clang
4551
version: "10"
4652
toxcmd: clang
4753

48-
- name: ubuntu-18.04-gcc
49-
os: ubuntu-18.04
50-
compiler: gcc
51-
version: "9"
52-
toxcmd: abc,tests
54+
- name: ubuntu-22.04-clang
55+
os: ubuntu-22.04
56+
compiler: clang
57+
version: "12"
58+
toxcmd: build
5359

54-
- name: macOS-10.15-gcc
55-
os: macOS-10.15
60+
- name: macOS-11-gcc
61+
os: macOS-11
5662
compiler: gcc
5763
version: "11"
58-
toxcmd: ctest
64+
toxcmd: abc,tests
5965

60-
- name: macOS-10.15-clang
61-
os: macOS-10.15
66+
- name: macOS-11-clang
67+
os: macOS-11
6268
compiler: xcode
63-
version: "12.3"
64-
toxcmd: clang
69+
version: "12.4"
70+
toxcmd: "base Xcode"
6571

6672
steps:
6773
- uses: actions/checkout@v2
@@ -72,6 +78,9 @@ jobs:
7278
with:
7379
python-version: ${{ matrix.python-version }}
7480

81+
- name: Update CMake
82+
uses: jwlawson/[email protected]
83+
7584
- name: Install Tox
7685
run: |
7786
python -m pip install --upgrade pip
@@ -82,12 +91,12 @@ jobs:
8291
run: |
8392
sudo apt-get -y -qq update
8493
sudo apt-get install -y libreadline-dev ncurses-dev
85-
if [ "${{ matrix.compiler }}" = "gcc" ]; then
94+
if [ "${{ matrix.compiler }}" = gcc ]; then
8695
sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib
8796
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
8897
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
8998
else
90-
sudo apt-get install -y clang-${{ matrix.version }} g++-multilib
99+
sudo apt-get install -y clang-${{ matrix.version }} llvm-${{ matrix.version }} lld-${{ matrix.version }} g++-multilib
91100
echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV
92101
echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV
93102
fi
@@ -97,27 +106,59 @@ jobs:
97106
env:
98107
CC: ${{ env.CC }}
99108
CXX: ${{ env.CXX }}
109+
PREFIX: ../staging
100110
run: |
101111
tox -e ${{ matrix.toxcmd }}
102112
113+
- uses: actions/upload-artifact@v2
114+
if: matrix.name == 'ubuntu-20.04-clang'
115+
with:
116+
name: src_coverage_data
117+
path: |
118+
build/coverage/html
119+
build/coverage/lcov.info
120+
103121
- name: Install and setup MacOS packages
104122
if: runner.os == 'macOS'
105123
run: |
106-
if [ "${{ matrix.compiler }}" = "gcc" ]; then
124+
if [ "${{ matrix.compiler }}" = gcc ]; then
107125
brew install gcc@${{ matrix.version }}
108126
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
109127
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
110128
else
111129
ls -ls /Applications/
112130
sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app
113-
echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV
114-
echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV
115131
fi
116132
117133
- name: Build and test MacOS
118134
if: runner.os == 'macOS'
135+
run: |
136+
if [ "${{ matrix.compiler }}" = gcc ]; then
137+
CC=${{ env.CC }} CXX=${{ env.CXX }} tox -e ${{ matrix.toxcmd }}
138+
else
139+
tox -e ${{ matrix.toxcmd }}
140+
fi
141+
142+
- name: Configure Windows
143+
if: runner.os == 'Windows'
144+
run: >
145+
cmake -S . -B build
146+
-DBUILD_SHARED_LIBS=ON
147+
-DABC_USE_NO_PTHREADS=ON
148+
-DABC_USE_NO_READLINE=ON
149+
-DCMAKE_BUILD_TYPE=Release
150+
-DCMAKE_INSTALL_PREFIX=${{ env.PREFIX }}
119151
env:
120-
CC: ${{ env.CC }}
121-
CXX: ${{ env.CXX }}
152+
CC: cl
153+
CXX: cl
154+
PREFIX: staging
155+
156+
- name: Build Windows
157+
if: runner.os == 'Windows'
158+
run: cmake --build build --config Release -j 2 --target install
159+
160+
- name: Test Windows
161+
if: runner.os == 'Windows'
122162
run: |
123-
tox -e ${{ matrix.toxcmd }}
163+
ctest -V -C Release --test-dir build/
164+
ls -lh staging/ || true

.github/workflows/conda-dev.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: CondaDev
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- master
9+
- develop
10+
11+
jobs:
12+
build:
13+
name: abc ${{ matrix.python-version }} ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
python-version: ['3.9']
19+
use_namespace: [false, true]
20+
include:
21+
- os: 'ubuntu-22.04'
22+
generator: 'Ninja'
23+
build_type: 'Release'
24+
- os: 'ubuntu-20.04'
25+
generator: 'Ninja'
26+
build_type: 'RelWithDebInfo'
27+
- os: 'macOS-11'
28+
generator: 'Ninja'
29+
build_type: 'Release'
30+
- os: 'windows-2019'
31+
generator: 'Ninja'
32+
build_type: 'Release'
33+
extra_args: '-DABC_USE_NO_PTHREADS=ON -DABC_USE_NO_READLINE=ON'
34+
env:
35+
OS: ${{ matrix.os }}
36+
PYTHON: ${{ matrix.python-version }}
37+
PYTHONIOENCODING: utf-8
38+
CMAKE_ARGS: ${{ matrix.use_namespace && '-DABC_USE_NAMESPACE=xxx' || '' }}
39+
40+
steps:
41+
- uses: actions/checkout@v2
42+
43+
- name: Setup base python
44+
uses: actions/setup-python@v2
45+
with:
46+
python-version: '3.x'
47+
48+
- name: Cache conda
49+
id: cache
50+
uses: actions/cache@v2
51+
env:
52+
# Increase this value to reset cache if environment.devenv.yml has not changed
53+
CACHE_NUMBER: 1
54+
with:
55+
path: ~/conda_pkgs_dir
56+
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.devenv.yml') }}
57+
58+
- uses: conda-incubator/setup-miniconda@v2
59+
with:
60+
auto-update-conda: true
61+
python-version: ${{ matrix.python-version }}
62+
channels: conda-forge
63+
channel-priority: strict
64+
use-only-tar-bz2: true
65+
66+
- name: Configure condadev environment
67+
shell: bash -l {0}
68+
env:
69+
PY_VER: ${{ matrix.python-version }}
70+
run: |
71+
conda config --set always_yes yes --set changeps1 no
72+
conda config --add channels conda-forge
73+
conda install conda-devenv=2.1.1
74+
conda devenv
75+
76+
- name: Build and test
77+
shell: bash -l {0}
78+
env:
79+
PY_VER: ${{ matrix.python-version }}
80+
run: |
81+
source activate abc-test
82+
ctest --build-generator "${{ matrix.generator }}" \
83+
--build-and-test . build \
84+
--build-options ${CMAKE_ARGS} ${{ matrix.extra_args }} \
85+
-DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
86+
--test-command ctest --rerun-failed --output-on-failure -V

.github/workflows/win.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
push:
77
branches:
88
- master
9+
- develop
910

1011
jobs:
1112
msys2-build:

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,4 @@ tags
5757

5858
/arch_flags
5959

60-
/cmake
6160
/cscope

0 commit comments

Comments
 (0)