streamly/.circleci/config.yml
2024-04-30 00:22:45 +05:30

219 lines
7.6 KiB
YAML

version: 2.1
#-----------------------------------------------------------------------------
# packcheck-0.7.0
# Packcheck global environment variables
#-----------------------------------------------------------------------------
env: &env
environment:
# ------------------------------------------------------------------------
# Common options
# ------------------------------------------------------------------------
# GHC_OPTIONS: "-Werror"
# For updating see: https://downloads.haskell.org/~ghcup/
GHCUP_VERSION: 0.1.20.0
CABAL_REINIT_CONFIG: "y"
LC_ALL: "C.UTF-8"
# ------------------------------------------------------------------------
# What to build
# ------------------------------------------------------------------------
# DISABLE_TEST: "y"
# DISABLE_BENCH: "y"
# DISABLE_DOCS: "y"
# DISABLE_SDIST_BUILD: "y"
# DISABLE_DIST_CHECKS: "y"
# ------------------------------------------------------------------------
# stack options
# ------------------------------------------------------------------------
# Note requiring a specific version of stack using STACKVER may fail due to
# github API limit while checking and upgrading/downgrading to the specific
# version.
#STACKVER: "1.6.5"
STACK_UPGRADE: "y"
#RESOLVER: "lts-12"
# ------------------------------------------------------------------------
# cabal options
# ------------------------------------------------------------------------
CABAL_CHECK_RELAX: "y"
CABAL_BUILD_OPTIONS: "-j1 --flag limit-build-mem"
# ------------------------------------------------------------------------
# Where to find the required tools
# ------------------------------------------------------------------------
PATH: /sbin:/usr/sbin:/bin:/usr/bin
# ------------------------------------------------------------------------
# Location of packcheck.sh (the shell script invoked to perform CI tests ).
# ------------------------------------------------------------------------
# You can either commit the packcheck.sh script at this path in your repo or
# you can use it by specifying the PACKCHECK_REPO_URL option below in which
# case it will be automatically copied from the packcheck repo to this path
# during CI tests. In any case it is finally invoked from this path.
PACKCHECK: "./packcheck.sh"
# If you have not committed packcheck.sh in your repo at PACKCHECK
# then it is automatically pulled from this URL.
PACKCHECK_GITHUB_URL: "https://raw.githubusercontent.com/composewell/packcheck"
PACKCHECK_GITHUB_COMMIT: "101c73b53473ddfb763d65058b80123991cfeb4f"
executors:
amd64-executor:
docker:
- image: ubuntu:latest
x86-executor:
docker:
- image: i386/ubuntu:focal
#-----------------------------------------------------------------------------
# Common utility stuff, not to be modified usually
#-----------------------------------------------------------------------------
preinstall: &preinstall
run: |
apt-get update
# required for https/cache save and restore
apt-get install -y ca-certificates
# Alternative way of installing ghc and cabal, directly from
# haskell.org instead of using ghcup. NOTE: this is for Debian
# only and is debian release specific.
# gnupg is required for apt-key to work
#apt-get install -y gnupg
#apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574
#echo "deb http://downloads.haskell.org/debian buster main" >> /etc/apt/sources.list
#apt-get update
# required for outbound https for stack and for stack setup
apt-get install -y netbase xz-utils make
apt-get install -y zlib1g-dev
# For ghcup to install ghc
if test -n "$GHCUP_VERSION"
then
apt-get install -y gcc
apt-get install -y g++
fi
# libgmp required by ghc for linking
apt-get install -y libgmp-dev
apt-get install -y libtinfo-dev
# Required by cabal when git URL is specified in project file
apt-get install -y git
# Required for and by packcheck
apt-get install -y curl
# Get packcheck if needed
if test ! -e "$PACKCHECK"
then
if test -z "$PACKCHECK_GITHUB_COMMIT"
then
die "PACKCHECK_GITHUB_COMMIT is not specified."
fi
PACKCHECK_URL=${PACKCHECK_GITHUB_URL}/${PACKCHECK_GITHUB_COMMIT}/packcheck.sh
curl --fail -sL -o "$PACKCHECK" $PACKCHECK_URL || exit 1
chmod +x $PACKCHECK
elif test ! -x "$PACKCHECK"
then
chmod +x $PACKCHECK
fi
restore: &restore
# Needs to happen after installing ca-certificates
restore_cache:
keys:
- v1-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}
# Fallback to master branch's cache.
- v1-{{ .Environment.CIRCLE_JOB }}-master
# Fallback to any branch's cache.
- v1-{{ .Environment.CIRCLE_JOB }}-
save: &save
save_cache:
key: v1-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}
paths:
- ~/.local
- ~/.cabal
- ~/.stack
- ~/.ghcup
#-----------------------------------------------------------------------------
# Build matrix
#-----------------------------------------------------------------------------
jobs:
cabal-ghc-8_6_5:
<<: *env
executor: amd64-executor
steps:
- checkout
- *restore
- *preinstall
- run:
environment:
GHCVER: "8.6.5"
CABAL_VERSION: "3.6.2.0"
CABAL_PROJECT: "cabal.project"
DISABLE_SDIST_BUILD: "yes"
CABAL_BUILD_OPTIONS: "--flag debug --flag -opt"
command: |
bash -c "$PACKCHECK cabal"
- *save
cabal-ghc-9_8_1-docspec:
<<: *env
executor: amd64-executor
steps:
- checkout
- *restore
- *preinstall
- run:
environment:
GHCVER: "9.8.1"
CABAL_VERSION: "3.10.1.0"
CABAL_PROJECT: "cabal.project.doctest"
DISABLE_SDIST_BUILD: "y"
DISABLE_TEST: "y"
DISABLE_BENCH: "y"
DISABLE_DOCS: "y"
ENABLE_DOCSPEC: "y"
DOCSPEC_URL: https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20210111/cabal-docspec-0.0.0.20210111.xz
DOCSPEC_OPTIONS: "--timeout 60 --check-properties --property-variables xs"
command: |
bash -c "$PACKCHECK cabal"
- *save
hlint-trailing-spaces:
<<: *env
executor: amd64-executor
steps:
- checkout
- *restore
- *preinstall
- run:
name: hlint and trailing spaces
environment:
DISABLE_SDIST_BUILD: "yes"
HLINT_VERSION: 3.6.1
HLINT_OPTIONS: lint
HLINT_TARGETS: core/src src test benchmark
command: |
bash -c "$PACKCHECK hlint" || exit 1
echo "Checking trailing spaces..."
count=$(find . -name "*.hs" -exec grep -H '\ $' {} \; | tee /dev/tty | wc -l)
exit $count
- *save
workflows:
version: 2
build:
jobs:
#- cabal-ghc-8_6_5:
# name: 8.6.5-debug-unoptimized
- cabal-ghc-9_8_1-docspec:
name: ghc-9.8.1-docspec
- hlint-trailing-spaces:
name: hlint and trailing spaces