forked from inhabitedtype/httpaf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build in Nix and use GH Actions instead of CircleCI (inhabitedtype#38)
- Loading branch information
1 parent
84abd81
commit 095554d
Showing
6 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: "Build" | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
ocamlVersion: [4_06, 4_07, 4_08, 4_09] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: cachix/install-nix-action@v6 | ||
- uses: cachix/cachix-action@v3 | ||
with: | ||
name: anmonteiro | ||
skipNixBuild: true | ||
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' | ||
- name: Build / Test | ||
shell: bash | ||
run: nix-build ./nix/ci/test.nix --argstr ocamlVersion ${{ matrix.ocamlVersion }} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ ocamlVersion }: | ||
|
||
let | ||
sources = import ../sources.nix { inherit ocamlVersion; }; | ||
in | ||
import ./.. { | ||
inherit sources ocamlVersion; | ||
doCheck = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ sources ? import ./sources.nix { inherit ocamlVersion; }, ocamlVersion ? "4_09", doCheck ? true }: | ||
|
||
let | ||
inherit (sources) pkgs ocamlPackages gitignoreSource; | ||
in | ||
pkgs.callPackage ./generic.nix { | ||
inherit ocamlPackages gitignoreSource doCheck; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ lib, stdenv, ocamlPackages, gitignoreSource, doCheck }: | ||
|
||
with ocamlPackages; | ||
|
||
let | ||
buildHttpaf = args: buildDunePackage ({ | ||
version = "0.6.5-dev"; | ||
doCheck = doCheck; | ||
src = gitignoreSource ./..; | ||
} // args); | ||
|
||
# TODO: httpaf-async, httpaf-mirage | ||
in rec { | ||
httpaf = buildHttpaf { | ||
pname = "httpaf"; | ||
buildInputs = [ alcotest hex yojson ]; | ||
propagatedBuildInputs = [ | ||
angstrom | ||
faraday | ||
]; | ||
}; | ||
|
||
# These two don't have tests | ||
httpaf-lwt = buildHttpaf { | ||
pname = "httpaf-lwt"; | ||
doCheck = false; | ||
propagatedBuildInputs = [ httpaf lwt4 ]; | ||
}; | ||
|
||
httpaf-lwt-unix = buildHttpaf { | ||
pname = "httpaf-lwt-unix"; | ||
doCheck = false; | ||
propagatedBuildInputs = [ | ||
httpaf-lwt | ||
faraday-lwt-unix | ||
lwt_ssl | ||
]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# nix-build -E \ | ||
# 'with import <nixpkgs> { overlays = [(import ./.)];}; pkgs.bs-platform' | ||
{ pkgs ? import <nixpkgs> {}, ocamlVersion ? "4_09" }: | ||
|
||
let | ||
gitignoreSrc = pkgs.fetchFromGitHub { | ||
owner = "hercules-ci"; | ||
repo = "gitignore"; | ||
rev = "7415c4f"; | ||
sha256 = "1zd1ylgkndbb5szji32ivfhwh04mr1sbgrnvbrqpmfb67g2g3r9i"; | ||
}; | ||
|
||
overlays = builtins.fetchTarball { | ||
url = https://github.com/anmonteiro/nix-overlays/archive/5e4c96c3efd20048fc04f306956e3e0c5c04f544.tar.gz; | ||
sha256 = "1jaa9i2b5a4x9ryjh7ckvsgikqv6aqbb2lnn6xxdh3nqjk4vhx4m"; | ||
}; | ||
|
||
inherit (import gitignoreSrc { inherit (pkgs) lib; }) gitignoreSource; | ||
|
||
ocamlPackages = pkgs.ocaml-ng."ocamlPackages_${ocamlVersion}".overrideScope' | ||
(pkgs.callPackage "${overlays}/ocaml" { }); | ||
|
||
in | ||
{ inherit pkgs ocamlPackages gitignoreSource; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
let | ||
sources = import ./nix/sources.nix {}; | ||
inherit (sources) pkgs ocamlPackages; | ||
inherit (pkgs) stdenv lib; | ||
httpafPkgs = pkgs.recurseIntoAttrs (import ./nix { inherit sources; doCheck = false; }); | ||
httpafDrvs = lib.filterAttrs (_: value: lib.isDerivation value) httpafPkgs; | ||
|
||
in | ||
with pkgs; | ||
|
||
(mkShell { | ||
inputsFrom = lib.attrValues httpafDrvs; | ||
buildInputs = with ocamlPackages; [ merlin ]; | ||
}).overrideAttrs (o : { | ||
propagatedBuildInputs = lib.filter | ||
(drv: drv.pname == null || !(lib.any (name: name == drv.pname) (lib.attrNames httpafDrvs))) | ||
o.propagatedBuildInputs; | ||
}) | ||
|