diff --git a/.github/workflows/nix-build.yml b/.github/workflows/nix-build.yml index 48b4d027a..e60fea190 100644 --- a/.github/workflows/nix-build.yml +++ b/.github/workflows/nix-build.yml @@ -11,54 +11,25 @@ concurrency: cancel-in-progress: true jobs: - ubuntu-tests: + nix-build-test: name: Build and test (Ubuntu) - strategy: - matrix: - ocaml-version: - - 5_3 - - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: "recursive" - - uses: cachix/install-nix-action@v30 - with: - extra_nix_config: | - extra-substituters = https://anmonteiro.nix-cache.workers.dev - extra-trusted-public-keys = ocaml.nix-cache.com-1:/xI2h2+56rwFfKyyFVbkJSeGqSIYMC/Je+7XXqGKDIY= - - - name: "Build / install dependencies" - run: nix-shell ./nix/ci/prewarm.nix --argstr ocamlVersion ${{ matrix.ocaml-version }} --run 'echo done' - - name: "Run nix-build" - run: nix-build ./nix/ci/test.nix --argstr ocamlVersion ${{ matrix.ocaml-version }} - - macos-tests: - name: Build and test (${{ matrix.os }}) - strategy: matrix: os: + - ubuntu-latest - macos-13 - macos-14 - ocaml-version: - - 5_3 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 with: submodules: "recursive" - - uses: cachix/install-nix-action@v30 with: extra_nix_config: | extra-substituters = https://anmonteiro.nix-cache.workers.dev extra-trusted-public-keys = ocaml.nix-cache.com-1:/xI2h2+56rwFfKyyFVbkJSeGqSIYMC/Je+7XXqGKDIY= - - # - name: "Build / install dependencies" - # run: nix-shell ./nix/ci/prewarm.nix --argstr ocamlVersion ${{ matrix.ocaml-version }} --run 'echo done' - name: "Run nix-build" - run: nix-build ./nix/ci/test.nix --argstr ocamlVersion ${{ matrix.ocaml-version }} + run: nix flake check diff --git a/flake.nix b/flake.nix index 21f20c545..facc1ac9c 100644 --- a/flake.nix +++ b/flake.nix @@ -61,5 +61,18 @@ }; } ); + + checks = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (system: + let + pkgs = nixpkgs.legacyPackages.${system}.extend (self: super: { + ocamlPackages = super.ocaml-ng.ocamlPackages_5_3; + }); + in + { + melange-check = pkgs.callPackage ./nix/ci/test.nix { + packages = self.packages.${pkgs.system}; + }; + } + ); }; } diff --git a/nix/ci/prewarm.nix b/nix/ci/prewarm.nix deleted file mode 100644 index e225b4c31..000000000 --- a/nix/ci/prewarm.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ocamlVersion }: - -let - src = import ./sources.nix { inherit ocamlVersion; }; - inherit (src) pkgs packages; -in -packages.melange diff --git a/nix/ci/sources.nix b/nix/ci/sources.nix deleted file mode 100644 index dfc8e83c6..000000000 --- a/nix/ci/sources.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ ocamlVersion }: - -let - lock = builtins.fromJSON (builtins.readFile ./../../flake.lock); - findFlakeSrc = { name, allRefs ? false }: fetchGit { - url = with lock.nodes.${name}.locked;"https://github.com/${owner}/${repo}"; - inherit (lock.nodes.${name}.locked) rev; - inherit allRefs; - }; - - src = findFlakeSrc { name = "nixpkgs"; }; - nix-filter-src = findFlakeSrc { name = "nix-filter"; }; - melange-compiler-libs-src = findFlakeSrc { - name = "melange-compiler-libs"; - allRefs = true; - }; - nix-filter = import "${nix-filter-src}"; - - pkgs = import src { - extraOverlays = [ - (self: super: { - ocamlPackages = super.ocaml-ng."ocamlPackages_${ocamlVersion}"; - }) - ]; - }; - packages = rec { - melange = pkgs.callPackage ./.. { - inherit nix-filter; - melange-compiler-libs-vendor-dir = melange-compiler-libs-src; - }; - }; -in -{ inherit pkgs packages; } diff --git a/nix/ci/test.nix b/nix/ci/test.nix index dd7b8574d..fe49cb1be 100644 --- a/nix/ci/test.nix +++ b/nix/ci/test.nix @@ -1,8 +1,6 @@ -{ ocamlVersion }: +{ pkgs, packages }: let - src = import ./sources.nix { inherit ocamlVersion; }; - inherit (src) pkgs packages; inputString = builtins.substring 11 32 @@ -31,7 +29,7 @@ stdenv.mkDerivation { dune git nodePackages.mocha - ocamlPackages.reason + reason tree nodejs yarn