Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: set up CI #4

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Nix Build"
on:
pull_request:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
ocamlVersion: [5_1]
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v21
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: "Run Nix tests"
run: nix build .#

151 changes: 151 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
description = "melange-json Nix Flake";

inputs.nix-filter.url = "github:numtide/nix-filter";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs = {
url = "github:nix-ocaml/nix-overlays";
inputs.flake-utils.follows = "flake-utils";
};
inputs.melange-src = {
url = "github:melange-re/melange";
inputs.nix-filter.follows = "nix-filter";
inputs.flake-utils.follows = "flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};

outputs = { self, nixpkgs, flake-utils, nix-filter, melange-src }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages."${system}".appendOverlays [
(self: super: {
ocamlPackages = super.ocaml-ng.ocamlPackages_5_1;
})
melange-src.overlays.default
];
inherit (pkgs) nodejs_latest lib stdenv darwin;

melange-json = with pkgs.ocamlPackages; buildDunePackage {
pname = "melange-json";
version = "dev";

src = ./.;
nativeBuildInputs = with pkgs.ocamlPackages; [ melange ];
propagatedBuildInputs = with pkgs.ocamlPackages; [ melange ];
};

mkShell = { buildInputs ? [ ] }: pkgs.mkShell {
inputsFrom = [ melange-json ];
nativeBuildInputs = with pkgs; [
yarn
nodejs_latest
] ++ (with pkgs.ocamlPackages; [
ocamlformat
merlin
melange-jest
reason
]);
inherit buildInputs;
};
in
rec {
packages.default = melange-json;
devShells = {
default = mkShell { };
release = mkShell {
buildInputs = with pkgs; [ cacert curl ocamlPackages.dune-release git ];
};
};
});
}
Loading