Merge pull request #646 from Anton-Latukha/upd-CI-slash-the-docs
CI: merging the docs (`.travis.yml` -> `build.sh`)
This commit is contained in:
commit
d3b789c631
52
.travis.yml
52
.travis.yml
|
@ -23,63 +23,35 @@ 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.
|
||||
###
|
||||
### 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"
|
||||
# NOTE: Project/binary name
|
||||
- name='hnix'
|
||||
# NOTE: Used in the `generateOptparseApplicativeCompletions = true`
|
||||
- pkgName='haskellPackages.hnix'
|
||||
# NOTE: Enable all our tests in cabal
|
||||
- project='hnix'
|
||||
# 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
|
||||
|
@ -154,9 +126,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
|
||||
#
|
||||
#
|
||||
|
|
43
build.sh
43
build.sh
|
@ -1,21 +1,36 @@
|
|||
#!/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
|
||||
# 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'}
|
||||
# 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'}
|
||||
# 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'}
|
||||
# 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'}
|
||||
|
||||
|
@ -26,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'}
|
||||
|
@ -57,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'}
|
||||
|
@ -64,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:-""}
|
||||
|
||||
|
||||
|
@ -209,14 +232,14 @@ sudo nix-channel --update || true
|
|||
|
||||
|
||||
# NOTE: Secrets are not shared to PRs from forks
|
||||
# NOTE: nix-build | cachix push <name> - uploads binaries, runs&works only in the branches of the main repository, so for PRs - else case runs
|
||||
# NOTE: nix-build | cachix push <project> - 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
|
||||
|
||||
|
|
Loading…
Reference in New Issue