~jack/libtelnet-haskell

e93abdbfd439d3fbd536a436435019b682c85c30 — Jack Kelly 2 years ago 6a8d7db
Nixify CI
5 files changed, 32 insertions(+), 58 deletions(-)

M .build.yml
M .gitignore
D ci-build
M default.nix
M libtelnet.cabal
M .build.yml => .build.yml +8 -39
@@ 1,49 1,18 @@
image: debian/stretch
image: nixos/latest
repositories:
  haskell: http://downloads.haskell.org/debian stretch main BA3CBA3FFE22B574
packages:
  - cabal-install-2.4
  - cabal-install-2.2
  - ghc-8.6.3
  - ghc-8.6.1
  - ghc-8.4.4
  - ghc-8.4.3
  - ghc-8.4.2
  - ghc-8.2.2
  - ghc-8.0.2
  - libtelnet-dev
  nixpkgs: https://nixos.org/channels/nixpkgs-unstable
sources:
  - https://git.sr.ht/~jack/libtelnet-haskell
tasks:
  - cabal_update: |
      export PATH=/opt/cabal/2.4/bin:$PATH
  - ghc865: |
      cd libtelnet-haskell
      cabal new-update
  - ghc863: |
      export PATH=/opt/cabal/2.4/bin:/opt/ghc/8.6.3/bin:$PATH
      nix-build --arg buildExample true --argstr compiler ghc865
  - ghc864: |
      cd libtelnet-haskell
      ./ci-build
  - ghc861: |
      export PATH=/opt/cabal/2.4/bin:/opt/ghc/8.6.1/bin:$PATH
      cd libtelnet-haskell
      ./ci-build
      nix-build --arg buildExample true --argstr compiler ghc864
  - ghc844: |
      export PATH=/opt/cabal/2.2/bin:/opt/ghc/8.4.4/bin:$PATH
      cd libtelnet-haskell
      ./ci-build
  - ghc843: |
      export PATH=/opt/cabal/2.2/bin:/opt/ghc/8.4.3/bin:$PATH
      cd libtelnet-haskell
      ./ci-build
  - ghc842: |
      export PATH=/opt/cabal/2.2/bin:/opt/ghc/8.4.2/bin:$PATH
      cd libtelnet-haskell
      ./ci-build
      nix-build --arg buildExample true --argstr compiler ghc844
  - ghc822: |
      export PATH=/opt/cabal/2.2/bin:/opt/ghc/8.2.2/bin:$PATH
      cd libtelnet-haskell
      ./ci-build
  - ghc802: |
      export PATH=/opt/cabal/2.2/bin:/opt/ghc/8.0.2/bin:$PATH
      cd libtelnet-haskell
      ./ci-build
      nix-build --arg buildExample true --argstr compiler ghc822

M .gitignore => .gitignore +2 -1
@@ 1,3 1,4 @@
.stack-work/
dist/
dist-newstyle/
dist/
result

D ci-build => ci-build +0 -7
@@ 1,7 0,0 @@
#!/bin/sh
# Build instructions run by CI.

cabal check
cabal new-sdist
cabal new-build -fexample
cabal new-haddock

M default.nix => default.nix +20 -6
@@ 1,4 1,8 @@
{ nixpkgs ? import <nixpkgs> {}, compiler ? "default", doBenchmark ? false }:
{ nixpkgs ? import <nixpkgs> {}
, compiler ? "default"
, buildExample ? false
, doBenchmark ? false
}:

let
  inherit (nixpkgs) pkgs;


@@ 7,12 11,22 @@ let
                       then pkgs.haskellPackages
                       else pkgs.haskell.packages.${compiler};

  variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;
  benchmarkVariant =
    if doBenchmark
    then pkgs.haskell.lib.doBenchmark
    else pkgs.lib.id;

  exampleVariant = pkg:
    if buildExample
    then with pkgs.haskell.lib; enableCabalFlag
      (addBuildDepends pkg (with haskellPackages; [monad-loops network-simple]))
      "example"
    else pkgs.lib.id;

  # Example code's build-depends are behind a flag, so cabal2nix
  # doesn't add them automatically.
  libtelnet = with haskellPackages; pkgs.haskell.lib.addBuildDepends
     (callPackage ./libtelnet.nix { inherit (pkgs) libtelnet; })
     [monad-loops network-simple];
  libtelnet = haskellPackages.callPackage ./libtelnet.nix {
    inherit (pkgs) libtelnet;
  };
in
  variant libtelnet
  exampleVariant (benchmarkVariant libtelnet)

M libtelnet.cabal => libtelnet.cabal +2 -5
@@ 16,13 16,10 @@ copyright:           (c) 2017-2019 Jack Kelly
category:            Network
build-type:          Simple
extra-source-files:  COPYING, ChangeLog.md, README.md
tested-with:         GHC == 8.6.3
                   , GHC == 8.6.1
tested-with:         GHC == 8.6.5
                   , GHC == 8.6.4
                   , GHC == 8.4.4
                   , GHC == 8.4.3
                   , GHC == 8.4.2
                   , GHC == 8.2.2
                   , GHC == 8.0.2

flag example
  description:         Build the example program