feat: enable nix build #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Windows | |
on: | |
- 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 | |
jobs: | |
Build: | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- 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: msys2 {0} | |
env: | |
CARGO_BUILD_TARGET: ${{ matrix.target.triple }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup MSYS2 (Windows) | |
uses: msys2/setup-msys2@v2 | |
with: | |
path-type: inherit | |
msystem: ucrt64 | |
pacboy: git m4 cmake:p ninja:p | |
- name: Install dependencies | |
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 . | |
git checkout c51ffeaa3b1040530bf821b7f323e3790b147b33 | |
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/ | |
- 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: 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 | |
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 }} |