From 0046817f15b557cb3a348f5066a41db2e4c7a57e Mon Sep 17 00:00:00 2001 From: Bogdan Burlacu Date: Sat, 1 Jun 2024 20:25:25 +0200 Subject: [PATCH] update flake build & CI --- .github/workflows/build-linux.yml | 4 ++-- .github/workflows/build-macos.yml | 9 ++++++--- flake.nix | 2 +- operon.nix | 11 ++++++++--- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index b7973a3..224617e 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -18,8 +18,8 @@ jobs: runs-on: ubuntu-latest if: github.ref_name == 'main' steps: - - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v22 + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v27 - name: Build working-directory: ${{github.workspace}} diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 550cd6e..523c173 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -12,14 +12,17 @@ env: jobs: build: + strategy: + matrix: + os: [ macos-11, macos-12, macos-13 ] # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. # You can convert this to a matrix build if you need cross-platform coverage. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: macos-13 + runs-on: ${{ matrix.os }} if: github.ref_name == 'main' steps: - - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v22 + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v27 - name: Build working-directory: ${{github.workspace}} diff --git a/flake.nix b/flake.nix index 05dedfc..304bc00 100644 --- a/flake.nix +++ b/flake.nix @@ -37,7 +37,7 @@ ]; }; stdenv = pkgs.llvmPackages_18.stdenv; - operon = import ./operon.nix { inherit stdenv pkgs; }; + operon = import ./operon.nix { inherit stdenv pkgs system; }; in rec { diff --git a/operon.nix b/operon.nix index c8ee200..d0a93a0 100644 --- a/operon.nix +++ b/operon.nix @@ -1,12 +1,17 @@ -{ stdenv, pkgs }: -stdenv.mkDerivation { +{ stdenv, pkgs, system }: +stdenv.mkDerivation rec { name = "operon"; src = ./.; enableShared = true; + cmakePreset = { + "x86_64-linux" = "build-linux"; + "aarch64-darwin" = "build-osx"; + }."${system}"; + cmakeFlags = [ - "--preset ${if pkgs.stdenv.hostPlatform.isx86_64 then "build-linux" else "build-osx"}" + "--preset ${cmakePreset}" "-DUSE_SINGLE_PRECISION=ON" ]; cmakeBuildType = "Release";