Skip to content

Commit

Permalink
feat: enable nix build
Browse files Browse the repository at this point in the history
  • Loading branch information
uulm-janbaudisch committed May 3, 2024
1 parent 0de109a commit b700745
Show file tree
Hide file tree
Showing 15 changed files with 516 additions and 326 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI

on:
- push

jobs:
Lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Nix
uses: DeterminateSystems/nix-installer-action@v10
- name: Cache
uses: DeterminateSystems/magic-nix-cache-action@v4
- name: Build
run: nix flake check -L

Build:
strategy:
fail-fast: false
matrix:
target:
- triple: x86_64-unknown-linux-gnu
runner: ubuntu-latest
- triple: x86_64-apple-darwin
runner: macos-13
- triple: aarch64-apple-darwin
runner: macos-latest
runs-on: ${{ matrix.target.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Nix
uses: DeterminateSystems/nix-installer-action@v10
- name: Cache
uses: DeterminateSystems/magic-nix-cache-action@v4
- name: Build
run: nix build -L .#bundled
- name: Upload
uses: actions/upload-artifact@v4
with:
name: ddnnife-d4-${{ matrix.target.triple }}
path: result
54 changes: 8 additions & 46 deletions .github/workflows/CI.yml → .github/workflows/Windows.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: CI
name: Windows

on: [workflow_dispatch, push]
on:
- push

env:
CARGO_TERM_COLOR: always
Expand All @@ -9,32 +10,13 @@ env:
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
Expand All @@ -48,27 +30,19 @@ jobs:
runs-on: ${{ matrix.target.runner }}
defaults:
run:
shell: ${{ matrix.target.shell }} {0}
shell: msys2 {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 }}
msystem: ucrt64
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' }}
- 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
Expand All @@ -91,29 +65,18 @@ jobs:
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/
# 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
Expand All @@ -130,8 +93,7 @@ jobs:
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' }}
- name: Package dependencies
run: |
./package-msys.bash $BUILD_ROOT $BUILD_ROOT/bin/*
rm -f $BUILD_ROOT/bin/b2
Expand Down
Loading

0 comments on commit b700745

Please sign in to comment.