From dca8e4fb1c565a8920601ec18315523af2330979 Mon Sep 17 00:00:00 2001 From: Oscar Izquierdo <25722135+oscar-izval@users.noreply.github.com> Date: Mon, 5 Aug 2024 22:40:05 +0200 Subject: [PATCH] Expose minimal flake and use matrix on build code --- .github/workflows/build.yml | 16 +++++++--------- flake.nix | 9 ++++++--- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 375167d5..712a27c3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,9 @@ jobs: - macos-13 # x86_64-darwin - macos-latest # aarch64-darwin - ubuntu-latest # x86_64-linux + ghc: + - ghc8107 + - ghc902 fail-fast: true runs-on: ${{ matrix.os }} timeout-minutes: 15 @@ -24,15 +27,10 @@ jobs: with: extra-conf: accept-flake-config = true - uses: DeterminateSystems/magic-nix-cache-action@v7 - # TODO: improve with matrix - - name: Compile code ghc8107 - run: nix build .#test-ghc8107 - - name: Run tests ghc8107 - run: nix run .#test-ghc8107 - - name: Compile code ghc902 - run: nix build .#test-ghc902 - - name: Run tests ghc902 - run: nix run .#test-ghc902 + - name: Compile code ${{ matrix.ghc }} + run: nix build .#test-${{ matrix.ghc }} + - name: Run tests ${{ matrix.ghc }} + run: nix run .#test-${{ matrix.ghc }} docker: uses: ./.github/workflows/reusable-docker.yml diff --git a/flake.nix b/flake.nix index 11004b68..062c8406 100644 --- a/flake.nix +++ b/flake.nix @@ -46,8 +46,7 @@ }; flake-ghc8107 = pkgs.hapistrano-ghc8107.flake { }; flake-ghc902 = pkgs.hapistrano-ghc902.flake { }; - in - flake-ghc8107 // flake-ghc902 // rec { + in rec { apps = { test-ghc8107 = { type = "app"; @@ -58,7 +57,6 @@ program = "${packages.test-ghc902}/bin/test"; }; }; - legacyPackages = pkgs; packages = { default = flake-ghc8107.packages."hapistrano:exe:hap"; test-ghc8107 = flake-ghc8107.packages."hapistrano:test:test".overrideAttrs (_: { @@ -86,5 +84,10 @@ ''; }); }; + devShells = { + default = devShells.ghc902; + ghc8107 = flake-ghc8107.devShells.default; + ghc902 = flake-ghc902.devShells.default; + }; }); }