Merge pull request #647 from Anton-Latukha/upd-CI-setup
CI: refactor CI setup config Working gradually, need to test CI passage. Now when most docs are removed, it is more obvious where to reduce the NOTEs. Also synchronized the interface explicitness with what `build.sh` provides. Would test and maybe add a new build feature check. Working towards #645 and #637. Renamed `(GHCVERSION->compiler)` to correspond option with the `nix-build` and Nixpkgs Haskell Lib. --- In the middle of work Nix installer got a major release, so also includded a bigger CI refactoring to keep CI working #648
This commit is contained in:
commit
b3f0361468
111
.travis.yml
111
.travis.yml
|
@ -8,79 +8,91 @@ version: ~> 1.0
|
||||||
|
|
||||||
language: nix
|
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:
|
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
|
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
|
# when a new commit has been pushed to a branch before the CI
|
||||||
# platform started cloning the intended commit."
|
# platform started cloning the intended commit."
|
||||||
|
|
||||||
# # 2020-05-26: NOTE: Currently newest macOS image
|
# # 2020-05-26: Currently newest macOS image
|
||||||
# osx_image: xcode11.4 # NOTE: Official Nix installer fails spectacularly on it.
|
# osx_image: xcode11.4 # Official Nix installer fails spectacularly on it.
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
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="
|
- 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.
|
### 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`,
|
### 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`
|
### 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
|
# - rev=nixos-unstable
|
||||||
# - NIX_PATH="nixpkgs=https://github.com/nixos/nixpkgs/archive/$rev.tar.gz"
|
# - NIX_PATH="nixpkgs=https://github.com/nixos/nixpkgs/archive/$rev.tar.gz"
|
||||||
- project='hnix'
|
- project='hnix'
|
||||||
# Enable all our tests in Cabal
|
- allowInconsistentDependencies='false'
|
||||||
- ALL_TESTS='yes'
|
|
||||||
- failOnAllWarnings='false'
|
|
||||||
- checkUnusedPackages='false'
|
|
||||||
- doCoverage='false'
|
|
||||||
- doHaddock='false'
|
|
||||||
- doJailbreak='false'
|
- doJailbreak='false'
|
||||||
- doCheck='true'
|
- doCheck='true'
|
||||||
- doBenchmark='false'
|
- sdistTarball='false'
|
||||||
- enableExecutableProfiling='false'
|
|
||||||
- enableLibraryProfiling='false'
|
|
||||||
- buildFromSdist='false'
|
- buildFromSdist='false'
|
||||||
- buildStrictly='false'
|
- buildStrictly='false'
|
||||||
|
- failOnAllWarnings='false'
|
||||||
|
- enableDeadCodeElimination='false'
|
||||||
- disableOptimization='true'
|
- 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'
|
- generateOptparseApplicativeCompletions='false'
|
||||||
- executableNamesToShellComplete='[ "hnix" ]'
|
- executableNamesToShellComplete='[ "hnix" ]'
|
||||||
- allowInconsistentDependencies='false'
|
|
||||||
#
|
#
|
||||||
- ghcjsTmpLogFile='/tmp/ghcjsTmpLogFile.log'
|
- ghcjsTmpLogFile='/tmp/ghcjsTmpLogFile.log'
|
||||||
- ghcjsLogTailLength='10000'
|
- ghcjsLogTailLength='10000'
|
||||||
|
|
||||||
# 2020-05-26: NOTE: Currently newest Travis dist Ubuntu 18.04 bionic
|
# 2020-05-26: Currently newest Travis dist Ubuntu 18.04 bionic
|
||||||
# NOTE: {os} x {jobs} + {jobs:include} - {jobs:exclude} = {build matrix}
|
# {os} x {jobs} + {jobs:include} - {jobs:exclude} = {build matrix}
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
- name: GHC 8.4.4, Linux
|
- name: GHC 8.4.4, Linux
|
||||||
env:
|
env:
|
||||||
- GHCVERSION='ghc844'
|
- compiler='ghc844'
|
||||||
- linkWithGold='true'
|
- linkWithGold='true'
|
||||||
os: linux
|
os: linux
|
||||||
dist: bionic
|
dist: bionic
|
||||||
- name: GHC 8.6.5, Linux
|
- name: GHC 8.6.5, Linux
|
||||||
env:
|
env:
|
||||||
- GHCVERSION='ghc865'
|
- compiler='ghc865'
|
||||||
- linkWithGold='true'
|
- linkWithGold='true'
|
||||||
os: linux
|
os: linux
|
||||||
dist: bionic
|
dist: bionic
|
||||||
- name: GHC 8.8.3, macOS, Strict
|
- name: GHC 8.8.3, macOS, Strict
|
||||||
env:
|
env:
|
||||||
- GHCVERSION='ghc883'
|
- compiler='ghc883'
|
||||||
- buildStrictly='true'
|
- buildStrictly='true'
|
||||||
os: osx
|
os: osx
|
||||||
- name: GHC 8.10.1, Linux, SDist, Optimize, Benchmark, Haddock, Shell Completions
|
- name: GHC 8.10.1, Linux, SDist, Optimize, Benchmark, Haddock, Shell Completions
|
||||||
env:
|
env:
|
||||||
- GHCVERSION='ghc8101'
|
- compiler='ghc8101'
|
||||||
- buildFromSdist='true'
|
- buildFromSdist='true'
|
||||||
- linkWithGold='true'
|
- linkWithGold='true'
|
||||||
- doHaddock='true'
|
- doHaddock='true'
|
||||||
|
- doHyperlinkSource='true'
|
||||||
- doBenchmark='true'
|
- doBenchmark='true'
|
||||||
- disableOptimization='false'
|
- disableOptimization='false'
|
||||||
- enableDeadCodeElimination='true'
|
- enableDeadCodeElimination='true'
|
||||||
|
@ -89,51 +101,42 @@ jobs:
|
||||||
dist: bionic
|
dist: bionic
|
||||||
- name: GHCJS, Linux
|
- name: GHCJS, Linux
|
||||||
env:
|
env:
|
||||||
- GHCVERSION='ghcjs'
|
- compiler='ghcjs'
|
||||||
os: linux
|
os: linux
|
||||||
dist: bionic
|
dist: bionic
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- env: GHCVERSION='ghcjs'
|
- env: compiler='ghcjs'
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- sudo mount -o remount,exec,size=4G,mode=755 /run/user || true
|
- sudo mount -o remount,exec,size=4G,mode=755 /run/user || true
|
||||||
- sudo mkdir -p /etc/nix
|
- sudo mkdir -p /etc/nix
|
||||||
- echo "trusted-users = root $USER" | sudo tee -a /etc/nix/nix.conf
|
- echo "trusted-users = root $USER" | sudo tee -a /etc/nix/nix.conf
|
||||||
#
|
|
||||||
# NOTE: 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:
|
|
||||||
# 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 && \
|
if [ "${TRAVIS_OS_NAME}" = "linux" ]; then true && \
|
||||||
sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist && \
|
sudo systemctl stop nix-daemon.service && \
|
||||||
export NIX_SERVICE_FILE=$(readlink /Library/LaunchDaemons/org.nixos.nix-daemon.plist) && \
|
sudo systemctl daemon-reload && \
|
||||||
sudo unlink /Library/LaunchDaemons/org.nixos.nix-daemon.plist && \
|
sudo systemctl start nix-daemon.service && \
|
||||||
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 && \
|
|
||||||
true; fi
|
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:
|
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}" = "linux" ] || [ "${TRAVIS_OS_NAME}" = "osx" ]; 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"
|
- 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
|
- if [ ! "$CACHIX_SIGNING_KEY" = "" ]; then cachix push "$project" --watch-store& fi
|
||||||
# NOTE: Brush timeout for previous daemon to start
|
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# NOTE: Normal GHC build
|
# NOTE: Normal GHC build
|
||||||
- if [ ! "$GHCVERSION" = 'ghcjs' ]; then ./build.sh; fi
|
- if [ ! "$compiler" = 'ghcjs' ]; then ./build.sh; fi
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# NOTE: GHCJS build
|
# NOTE: GHCJS build
|
||||||
|
@ -141,15 +144,15 @@ script:
|
||||||
# so `SILENT` mode for it was created
|
# 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 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
|
# 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
|
# 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
|
# 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
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
# NOTE: Track the commits on this repo branches + cron rechecks build
|
# Track the commits on this repo branches + cron rechecks build
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
@ -159,8 +162,8 @@ notifications:
|
||||||
webhooks:
|
webhooks:
|
||||||
urls:
|
urls:
|
||||||
- https://webhooks.gitter.im/e/b0312b18473340459d3e
|
- 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
|
on_success: change
|
||||||
# NOTE: `master` status in on the front page badge.
|
# `master` status in on the front page badge.
|
||||||
on_failure: never
|
on_failure: never
|
||||||
on_start: never
|
on_start: never
|
||||||
|
|
23
build.sh
23
build.sh
|
@ -10,7 +10,7 @@ set -Eexuo pipefail
|
||||||
|
|
||||||
|
|
||||||
# NOTE: If var not imported - set to the default value
|
# NOTE: If var not imported - set to the default value
|
||||||
GHCVERSION=${GHCVERSION:-'ghc8101'}
|
compiler=${compiler:-'ghc8101'}
|
||||||
# NOTE: Nix by default uses nixpkgs-unstable channel
|
# NOTE: Nix by default uses nixpkgs-unstable channel
|
||||||
# Setup for Nixpkgs revision:
|
# Setup for Nixpkgs revision:
|
||||||
# `rev` vals in order of freshness -> cache & stability:
|
# `rev` vals in order of freshness -> cache & stability:
|
||||||
|
@ -63,8 +63,6 @@ doTracing=${doTracing:-'false'}
|
||||||
enableDWARFDebugging=${enableDWARFDebugging:-'false'}
|
enableDWARFDebugging=${enableDWARFDebugging:-'false'}
|
||||||
# Strip results from all debugging symbols
|
# Strip results from all debugging symbols
|
||||||
doStrip=${doStrip:-'false'}
|
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
|
# Nixpkgs expects shared libraries
|
||||||
enableSharedLibraries=${enableSharedLibraries:-'true'}
|
enableSharedLibraries=${enableSharedLibraries:-'true'}
|
||||||
# Ability to make static libraries
|
# Ability to make static libraries
|
||||||
|
@ -79,6 +77,8 @@ enableSeparateBinOutput=${enableSeparateBinOutput:-'false'}
|
||||||
checkUnusedPackages=${checkUnusedPackages:-'false'}
|
checkUnusedPackages=${checkUnusedPackages:-'false'}
|
||||||
# Generation and installation of haddock API documentation
|
# Generation and installation of haddock API documentation
|
||||||
doHaddock=${doHaddock:-'false'}
|
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
|
# Generation and installation of a coverage report. See https://wiki.haskell.org/Haskell_program_coverage
|
||||||
doCoverage=${doCoverage:-'false'}
|
doCoverage=${doCoverage:-'false'}
|
||||||
# doBenchmark: Dependency checking + compilation and execution for benchmarks listed in the package description file.
|
# doBenchmark: Dependency checking + compilation and execution for benchmarks listed in the package description file.
|
||||||
|
@ -137,7 +137,7 @@ BUILD_PROJECT(){
|
||||||
|
|
||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
if [ "$GHCVERSION" = "ghcjs" ]
|
if [ "$compiler" = "ghcjs" ]
|
||||||
then
|
then
|
||||||
|
|
||||||
# NOTE: GHCJS build
|
# NOTE: GHCJS build
|
||||||
|
@ -176,7 +176,7 @@ if [ "$GHCVERSION" = "ghcjs" ]
|
||||||
--arg generateOptparseApplicativeCompletions "$generateOptparseApplicativeCompletions" \
|
--arg generateOptparseApplicativeCompletions "$generateOptparseApplicativeCompletions" \
|
||||||
--arg executableNamesToShellComplete "$executableNamesToShellComplete" \
|
--arg executableNamesToShellComplete "$executableNamesToShellComplete" \
|
||||||
--arg withHoogle "$withHoogle" \
|
--arg withHoogle "$withHoogle" \
|
||||||
ghcjs
|
"$compiler"
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ if [ "$GHCVERSION" = "ghcjs" ]
|
||||||
# NOTE: GHC sometimes produces logs so big - that Travis terminates builds, so multiple --quiet
|
# NOTE: GHC sometimes produces logs so big - that Travis terminates builds, so multiple --quiet
|
||||||
nix-build \
|
nix-build \
|
||||||
--quiet --quiet \
|
--quiet --quiet \
|
||||||
--argstr compiler "$GHCVERSION" \
|
--argstr compiler "$compiler" \
|
||||||
--arg allowInconsistentDependencies "$allowInconsistentDependencies" \
|
--arg allowInconsistentDependencies "$allowInconsistentDependencies" \
|
||||||
--arg doJailbreak "$doJailbreak" \
|
--arg doJailbreak "$doJailbreak" \
|
||||||
--arg doCheck "$doCheck" \
|
--arg doCheck "$doCheck" \
|
||||||
|
@ -219,16 +219,11 @@ fi
|
||||||
MAIN() {
|
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: Overall it is useful to have in CI test builds the latest stable Nix
|
||||||
# NOTE: User-run update for Linux setup
|
# NOTE: User-run Linux setup old update command, or superuser update for macOS setup
|
||||||
nix upgrade-nix || true
|
# 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.
|
||||||
# NOTE: Superuser update for macOS setup
|
(nix-channel --update && nix-env -iA nixpkgs.nix) || (sudo nix upgrade-nix)
|
||||||
sudo nix upgrade-nix || true
|
|
||||||
|
|
||||||
# NOTE: Make channels current
|
|
||||||
nix-channel --update || true
|
|
||||||
sudo nix-channel --update || true
|
|
||||||
|
|
||||||
|
|
||||||
# NOTE: Secrets are not shared to PRs from forks
|
# NOTE: Secrets are not shared to PRs from forks
|
||||||
|
|
|
@ -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
|
# This settings expose most of the Nixpkgs Haskell.lib API: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib.nix
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue