From 7cba5b2043e6ce7127c09fc155fe1b86d96703a0 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 23 Jun 2020 20:14:49 +0300 Subject: [PATCH 01/10] CI: .travis.yml: rm NOTEs from less important explanations M .travis.yml --- .travis.yml | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1bfc64d..3bce6f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,16 +8,16 @@ version: ~> 1.0 language: nix -sudo: required # 2020-05-26: NOTE: This mode is deprecated, but still offers 7.5 GB RAM instead of the default 4GB +sudo: required # 2020-05-26: This mode is deprecated, but still offers 7.5 GB RAM instead of the default 4GB git: - quiet: true # NOTE: Do not log + quiet: true # Do not log depth: 4 # NOTE: "The use of clone depth: 1 often results in a git error # when a new commit has been pushed to a branch before the CI # platform started cloning the intended commit." -# # 2020-05-26: NOTE: Currently newest macOS image -# osx_image: xcode11.4 # NOTE: Official Nix installer fails spectacularly on it. +# # 2020-05-26: Currently newest macOS image +# osx_image: xcode11.4 # Official Nix installer fails spectacularly on it. env: global: @@ -54,8 +54,8 @@ env: - ghcjsTmpLogFile='/tmp/ghcjsTmpLogFile.log' - ghcjsLogTailLength='10000' -# 2020-05-26: NOTE: Currently newest Travis dist Ubuntu 18.04 bionic -# NOTE: {os} x {jobs} + {jobs:include} - {jobs:exclude} = {build matrix} +# 2020-05-26: Currently newest Travis dist Ubuntu 18.04 bionic +# {os} x {jobs} + {jobs:include} - {jobs:exclude} = {build matrix} jobs: include: - name: GHC 8.4.4, Linux @@ -100,12 +100,12 @@ before_script: - sudo mkdir -p /etc/nix - echo "trusted-users = root $USER" | sudo tee -a /etc/nix/nix.conf # - # NOTE: Update Nix and Nix packages, Cachix requires that + # Update Nix and Nix packages, Cachix requires that - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then nix upgrade-nix; fi - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then sudo nix upgrade-nix; fi # - # NOTE: macOS service restart - # HACK: Because Nix can not update its daemon itself between 2.0 -> 2.2: + # macOS service restart + # HACK: Because Nix can not itself update its daemon between 2.0 -> 2.2: # 1. https://github.com/NixOS/nix/issues/3125#issuecomment-539667327 # 2. https://github.com/NixOS/nix/issues/3125#issuecomment-539771768 # Since Nix on macOS has problems restarting the service: @@ -123,13 +123,12 @@ before_script: script: # # - # NOTE: Install Cachix client using Nix: + # 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 "$project" - # NOTE: If key is set - use Cachix push, else - proceed without it + # If key is set - use Cachix push, else - proceed without it - if [ ! "$CACHIX_SIGNING_KEY" = "" ]; then cachix push "$project" --watch-store& fi - # NOTE: Brush timeout for previous daemon to start # # # NOTE: Normal GHC build @@ -149,7 +148,7 @@ script: # -# NOTE: Track the commits on this repo branches + cron rechecks build +# Track the commits on this repo branches + cron rechecks build branches: only: - master @@ -159,8 +158,8 @@ notifications: webhooks: urls: - https://webhooks.gitter.im/e/b0312b18473340459d3e - # NOTE: Be silent about CI, until some PR started to pass CI succesfully. + # Be silent about CI, until some PR started to pass CI succesfully. on_success: change - # NOTE: `master` status in on the front page badge. + # `master` status in on the front page badge. on_failure: never on_start: never From 962af5d6ba485b3ad3a7871a789c257a5ded7237 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 23 Jun 2020 20:29:13 +0300 Subject: [PATCH 02/10] CI: .travis.yml: {add,set,sort} features from `build.sh` explicitly M .travis.yml --- .travis.yml | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3bce6f0..5beee5e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,21 +35,33 @@ env: - project='hnix' # Enable all our tests in Cabal - ALL_TESTS='yes' - - failOnAllWarnings='false' - - checkUnusedPackages='false' - - doCoverage='false' - - doHaddock='false' + - allowInconsistentDependencies='false' - doJailbreak='false' - doCheck='true' - - doBenchmark='false' - - enableExecutableProfiling='false' - - enableLibraryProfiling='false' + - sdistTarball='false' - buildFromSdist='false' - buildStrictly='false' + - failOnAllWarnings='false' + - enableDeadCodeElimination='false' - disableOptimization='true' + - linkWithGold='false' + - enableLibraryProfiling='false' + - enableExecutableProfiling='false' + - doTracing='false' + - enableDWARFDebugging='false' + - doStrip='false' + - enableSharedLibraries='true' + - enableStaticLibraries='false' + - enableSharedExecutables='false' + - justStaticExecutables='false' + - enableSeparateBinOutput='false' + - checkUnusedPackages='false' + - doHaddock='false' + - doHyperlinkSource='false' + - doCoverage='false' + - doBenchmark='false' - generateOptparseApplicativeCompletions='false' - executableNamesToShellComplete='[ "hnix" ]' - - allowInconsistentDependencies='false' # - ghcjsTmpLogFile='/tmp/ghcjsTmpLogFile.log' - ghcjsLogTailLength='10000' From 5d0a09f3b4e8e53d559a57f3a6a51dd9a04c7b8f Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 23 Jun 2020 20:31:39 +0300 Subject: [PATCH 03/10] CI: build.sh: mv doHyperlinkSource into logical place M build.sh --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 08db2e8..fef1436 100755 --- a/build.sh +++ b/build.sh @@ -63,8 +63,6 @@ doTracing=${doTracing:-'false'} enableDWARFDebugging=${enableDWARFDebugging:-'false'} # Strip results from all debugging symbols doStrip=${doStrip:-'false'} -# Generate hyperlinked source code for documentation using HsColour, and have Haddock documentation link to it. -doHyperlinkSource=${doHyperlinkSource:-'false'} # Nixpkgs expects shared libraries enableSharedLibraries=${enableSharedLibraries:-'true'} # Ability to make static libraries @@ -79,6 +77,8 @@ enableSeparateBinOutput=${enableSeparateBinOutput:-'false'} checkUnusedPackages=${checkUnusedPackages:-'false'} # Generation and installation of haddock API documentation doHaddock=${doHaddock:-'false'} +# Generate hyperlinked source code for documentation using HsColour, and have Haddock documentation link to it. +doHyperlinkSource=${doHyperlinkSource:-'false'} # Generation and installation of a coverage report. See https://wiki.haskell.org/Haskell_program_coverage doCoverage=${doCoverage:-'false'} # doBenchmark: Dependency checking + compilation and execution for benchmarks listed in the package description file. From 3d9b0dae01e2b8a8e12be94b096b9ec079827a49 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 23 Jun 2020 20:35:43 +0300 Subject: [PATCH 04/10] CI: .travis.yml: upd the disclaimer M .travis.yml --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5beee5e..188269d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,8 +26,9 @@ env: ### ### 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` + ### Documentation of this settings is mosly in `default.nix`, since most settings it Nixpkgs related + ### and the other part of keys explained in `build.sh`, since those address external procedures aound the builds. + ### Additional documentation is in Nixpkgs Haskell.lib: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib.nix ### # # - rev=nixos-unstable From ebc8cb3de5d20125506c90f9154540aa1509dadf Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 23 Jun 2020 20:37:18 +0300 Subject: [PATCH 05/10] CI: .travis.yml: rm ALL_TESTS, since it does not work for nix-build and also just plainly does not passes itself, so it is useless in CI build setup M .travis.yml --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 188269d..dd40096 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,8 +34,6 @@ env: # - rev=nixos-unstable # - NIX_PATH="nixpkgs=https://github.com/nixos/nixpkgs/archive/$rev.tar.gz" - project='hnix' - # Enable all our tests in Cabal - - ALL_TESTS='yes' - allowInconsistentDependencies='false' - doJailbreak='false' - doCheck='true' From 14acf24ba5c3b441a7af8024662e558d66f16faa Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 23 Jun 2020 20:44:11 +0300 Subject: [PATCH 06/10] CI: .travis.yml: upd CACHIX_SIGNING_KEY explanation M .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dd40096..e5c4add 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ git: env: global: - # NOTE: This is secure CACHIX_SIGNING_KEY=val + # NOTE: This is secure CACHIX_SIGNING_KEY=val, it is only available on project internal branches, so Cachix would push only there - secure: "dm6I+M4+V+C7QMTpcSADdKPE633SvmToXZrTbZ7miNDGmMN+/SfHeN2ybi1+PW6oViMlbPN/7J/aEfiGjSJI8vLk72Y4uCWGmpSb8TXZLu6+whnxtZzzW8+z4tsM4048QJg7CF3N/25U8thRFgs3DqUub1Sf3nG9LrNWdz6ZcDQ=" ### ### NOTE: This configuration uses `build.sh` interface, which uses `default.nix` interface, which exposes the Nixpkgs Haskell Lib interface. From 7f5798286ed59e25dfb3bb8d0eb69b38382bed03 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 23 Jun 2020 20:48:49 +0300 Subject: [PATCH 07/10] CI: .travis.yml: GHC 8.10: add Haddock and sources hyperlinking M .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e5c4add..25611ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -92,6 +92,7 @@ jobs: - buildFromSdist='true' - linkWithGold='true' - doHaddock='true' + - doHyperlinkSource='true' - doBenchmark='true' - disableOptimization='false' - enableDeadCodeElimination='true' From 209d0956f575c92008916d8186d4bd6766b780d9 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 23 Jun 2020 21:06:02 +0300 Subject: [PATCH 08/10] CI: {.travis.yml,build.sh}: rename (GHCVERSION->compiler) M .travis.yml M build.sh --- .travis.yml | 18 +++++++++--------- build.sh | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 25611ac..bb46845 100644 --- a/.travis.yml +++ b/.travis.yml @@ -71,24 +71,24 @@ jobs: include: - name: GHC 8.4.4, Linux env: - - GHCVERSION='ghc844' + - compiler='ghc844' - linkWithGold='true' os: linux dist: bionic - name: GHC 8.6.5, Linux env: - - GHCVERSION='ghc865' + - compiler='ghc865' - linkWithGold='true' os: linux dist: bionic - name: GHC 8.8.3, macOS, Strict env: - - GHCVERSION='ghc883' + - compiler='ghc883' - buildStrictly='true' os: osx - name: GHC 8.10.1, Linux, SDist, Optimize, Benchmark, Haddock, Shell Completions env: - - GHCVERSION='ghc8101' + - compiler='ghc8101' - buildFromSdist='true' - linkWithGold='true' - doHaddock='true' @@ -101,11 +101,11 @@ jobs: dist: bionic - name: GHCJS, Linux env: - - GHCVERSION='ghcjs' + - compiler='ghcjs' os: linux dist: bionic allow_failures: - - env: GHCVERSION='ghcjs' + - env: compiler='ghcjs' before_script: - sudo mount -o remount,exec,size=4G,mode=755 /run/user || true @@ -144,7 +144,7 @@ script: # # # NOTE: Normal GHC build - - if [ ! "$GHCVERSION" = 'ghcjs' ]; then ./build.sh; fi + - if [ ! "$compiler" = 'ghcjs' ]; then ./build.sh; fi # # # NOTE: GHCJS build @@ -152,10 +152,10 @@ script: # so `SILENT` mode for it was created # and travis_wait 50 to wait on no outputs (otherwise Travis terminates build in 10 minutes as stale) # and `bash` wrapper so Travis parses `travis_wait` => `if; then; fi` line - - travis_wait 50 bash -c 'if [ "$GHCVERSION" = "ghcjs" ]; then ./build.sh; fi' + - travis_wait 50 bash -c 'if [ "$compiler" = "ghcjs" ]; then ./build.sh; fi' # NOTE: For GHCJS dump the last $ghcjsLogTailLength lines into CI out to see # Since build runs inside `travis_wait` - it was impossible to output log from it - - if [ "$GHCVERSION" = "ghcjs" ]; then tail -n "$ghcjsLogTailLength" "$ghcjsTmpLogFile" && rm "$ghcjsTmpLogFile"; fi + - if [ "$compiler" = "ghcjs" ]; then tail -n "$ghcjsLogTailLength" "$ghcjsTmpLogFile" && rm "$ghcjsTmpLogFile"; fi # # diff --git a/build.sh b/build.sh index fef1436..7fb107b 100755 --- a/build.sh +++ b/build.sh @@ -10,7 +10,7 @@ set -Eexuo pipefail # NOTE: If var not imported - set to the default value -GHCVERSION=${GHCVERSION:-'ghc8101'} +compiler=${compiler:-'ghc8101'} # NOTE: Nix by default uses nixpkgs-unstable channel # Setup for Nixpkgs revision: # `rev` vals in order of freshness -> cache & stability: @@ -137,7 +137,7 @@ BUILD_PROJECT(){ IFS=$'\n\t' -if [ "$GHCVERSION" = "ghcjs" ] +if [ "$compiler" = "ghcjs" ] then # NOTE: GHCJS build @@ -176,7 +176,7 @@ if [ "$GHCVERSION" = "ghcjs" ] --arg generateOptparseApplicativeCompletions "$generateOptparseApplicativeCompletions" \ --arg executableNamesToShellComplete "$executableNamesToShellComplete" \ --arg withHoogle "$withHoogle" \ - ghcjs + "$compiler" else @@ -184,7 +184,7 @@ if [ "$GHCVERSION" = "ghcjs" ] # NOTE: GHC sometimes produces logs so big - that Travis terminates builds, so multiple --quiet nix-build \ --quiet --quiet \ - --argstr compiler "$GHCVERSION" \ + --argstr compiler "$compiler" \ --arg allowInconsistentDependencies "$allowInconsistentDependencies" \ --arg doJailbreak "$doJailbreak" \ --arg doCheck "$doCheck" \ From 1871a91f946851b321c8e164b9c95b2a1f6cb3bb Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 23 Jun 2020 21:06:50 +0300 Subject: [PATCH 09/10] CI: default.nix: add `compiler` explanation M default.nix --- default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/default.nix b/default.nix index ee12716..713752c 100644 --- a/default.nix +++ b/default.nix @@ -1,4 +1,6 @@ -{ compiler ? "ghc883" +{ +# Compiler in a form ghc8101 == GHC 8.10.1, just remove spaces and dots + compiler ? "ghc883" # This settings expose most of the Nixpkgs Haskell.lib API: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib.nix From b33262ccfee56ffb61ceaab39769f79ff9e83aa7 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Wed, 24 Jun 2020 01:53:16 +0300 Subject: [PATCH 10/10] CI: {.travis.yml,build.sh}: upd: make conf work with new Nix installer M .travis.yml M build.sh --- .travis.yml | 32 ++++++++++++-------------------- build.sh | 11 +++-------- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index bb46845..cd054dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -111,33 +111,25 @@ before_script: - sudo mount -o remount,exec,size=4G,mode=755 /run/user || true - sudo mkdir -p /etc/nix - echo "trusted-users = root $USER" | sudo tee -a /etc/nix/nix.conf - # - # Update Nix and Nix packages, Cachix requires that - - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then nix upgrade-nix; fi - - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then sudo nix upgrade-nix; fi - # - # macOS service restart - # HACK: Because Nix can not itself update its daemon between 2.0 -> 2.2: - # 1. https://github.com/NixOS/nix/issues/3125#issuecomment-539667327 - # 2. https://github.com/NixOS/nix/issues/3125#issuecomment-539771768 - # Since Nix on macOS has problems restarting the service: - # Force the real disable, get target file from the symlink, unlink symlink, copy file, and reload service - | - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then true && \ - sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist && \ - export NIX_SERVICE_FILE=$(readlink /Library/LaunchDaemons/org.nixos.nix-daemon.plist) && \ - sudo unlink /Library/LaunchDaemons/org.nixos.nix-daemon.plist && \ - sudo cp -f "$NIX_SERVICE_FILE" /Library/LaunchDaemons/org.nixos.nix-daemon.plist && \ - sudo launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist && \ - sudo launchctl kickstart -k system/org.nixos.nix-daemon && \ + if [ "${TRAVIS_OS_NAME}" = "linux" ]; then true && \ + sudo systemctl stop nix-daemon.service && \ + sudo systemctl daemon-reload && \ + sudo systemctl start nix-daemon.service && \ true; fi + # # macOS service restart + - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then sudo launchctl kickstart -k system/org.nixos.nix-daemon; fi + # update on Linux + - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then nix-channel --update && nix-env -iA nixpkgs.nix; fi + # update on macOS + # 2020-06-24: HACK: Do not ask why different commands on Linux and macOS. IDK, wished they we the same. These are the only commands that worked on according platforms right after the fresh Nix installer rollout. + - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then sudo nix upgrade-nix; fi script: # # # 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 + - if [ "${TRAVIS_OS_NAME}" = "linux" ] || [ "${TRAVIS_OS_NAME}" = "osx" ]; then nix-env -iA cachix -f https://cachix.org/api/v1/install; fi - cachix use "$project" # If key is set - use Cachix push, else - proceed without it - if [ ! "$CACHIX_SIGNING_KEY" = "" ]; then cachix push "$project" --watch-store& fi diff --git a/build.sh b/build.sh index 7fb107b..4047b7e 100755 --- a/build.sh +++ b/build.sh @@ -219,16 +219,11 @@ fi MAIN() { -# 2020-06-01: NOTE: Nix installer installs old Nix version that has bugs that prevented importing Nixpks repository channels, updating to latest Nix since it does not have that bug # NOTE: Overall it is useful to have in CI test builds the latest stable Nix -# NOTE: User-run update for Linux setup -nix upgrade-nix || true -# NOTE: Superuser update for macOS setup -sudo nix upgrade-nix || true +# NOTE: User-run Linux setup old update command, or superuser update for macOS setup +# 2020-06-24: HACK: Do not ask why different commands on Linux and macOS. IDK, wished they we the same. These are the only commands that worked on according platforms right after the fresh Nix installer rollout. +(nix-channel --update && nix-env -iA nixpkgs.nix) || (sudo nix upgrade-nix) -# NOTE: Make channels current -nix-channel --update || true -sudo nix-channel --update || true # NOTE: Secrets are not shared to PRs from forks