From e1fa072f001f094a987129e479167acd0934e49e Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 23 Jun 2020 18:41:56 +0300 Subject: [PATCH 1/8] CI: .travis.yml: add the disclaimer M .travis.yml --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index 13382bd..95de683 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,13 @@ env: # , nixos-unstable # nixpkgs-unstable that passes a bunch of base tests # , nixos-20.03 # Last stable release, gets almost no updates to recipes, gets only required backports # } + ### + ### NOTE: This configuration uses `build.sh` interface, which uses `default.nix` interface, which exposes the Nixpkgs Haskell Lib interface. + ### + ### Documentation of this settings is in `default.nix`, + ### and the other part of keys explained in `build.sh` + ### + # # - rev=nixos-unstable # # NOTE: Switching into Nixpkgs revision # - NIX_PATH="nixpkgs=https://github.com/nixos/nixpkgs/archive/$rev.tar.gz" From f074bd8978057418db4fc3f8f9e26c8478d8e2b8 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 23 Jun 2020 18:43:47 +0300 Subject: [PATCH 2/8] CI: mv rev doc (.travis.yml->build.sh) M .travis.yml M build.sh --- .travis.yml | 10 ---------- build.sh | 11 +++++++++++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 95de683..2403032 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,16 +23,6 @@ env: global: # NOTE: This is secure CACHIX_SIGNING_KEY=val - secure: "dm6I+M4+V+C7QMTpcSADdKPE633SvmToXZrTbZ7miNDGmMN+/SfHeN2ybi1+PW6oViMlbPN/7J/aEfiGjSJI8vLk72Y4uCWGmpSb8TXZLu6+whnxtZzzW8+z4tsM4048QJg7CF3N/25U8thRFgs3DqUub1Sf3nG9LrNWdz6ZcDQ=" - # NOTE: Nix by default uses nixpkgs-unstable channel - # NOTE: Setup for Nixpkgs revision - # `rev` vals in order of freshness -> cache & stability: - # { master - # , commitHash - # , haskell-updates # Haskell development branch in Nixpkgs, can be inconsistent. Weekly merged into the upstream - # , nixpkgs-unstable # Default branch on Nix installation, default for non NixOS - # , nixos-unstable # nixpkgs-unstable that passes a bunch of base tests - # , nixos-20.03 # Last stable release, gets almost no updates to recipes, gets only required backports - # } ### ### NOTE: This configuration uses `build.sh` interface, which uses `default.nix` interface, which exposes the Nixpkgs Haskell Lib interface. ### diff --git a/build.sh b/build.sh index be3fea0..1b1a349 100755 --- a/build.sh +++ b/build.sh @@ -7,6 +7,17 @@ set -Eexuo pipefail # NOTE: If var not imported - set to the default value GHCVERSION=${GHCVERSION:-'ghc8101'} +# NOTE: Nix by default uses nixpkgs-unstable channel +# Setup for Nixpkgs revision: +# `rev` vals in order of freshness -> cache & stability: +# { master +# , commitHash +# , haskell-updates # Haskell development branch in Nixpkgs, can be inconsistent. Weekly merged into the upstream +# , nixpkgs-unstable # Default branch on Nix installation, default for non NixOS +# , nixos-unstable # nixpkgs-unstable that passes a bunch of base tests +# , nixos-20.03 # Last stable release, gets almost no updates to recipes, gets only required backports +# ... +# } rev=${rev:-'nixpkgs-unstable'} NIX_PATH=${NIX_PATH:-"nixpkgs=https://github.com/nixos/nixpkgs/archive/$rev.tar.gz"} export NIX_PATH From 6907e782ce85be2ec09428d91a3fb9d7129d8cce Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 23 Jun 2020 18:47:43 +0300 Subject: [PATCH 3/8] CI: build.sh: upd disclaimer M build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 1b1a349..f52234e 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# NOTE: Script for the CI builds. CI comes here from `.travis.yml` +# NOTE: Script for the CI builds, relies on `default.nix` interface, which exposes Nixpkgs Haskell Lib interface # NOTE: The most strict error checking requirements set -Eexuo pipefail From cf5cff3f2af9bb88d5ca36f7b4840a3f0c58eb78 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 23 Jun 2020 18:49:29 +0300 Subject: [PATCH 4/8] CI: build.sh: add setting section disclaimer M build.sh --- build.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.sh b/build.sh index f52234e..e1598f3 100755 --- a/build.sh +++ b/build.sh @@ -5,6 +5,8 @@ # NOTE: The most strict error checking requirements set -Eexuo pipefail +### NOTE: Section handles imports from env, these are settings for Nixpkgs. + # NOTE: If var not imported - set to the default value GHCVERSION=${GHCVERSION:-'ghc8101'} # NOTE: Nix by default uses nixpkgs-unstable channel From 51e5b65ca2e50e16061ad638de53cdfda4c4b8f0 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 23 Jun 2020 18:53:37 +0300 Subject: [PATCH 5/8] CI: build.sh: upd NIX_PATH doc M .travis.yml M build.sh --- .travis.yml | 1 - build.sh | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2403032..48c690c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,6 @@ env: ### # # - rev=nixos-unstable - # # NOTE: Switching into Nixpkgs revision # - NIX_PATH="nixpkgs=https://github.com/nixos/nixpkgs/archive/$rev.tar.gz" # NOTE: Project/binary name - name='hnix' diff --git a/build.sh b/build.sh index e1598f3..17f9f16 100755 --- a/build.sh +++ b/build.sh @@ -21,6 +21,7 @@ GHCVERSION=${GHCVERSION:-'ghc8101'} # ... # } rev=${rev:-'nixpkgs-unstable'} +# If NIX_PATH not imported - construct it from `rev` NIX_PATH=${NIX_PATH:-"nixpkgs=https://github.com/nixos/nixpkgs/archive/$rev.tar.gz"} export NIX_PATH name=${name:-'defaultProjectName'} From f3e32b1acac019856d2f307ad98b1e21aed5f96f Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 23 Jun 2020 19:01:06 +0300 Subject: [PATCH 6/8] CI: .travis.yml: reduce not used pkgName getOptParseApplicativeComplettions does not need it M .travis.yml --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 48c690c..9e509d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,8 +34,6 @@ env: # - NIX_PATH="nixpkgs=https://github.com/nixos/nixpkgs/archive/$rev.tar.gz" # NOTE: Project/binary name - name='hnix' - # NOTE: Used in the `generateOptparseApplicativeCompletions = true` - - pkgName='haskellPackages.hnix' # NOTE: Enable all our tests in cabal - ALL_TESTS='yes' # NOTE: Turn all warn into err with {-Wall,-Werror} From 234507604f70e18b024cdbf2000ffe4bb88af041 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 23 Jun 2020 19:09:01 +0300 Subject: [PATCH 7/8] CI: {.travis.yml,build.sh}: rename (name->project) more unique and descriptive M .travis.yml M build.sh --- .travis.yml | 6 +++--- build.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9e509d4..cf99696 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ env: # - rev=nixos-unstable # - NIX_PATH="nixpkgs=https://github.com/nixos/nixpkgs/archive/$rev.tar.gz" # NOTE: Project/binary name - - name='hnix' + - project='hnix' # NOTE: Enable all our tests in cabal - ALL_TESTS='yes' # NOTE: Turn all warn into err with {-Wall,-Werror} @@ -148,9 +148,9 @@ script: # NOTE: Install Cachix client using Nix: - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then nix-env -iA cachix -f https://cachix.org/api/v1/install; fi - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then sudo nix-env -iA cachix -f https://cachix.org/api/v1/install; fi - - cachix use "$name" + - cachix use "$project" # NOTE: If key is set - use Cachix push, else - proceed without it - - if [ ! "$CACHIX_SIGNING_KEY" = "" ]; then cachix push "$name" --watch-store& fi + - if [ ! "$CACHIX_SIGNING_KEY" = "" ]; then cachix push "$project" --watch-store& fi # NOTE: Brush timeout for previous daemon to start # # diff --git a/build.sh b/build.sh index 17f9f16..44ea488 100755 --- a/build.sh +++ b/build.sh @@ -24,7 +24,7 @@ rev=${rev:-'nixpkgs-unstable'} # If NIX_PATH not imported - construct it from `rev` NIX_PATH=${NIX_PATH:-"nixpkgs=https://github.com/nixos/nixpkgs/archive/$rev.tar.gz"} export NIX_PATH -name=${name:-'defaultProjectName'} +project=${project:-'defaultProjectName'} # This settings expose most of the Nixpkgs Haskell.lib API: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib.nix @@ -223,14 +223,14 @@ sudo nix-channel --update || true # NOTE: Secrets are not shared to PRs from forks -# NOTE: nix-build | cachix push - uploads binaries, runs&works only in the branches of the main repository, so for PRs - else case runs +# NOTE: nix-build | cachix push - uploads binaries, runs&works only in the branches of the main repository, so for PRs - else case runs if [ ! "$CACHIX_SIGNING_KEY" = "" ] then # NOTE: Build of the inside repo branch - enable push Cachix cache - BUILD_PROJECT | cachix push "$name" + BUILD_PROJECT | cachix push "$project" else From e593c0ea82f77efb1b47d7bb86875dc2291be000 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 23 Jun 2020 19:41:38 +0300 Subject: [PATCH 8/8] CI: {.travis.yml,build.sh}: merge documentation into buildh.sh M .travis.yml M build.sh --- .travis.yml | 26 ++------------------------ build.sh | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/.travis.yml b/.travis.yml index cf99696..1bfc64d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,48 +32,26 @@ env: # # - rev=nixos-unstable # - NIX_PATH="nixpkgs=https://github.com/nixos/nixpkgs/archive/$rev.tar.gz" - # NOTE: Project/binary name - project='hnix' - # NOTE: Enable all our tests in cabal + # Enable all our tests in Cabal - ALL_TESTS='yes' - # NOTE: Turn all warn into err with {-Wall,-Werror} - failOnAllWarnings='false' - # NOTE: checkUnusedPackages: is `failOnAllWarnings` + `cabal sdist` to ensure all needed files are listed in the Cabal file. Uses `packunused` or GHC internals. Adds a post-build check to verify that dependencies declared in the cabal file are actually used. The first attrset argument can be used to configure the strictness of this check and a list of ignored package names that would otherwise cause false alarms. - checkUnusedPackages='false' - # NOTE: Generation and installation of a coverage report. - # See https://wiki.haskell.org/Haskell_program_coverage - doCoverage='false' - # NOTE: Generation and installation of haddock API documentation - doHaddock='false' - # NOTE: Escape the version bounds from the cabal file. You may want to avoid this function. - doJailbreak='false' - # NOTE: Disables Nix dependency checking, compilation and execution of test suites listed in the package description file. - doCheck='true' - # NOTE: doBenchmark: Dependency checking + compilation and execution for benchmarks listed in the package description file. - doBenchmark='false' - enableExecutableProfiling='false' - enableLibraryProfiling='false' - # NOTE: Build a source distribution tarball instead of using the source files directly. The effect is that the package is built as if it were published on hackage. This can be used as a test for the source distribution, assuming the build fails when packaging mistakes are in the cabal file. - buildFromSdist='false' - # NOTE: Build the package in a strict way to uncover potential problems. This includes buildFromSdist and failOnAllWarnings. - # 2020-05-26: NOTE: Currently HNix not able to pass Strict on GHC 8.8.3 due to MonalFail migration - buildStrictly='false' - # NOTE: Disable core optimizations, significantly speeds up the build - disableOptimization='true' - # NOTE: Modify a Haskell package to add shell completion scripts for the given executable produced by it. These completion scripts will be picked up automatically if the resulting derivation is installed, e.g. by `nix-env -i`. - # Invocation: - # generateOptparseApplicativeCompletions command pkg - # - # command: name of an executable - # pkg: Haskell package that builds the executables - generateOptparseApplicativeCompletions='false' - # [ "binary1" "binary2" ] - should pass " quotes into Nix interpreter - executableNamesToShellComplete='[ "hnix" ]' - # NOTE: Don't fail at configure time if there are multiple versions of the same package in the (recursive) dependencies of the package being built. Will delay failures, if any, to compile time. - allowInconsistentDependencies='false' - # NOTE: Log file to dump GHCJS build into + # - ghcjsTmpLogFile='/tmp/ghcjsTmpLogFile.log' - # NOTE: Length of the GHCJS log tail (<40000) - ghcjsLogTailLength='10000' # 2020-05-26: NOTE: Currently newest Travis dist Ubuntu 18.04 bionic diff --git a/build.sh b/build.sh index 44ea488..08db2e8 100755 --- a/build.sh +++ b/build.sh @@ -2,10 +2,12 @@ # NOTE: Script for the CI builds, relies on `default.nix` interface, which exposes Nixpkgs Haskell Lib interface -# NOTE: The most strict error checking requirements +# The most strict error checking requirements set -Eexuo pipefail ### NOTE: Section handles imports from env, these are settings for Nixpkgs. +# Some of these options implicitly switch the dependent options. + # NOTE: If var not imported - set to the default value GHCVERSION=${GHCVERSION:-'ghc8101'} @@ -24,12 +26,11 @@ rev=${rev:-'nixpkgs-unstable'} # If NIX_PATH not imported - construct it from `rev` NIX_PATH=${NIX_PATH:-"nixpkgs=https://github.com/nixos/nixpkgs/archive/$rev.tar.gz"} export NIX_PATH +# NOTE: Project name, used by cachix project=${project:-'defaultProjectName'} # This settings expose most of the Nixpkgs Haskell.lib API: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib.nix -# Some of these options implicitly enable other options they require, and some counterpoint options clash, obviously - # Don't fail at configure time if there are multiple versions of the same package in the (recursive) dependencies of the package being built. Will delay failures, if any, to compile time. allowInconsistentDependencies=${allowInconsistentDependencies:-'false'} @@ -40,13 +41,16 @@ doCheck=${doCheck:-'true'} # Just produce a SDist src tarball sdistTarball=${sdistTarball:-'false'} # Produce SDist tarball and build project from it +# The strict packaging process as used on Hackage. Tests consistency of the Cabal file. buildFromSdist=${buildFromSdist:-'false'} +# Turn all warn into err with {-Wall,-Werror} failOnAllWarnings=${failOnAllWarnings:-'false'} # `failOnAllWarnings` + `buildFromSdist` buildStrictly=${buildStrictly:-'false'} # 2020-06-02: NOTE: enableDeadCodeElimination = true: On GHC =< 8.8.3 macOS build falls due to https://gitlab.haskell.org/ghc/ghc/issues/17283 enableDeadCodeElimination=${enableDeadCodeElimination:-'false'} -# Disable GHC code optimizations for faster dev loops. Enable optimizations for production use or benchmarks. +# Disabled GHC code optimizations make build/tolling/dev loops faster. Works for Haskel IDE Engine and GHCID +# Enable optimizations for production use, and to pass benchmarks. disableOptimization=${disableOptimization:-'true'} # Use faster `gold` ELF linker from GNU binutils instead of older&slower but more versatile GNU linker. Is not available by default since macOS does not have it. linkWithGold=${linkWithGold:-'false'} @@ -71,6 +75,7 @@ enableSharedExecutables=${enableSharedExecutables:-'false'} justStaticExecutables=${justStaticExecutables:-'false'} enableSeparateBinOutput=${enableSeparateBinOutput:-'false'} # Add a post-build check to verify that dependencies declared in the .cabal file are actually used. +# checkUnusedPackages: is `failOnAllWarnings` + `cabal sdist` to ensure all needed files are listed in the Cabal file. Currently uses `packunused` or GHC 8.8 internals, later switches into GHC internal feature. Adds a post-build check to verify that dependencies declared in the cabal file are actually used. checkUnusedPackages=${checkUnusedPackages:-'false'} # Generation and installation of haddock API documentation doHaddock=${doHaddock:-'false'} @@ -78,16 +83,20 @@ doHaddock=${doHaddock:-'false'} doCoverage=${doCoverage:-'false'} # doBenchmark: Dependency checking + compilation and execution for benchmarks listed in the package description file. doBenchmark=${doBenchmark:-'false'} -# NOTE: *Oprparse* key is redifined in the code further +# For binaries named in `executableNamesToShellComplete` list, generate and bundle-into package an automatically loaded shell complettions generateOptparseApplicativeCompletions=${generateOptparseApplicativeCompletions:-'false'} +# [ "binary1" "binary2" ] - should pass " quotes into Nix interpreter executableNamesToShellComplete=${executableNamesToShellComplete:-'[ "defaultBinaryName" ]'} # Include Hoogle into derivation withHoogle=${withHoogle:-'false'} +# Log file to dump GHCJS build into ghcjsTmpLogFile=${ghcjsTmpLogFile:-'/tmp/ghcjsTmpLogFile.log'} +# Length of the GHCJS log tail (<40000) ghcjsLogTailLength=${ghcjsLogTailLength:-'10000'} -# NOTE: If key not provided (branch is not inside the central repo) - init CACHIX_SIGNING_KEY as empty + +# If key not provided (branch is not inside the central repo) - init CACHIX_SIGNING_KEY as empty CACHIX_SIGNING_KEY=${CACHIX_SIGNING_KEY:-""}