hnix/.travis.yml

194 lines
9.4 KiB
YAML

# 2020-05-26: NOTE: Enabling experimental Travis feature of YAML check inside
# Look into: Build #NUM -> Job #NUM.N -> View config -> Build config validation
version: ~> 1.0
# NOTE: Please, be aware that Travis YAML & docs & API are hard to make work properly. Travis configuration requires a lot of retries and some compromises. There are many ways that may look like that can be done in that way, but it would not work most of the time, or not work the way that you expect/need it. Travis config works only in certain particular ways. Some things look possible - but they are impossible in Travis. Current configuration is "the best way possible" that was found in ~100-150-200 retries, depending on what one considers a retry.
# NOTE: Let the official Travis YAML checker help you: https://config.travis-ci.com/explore
language: nix
sudo: required # 2020-05-26: NOTE: This mode is deprecated, but still offers 7.5 GB RAM instead of the default 4GB
git:
quiet: true # NOTE: 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.
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
# }
# - 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
- 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'
- 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
# NOTE: {os} x {jobs} + {jobs:include} - {jobs:exclude} = {build matrix}
jobs:
include:
- name: GHC 8.4.4, Linux
env:
- GHCVERSION='ghc844'
- linkWithGold='true'
os: linux
dist: bionic
- name: GHC 8.6.5, Linux
env:
- GHCVERSION='ghc865'
- linkWithGold='true'
os: linux
dist: bionic
- name: GHC 8.8.3, macOS, Strict
env:
- GHCVERSION='ghc883'
- buildStrictly='true'
os: osx
- name: GHC 8.10.1, Linux, SDist, Optimize, Benchmark, Haddock, Shell Completions
env:
- GHCVERSION='ghc8101'
- buildFromSdist='true'
- linkWithGold='true'
- doHaddock='true'
- doBenchmark='true'
- disableOptimization='false'
- enableDeadCodeElimination='true'
- generateOptparseApplicativeCompletions='true'
os: linux
dist: bionic
- name: GHCJS, Linux
env:
- GHCVERSION='ghcjs'
os: linux
dist: bionic
allow_failures:
- env: GHCVERSION='ghcjs'
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
#
# 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 && \
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 && \
true; fi
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"
# NOTE: If key is set - use Cachix push, else - proceed without it
- if [ ! "$CACHIX_SIGNING_KEY" = "" ]; then cachix push "$name" --watch-store& fi
# NOTE: Brush timeout for previous daemon to start
#
#
# NOTE: Normal GHC build
- if [ ! "$GHCVERSION" = 'ghcjs' ]; then ./build.sh; fi
#
#
# NOTE: GHCJS build
# HACK: Travis terminates GHCJS because of very huge log,
# 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'
# 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
#
#
# NOTE: Track the commits on this repo branches + cron rechecks build
branches:
only:
- master
- pending
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/b0312b18473340459d3e
# NOTE: Be silent about CI, until some PR started to pass CI succesfully.
on_success: change
# NOTE: `master` status in on the front page badge.
on_failure: never
on_start: never