-
Notifications
You must be signed in to change notification settings - Fork 4
153 lines (149 loc) · 5.76 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: CI
on: [workflow_dispatch, push]
env:
CARGO_TERM_COLOR: always
CMAKE_GENERATOR: Ninja
CMAKE_C_COMPILER_LAUNCHER: sccache
CMAKE_CXX_COMPILER_LAUNCHER: sccache
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: true
# FIXME: cc-rs on mac currently won't set the C++ standard correctly (https://github.com/dtolnay/cxx/issues/1217).
CXXFLAGS: -std=c++17
jobs:
Format:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Format
run: cargo fmt --check
Build:
strategy:
fail-fast: false
matrix:
target:
- os: linux
runner: ubuntu-latest
triple: x86_64-unknown-linux-gnu
shell: bash
coverage: true
- os: macos
runner: macos-latest
triple: x86_64-apple-darwin
shell: bash
- os: windows
runner: windows-latest
triple: x86_64-pc-windows-gnu
shell: msys2
msystem: ucrt64
toolchain:
- stable
d4:
- include
- exclude
runs-on: ${{ matrix.target.runner }}
defaults:
run:
shell: ${{ matrix.target.shell }} {0}
env:
CARGO_BUILD_TARGET: ${{ matrix.target.triple }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup MSYS2 (Windows)
if: ${{ matrix.target.os == 'windows' }}
uses: msys2/setup-msys2@v2
with:
path-type: inherit
msystem: ${{ matrix.target.msystem }}
pacboy: git m4 cmake:p ninja:p
- name: Install dependencies (Linux)
if: ${{ matrix.target.os == 'linux' }}
run: sudo apt-get install ninja-build libtbb-dev libhwloc-dev libboost-program-options-dev
- name: Install dependencies (macOS)
if: ${{ matrix.target.os == 'macos' }}
run: brew install ninja boost hwloc tbb
- name: Install dependencies (Windows)
if: ${{ matrix.target.os == 'windows' }}
run: |
pacboy -S --noconfirm toolchain:p tbb:p hwloc:p boost:p
mv /${{ matrix.target.msystem }}/lib/libtbb12.dll.a /${{ matrix.target.msystem }}/lib/libtbb.dll.a
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.3
- name: Setup environment
run: |
export BUILD_ROOT=$(mktemp -d)
echo BUILD_ROOT=$BUILD_ROOT >> $GITHUB_ENV
echo MTKAHYPAR_DIR=$BUILD_ROOT >> $GITHUB_ENV
echo BUILD_ROOT_EXPORT=$(python3 -c "import os; print(os.environ['BUILD_ROOT'])") >> $GITHUB_ENV
echo LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$BUILD_ROOT/lib:$BUILD_ROOT/lib64" >> $GITHUB_ENV
echo PATH="$PATH:$BUILD_ROOT/bin" >> $GITHUB_ENV
- name: Setup Rust
run: |
rustup update ${{ matrix.toolchain }}-${{ matrix.target.triple }}
rustup default ${{ matrix.toolchain }}-${{ matrix.target.triple }}
- name: Build Mt-KaHyPar
if: ${{ matrix.d4 == 'include' }}
run: |
cd $(mktemp -d)
git clone --recursive https://github.com/kahypar/mt-kahypar.git .
cmake -B build -D CMAKE_INSTALL_PREFIX=$BUILD_ROOT -D MT_KAHYPAR_DISABLE_BOOST=true
cmake --build build --target mtkahypar
cmake --install build
mkdir -p $BUILD_ROOT/licenses/mt-kahypar
cp LICENSE $BUILD_ROOT/licenses/mt-kahypar/
# TODO: currently, macOS is only supported on master, move below clone to check out latest version when released.
# git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
- name: Build (including d4)
if: ${{ matrix.d4 == 'include' }}
run: cargo build
- name: Build (excluding d4)
if: ${{ matrix.d4 == 'exclude' }}
run: cargo build --no-default-features
- name: Test
# FIXME: Some tests are currently not platform independent and fail on macos and windows and without d4
if: ${{ matrix.d4 == 'include' && matrix.target.os != 'macos' && matrix.target.os != 'windows' }}
run: cargo test
- name: Install coverage tool
if: ${{ matrix.target.coverage }}
uses: taiki-e/install-action@cargo-llvm-cov
- name: Coverage
if: ${{ matrix.target.coverage && matrix.d4 == 'include' }}
run: cargo llvm-cov
- name: Package
run: |
mkdir -p $BUILD_ROOT/bin
cp target/${{ matrix.target.triple }}/debug/{ddnnife,dhone} $BUILD_ROOT/bin/
rm -rf $BUILD_ROOT/include
rm -rf $BUILD_ROOT/share
mkdir -p $BUILD_ROOT/licenses/d-ddnnf-reasoner
cp LICENSE $BUILD_ROOT/licenses/d-ddnnf-reasoner/
- name: Package documentation (including d4)
if: ${{ matrix.d4 == 'include' }}
run: |
cp doc/built/${{ matrix.target.os }}-d4.md $BUILD_ROOT/README.md
- name: Package documentation (excluding d4)
if: ${{ matrix.d4 == 'exclude' }}
run: |
cp doc/built/${{ matrix.target.os }}.md $BUILD_ROOT/README.md
- name: Package dependencies (Windows)
if: ${{ matrix.target.os == 'windows' }}
run: |
./package-msys.bash $BUILD_ROOT $BUILD_ROOT/bin/*
rm -f $BUILD_ROOT/bin/b2
rm -f $BUILD_ROOT/bin/bjam
rm -f $BUILD_ROOT/bin/hwloc*
rm -f $BUILD_ROOT/bin/lstopo*
rm -rf $BUILD_ROOT/lib
- name: Upload (including d4)
if: ${{ matrix.d4 == 'include' }}
uses: actions/upload-artifact@v4
with:
name: ddnnife-d4-${{ matrix.target.triple }}
path: ${{ env.BUILD_ROOT_EXPORT }}
- name: Upload (excluding d4)
if: ${{ matrix.d4 == 'exclude' }}
uses: actions/upload-artifact@v4
with:
name: ddnnife-${{ matrix.target.triple }}
path: ${{ env.BUILD_ROOT_EXPORT }}