Skip to content

Commit

Permalink
nix: convert tests to nix flake check, simplify ci (#1245)
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro authored Dec 8, 2024
1 parent dae33d4 commit ae702a7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 76 deletions.
35 changes: 3 additions & 32 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 13 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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};
};
}
);
};
}
7 changes: 0 additions & 7 deletions nix/ci/prewarm.nix

This file was deleted.

33 changes: 0 additions & 33 deletions nix/ci/sources.nix

This file was deleted.

6 changes: 2 additions & 4 deletions nix/ci/test.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{ ocamlVersion }:
{ pkgs, packages }:

let
src = import ./sources.nix { inherit ocamlVersion; };
inherit (src) pkgs packages;
inputString =
builtins.substring
11 32
Expand Down Expand Up @@ -31,7 +29,7 @@ stdenv.mkDerivation {
dune
git
nodePackages.mocha
ocamlPackages.reason
reason
tree
nodejs
yarn
Expand Down

0 comments on commit ae702a7

Please sign in to comment.