Expose minimal flake and use matrix on build code

This commit is contained in:
Oscar Izquierdo 2024-08-05 22:40:05 +02:00 committed by Sebastián Estrella
parent b87f959b89
commit dca8e4fb1c
2 changed files with 13 additions and 12 deletions

View File

@ -15,6 +15,9 @@ jobs:
- macos-13 # x86_64-darwin - macos-13 # x86_64-darwin
- macos-latest # aarch64-darwin - macos-latest # aarch64-darwin
- ubuntu-latest # x86_64-linux - ubuntu-latest # x86_64-linux
ghc:
- ghc8107
- ghc902
fail-fast: true fail-fast: true
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
timeout-minutes: 15 timeout-minutes: 15
@ -24,15 +27,10 @@ jobs:
with: with:
extra-conf: accept-flake-config = true extra-conf: accept-flake-config = true
- uses: DeterminateSystems/magic-nix-cache-action@v7 - uses: DeterminateSystems/magic-nix-cache-action@v7
# TODO: improve with matrix - name: Compile code ${{ matrix.ghc }}
- name: Compile code ghc8107 run: nix build .#test-${{ matrix.ghc }}
run: nix build .#test-ghc8107 - name: Run tests ${{ matrix.ghc }}
- name: Run tests ghc8107 run: nix run .#test-${{ matrix.ghc }}
run: nix run .#test-ghc8107
- name: Compile code ghc902
run: nix build .#test-ghc902
- name: Run tests ghc902
run: nix run .#test-ghc902
docker: docker:
uses: ./.github/workflows/reusable-docker.yml uses: ./.github/workflows/reusable-docker.yml

View File

@ -46,8 +46,7 @@
}; };
flake-ghc8107 = pkgs.hapistrano-ghc8107.flake { }; flake-ghc8107 = pkgs.hapistrano-ghc8107.flake { };
flake-ghc902 = pkgs.hapistrano-ghc902.flake { }; flake-ghc902 = pkgs.hapistrano-ghc902.flake { };
in in rec {
flake-ghc8107 // flake-ghc902 // rec {
apps = { apps = {
test-ghc8107 = { test-ghc8107 = {
type = "app"; type = "app";
@ -58,7 +57,6 @@
program = "${packages.test-ghc902}/bin/test"; program = "${packages.test-ghc902}/bin/test";
}; };
}; };
legacyPackages = pkgs;
packages = { packages = {
default = flake-ghc8107.packages."hapistrano:exe:hap"; default = flake-ghc8107.packages."hapistrano:exe:hap";
test-ghc8107 = flake-ghc8107.packages."hapistrano:test:test".overrideAttrs (_: { 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;
};
}); });
} }