mirror of
https://github.com/haskell/haskell-language-server.git
synced 2024-09-11 08:45:35 +03:00
95 lines
2.7 KiB
YAML
95 lines
2.7 KiB
YAML
defaults: &defaults
|
|
working_directory: ~/build
|
|
docker:
|
|
- image: alanz/haskell-hie-ci
|
|
resource_class: large
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Save resolver field into file
|
|
command: grep '^resolver:' ${STACK_FILE} > resolver.txt
|
|
|
|
- restore_cache:
|
|
keys:
|
|
- v4-stack-cache-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "resolver.txt" }}
|
|
|
|
# Looking for the string [skip circleci] in all the json returned by https://docs.github.com/en/rest/reference/pulls#get-a-pull-request
|
|
- run:
|
|
name: Skip ci setup
|
|
command: |
|
|
set +e
|
|
echo "CIRCLE_PULL_REQUEST: $CIRCLE_PULL_REQUEST"
|
|
if [[ ! -z $CIRCLE_PULL_REQUEST ]]; then
|
|
PULL_REQUEST_URL=${CIRCLE_PULL_REQUEST/github.com/api.github.com/repos}
|
|
PULL_REQUEST_URL=${PULL_REQUEST_URL/pull/pulls}
|
|
echo "PULL_REQUEST_URL: $PULL_REQUEST_URL"
|
|
SKIP_CI=$(curl $PULL_REQUEST_URL | grep -o "\\[skip circleci\\]")
|
|
if [[ -z "$SKIP_CI" ]]; then
|
|
PULL_REQUEST_COMMENTS_URL=${PULL_REQUEST_URL/pulls/issues}/comments
|
|
echo "PULL_REQUEST_COMMENTS_URL: $PULL_REQUEST_COMMENTS_URL"
|
|
SKIP_CI=$(curl $PULL_REQUEST_COMMENTS_URL | grep -o "\\[skip circleci\\]")
|
|
fi
|
|
echo "SKIP_CI: $SKIP_CI"
|
|
fi
|
|
echo "export SKIP_CI=$SKIP_CI" >> $BASH_ENV
|
|
|
|
- run:
|
|
name: Stack upgrade
|
|
command: |
|
|
if [[ -z "$SKIP_CI" ]]; then
|
|
stack upgrade
|
|
fi
|
|
|
|
- run:
|
|
name: Stack setup
|
|
command: |
|
|
if [[ -z "$SKIP_CI" ]]; then
|
|
stack -j4 --stack-yaml=${STACK_FILE} setup
|
|
fi
|
|
|
|
- run:
|
|
name: Build (we need the exe for tests)
|
|
# need j1, else ghc-lib-parser triggers OOM
|
|
command: |
|
|
if [[ -z "$SKIP_CI" ]]; then
|
|
stack -j4 --stack-yaml=${STACK_FILE} install --no-terminal
|
|
fi
|
|
no_output_timeout: 30m
|
|
|
|
- run:
|
|
name: Build Testsuite without running it
|
|
command: |
|
|
if [[ -z "$SKIP_CI" ]]; then
|
|
stack -j4 --stack-yaml=${STACK_FILE} build --test --no-run-tests --no-terminal
|
|
fi
|
|
no_output_timeout: 30m
|
|
|
|
- store_artifacts:
|
|
path: ~/.local/bin
|
|
destination: bin
|
|
|
|
- save_cache:
|
|
key: v4-stack-cache-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "resolver.txt" }}
|
|
paths: &cache_paths
|
|
- ~/.stack
|
|
|
|
version: 2
|
|
jobs:
|
|
stackage-lts19:
|
|
environment:
|
|
- STACK_FILE: "stack-lts19.yaml"
|
|
<<: *defaults
|
|
|
|
stackage-nightly:
|
|
environment:
|
|
- STACK_FILE: "stack.yaml"
|
|
<<: *defaults
|
|
|
|
|
|
workflows:
|
|
version: 2
|
|
multiple-ghcs:
|
|
jobs:
|
|
- stackage-lts19
|
|
- stackage-nightly
|