diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml new file mode 100644 index 0000000..d7c12ac --- /dev/null +++ b/.github/workflows/Test.yml @@ -0,0 +1,31 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the "main" branch + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v4 + - name: Install Nix + uses: cachix/install-nix-action@v17 + - name: Build and test + run: nix build + diff --git a/.gitignore b/.gitignore index 411a136..441bc38 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,6 @@ _opam/ # nix result symlink result + +# direnv symlinks for dev environments +.direnv diff --git a/flake.nix b/flake.nix index bf41a18..cc49e4b 100644 --- a/flake.nix +++ b/flake.nix @@ -11,10 +11,16 @@ pkgs = nixpkgs.legacyPackages.${system}; on = opam-nix.lib.${system}; scope = - on.buildOpamProject { } package ./. { ocaml-system = "*"; }; + on.buildDuneProject { resolveArgs.with-test = true; } package ./. { ocaml-base-compiler = "*"; }; overlay = final: prev: { # Your overrides go here + cpspg = prev.cpspg.override { + doCheck = true; + checkPhase = '' + dune runtest + ''; + }; }; in rec { @@ -25,23 +31,8 @@ cpspg = default; }; - devShells.default = with pkgs; pkgs.mkShell { - buildInputs = [ - # Source file formatting - nixpkgs-fmt - ocamlformat - # For `dune build --watch ...` - fswatch - # For `dune build @doc` - ocamlPackages.odoc - # OCaml editor support - ocamlPackages.ocaml-lsp - # Nicely formatted types on hover - ocamlPackages.ocamlformat-rpc-lib - # Fancy REPL thing - ocamlPackages.utop - legacyPackages.cpspg - ]; + devShells.default = pkgs.mkShell { + buildInputs = packages.default.buildInputs; }; }); }