haskell-language-server/.circleci/config.yml
2020-08-09 11:38:41 +01:00

200 lines
6.0 KiB
YAML

defaults: &defaults
working_directory: ~/build
docker:
- image: alanz/haskell-hie-ci
steps:
- checkout
- run:
command: git submodule sync --recursive
- run:
command: git submodule update --recursive --init
- run:
name: Write provided stack.yaml with predictable name
command: cp ${STACK_FILE} stack-build.txt
- run:
name: Figure out resolver for better caching
command: grep '^resolver:' stack-build.txt > resolver.txt
- run:
name: Create a composite cabal file for changes detection
command: find . -name "*.cabal" | grep -v -e "stack-work" -e "dist-newstyle" -e "submodules" -e "testdata" | sort | xargs cat > all-cabal.txt
- restore_cache:
keys:
- stack-cache-{{ .Environment.HIE_CACHE }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "stack-build.txt" }}-{{ checksum "all-cabal.txt" }}
- stack-cache-{{ .Environment.HIE_CACHE }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "stack-build.txt" }}
- stack-cache-{{ .Environment.HIE_CACHE }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "resolver.txt" }}
- run:
name: Stack upgrade
command: stack upgrade
- run:
name: Stack setup
command: stack -j 2 --stack-yaml=${STACK_FILE} setup
- run:
name: Build (we need the exe for tests)
command: stack -j 1 --stack-yaml=${STACK_FILE} install
# need j1, else ghc-lib-parser triggers OOM
no_output_timeout: 30m
- run:
name: Build Testsuite without running it
command: stack --stack-yaml=${STACK_FILE} build --test --no-run-tests
no_output_timeout: 30m
- store_artifacts:
path: ~/.local/bin
destination: bin
- save_cache:
key: stack-cache-{{ .Environment.HIE_CACHE }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "resolver.txt" }}
paths: &cache_paths
- ~/.stack
- ~/build/.stack-work
- ~/build/ghcide/.stack-work
- run:
name: Test ghcide
# Tests MUST run with -j1, since multiple ghc-mod sessions are not allowed
# command: stack -j 1 --stack-yaml=${STACK_FILE} test ghcide --dump-logs
command: echo "ghcide tests disabled until they got fixed, see https://github.com/mpickering/ghcide/issues/25"
no_output_timeout: 120m
- run:
name: Test haskell-language-server
# Tasty by default will run all the tests in parallel. Which should
# work ok, but given that these CircleCI runners aren't the beefiest
# machine can cause some flakiness. So pass -j1 to Tasty (NOT Stack) to
# tell it to go slow and steady.
command: stack --stack-yaml=${STACK_FILE} test haskell-language-server --dump-logs --test-arguments="-j1"
no_output_timeout: 120m
- store_test_results:
path: test-results
- store_artifacts:
path: test-logs
- save_cache:
key: stack-cache-{{ .Environment.HIE_CACHE }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "stack-build.txt" }}-{{ checksum "all-cabal.txt" }}
paths: *cache_paths
version: 2
jobs:
ghc-8.6.4:
environment:
- STACK_FILE: "stack-8.6.4.yaml"
<<: *defaults
ghc-8.6.5:
environment:
- STACK_FILE: "stack-8.6.5.yaml"
<<: *defaults
ghc-8.8.2:
environment:
- STACK_FILE: "stack-8.8.2.yaml"
<<: *defaults
ghc-8.8.3:
environment:
- STACK_FILE: "stack-8.8.3.yaml"
<<: *defaults
ghc-8.8.4:
environment:
- STACK_FILE: "stack-8.8.4.yaml"
<<: *defaults
ghc-8.10.1:
environment:
- STACK_FILE: "stack-8.10.1.yaml"
<<: *defaults
# ghc-nightly:
# environment:
# - STACK_FILE: "stack.yaml"
# <<: *defaults
cabal:
working_directory: ~/build
docker:
- image: haskell:8.10.1
steps:
- checkout
- run:
name: Sync submodules
command: git submodule sync --recursive
- run:
name: Update submodules
command: git submodule update --recursive --init
- restore-cache:
keys:
- cabal-{{ .Environment.HIE_CACHE }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}
- run:
name: Update
command: cabal new-update
- run:
name: Configure
command: cabal new-configure --enable-tests
- run:
name: Build dependencies
command: cabal new-build -j1 --dependencies-only # need j1, else ghc-lib-parser triggers OOM
no_output_timeout: 30m
- save_cache:
key: cabal-{{ .Environment.HIE_CACHE }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}
paths:
- ~/.cabal
- run:
name: Build
command: cabal new-build -j1 # need j1, else ghc-lib-parser triggers OOM
no_output_timeout: 30m
- save_cache:
key: cabal-{{ .Environment.HIE_CACHE }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}
paths:
- ~/.cabal
nix:
working_directory: ~/build
environment:
- NIXPKGS_ALLOW_BROKEN: 1
docker:
- image: nixorg/nix:circleci
steps:
- checkout
- run:
name: Sync submodules
command: git submodule sync --recursive
- run:
name: Update submodules
command: git submodule update --recursive --init
- restore-cache:
keys:
- cabal-{{ .Environment.HIE_CACHE }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}
- run:
name: Build
command: nix-shell -j4 --run "cabal new-update && cabal new-build -j1 --enable-tests"
no_output_timeout: 30m
- save_cache:
key: cabal-{{ .Environment.HIE_CACHE }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}
paths:
- ~/.cabal
workflows:
version: 2
multiple-ghcs:
jobs:
- ghc-8.6.4
- ghc-8.6.5
- ghc-8.8.2
- ghc-8.8.3
- ghc-8.8.4
- ghc-8.10.1
# - ghc-nightly
- cabal
- nix