Skip to content

Commit

Permalink
Merge pull request #2 from haskell-works/upgrade-to-haskell-build-2-1…
Browse files Browse the repository at this point in the history
…-6-16

Upgrade to haskell-build-2@1.6.16
  • Loading branch information
newhoggy authored May 8, 2019
2 parents 340d5cd + c9fe27c commit 2e4ff02
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 285 deletions.
283 changes: 35 additions & 248 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,257 +1,44 @@
defaults: &defaults
working_directory: ~/project
docker:
- image: quay.io/haskell_works/stack-build-cabal:18.04_2018-06-09
version: 2.1

steps:
- checkout
orbs:
haskell: haskell-works/haskell-build-2@1.6.16
github: haskell-works/github-release@1.2.1
hackage: haskell-works/hackage@1.0.0

- run:
name: Remove Cabal file
command: rm -f *.cabal

- run:
name: Copying scripts
command: |
mkdir -p ~/.local/bin
cp ./scripts/* ~/.local/bin
- run:
name: Query resolver & ghc version
command: |
resolver "$(resolver $LTS)" > resolver.version
ghc-version $(cat resolver.version) > ghc.version
- run:
name: Find all sub-projects
command: projects-summary > projects.summary

##### Building library
- restore_cache:
keys:
- stack--nAz6PsL--{{ checksum "ghc.version" }}--{{ .Environment.CACHE_VERSION }}--{{ checksum "projects.summary" }}--{{ checksum "package.yaml" }}--{{ checksum "stack.yaml" }}
- stack--nAz6PsL--{{ checksum "ghc.version" }}--{{ .Environment.CACHE_VERSION }}--{{ checksum "projects.summary" }}--{{ checksum "package.yaml" }}
- stack--nAz6PsL--{{ checksum "ghc.version" }}--{{ .Environment.CACHE_VERSION }}--{{ checksum "projects.summary" }}--
- stack--nAz6PsL--{{ checksum "ghc.version" }}--{{ .Environment.CACHE_VERSION }}--X

- run:
name: Stack setup
command: stack setup --resolver ${LTS}

- save_cache:
key: stack--nAz6PsL--{{ checksum "ghc.version" }}--{{ .Environment.CACHE_VERSION }}--X
paths: [~/.stack, ~/project/.stack-work]

- run:
name: Building dependencies
command: |
stack build --resolver ${LTS} --dependencies-only
stack build --resolver ${LTS} --dependencies-only --test --no-run-tests
- save_cache:
key: stack--nAz6PsL--{{ checksum "ghc.version" }}--{{ .Environment.CACHE_VERSION }}--{{ checksum "projects.summary" }}--{{ checksum "package.yaml" }}
paths: [~/.stack, ~/project/.stack-work]

- run: stack build --resolver ${LTS} --test --no-run-tests

- save_cache:
key: stack--nAz6PsL--{{ checksum "ghc.version" }}--{{ .Environment.CACHE_VERSION }}--{{ checksum "projects.summary" }}--{{ checksum "package.yaml" }}--{{ checksum "stack.yaml" }}
paths: [~/.stack, ~/project/.stack-work]

##### Running tests
- run:
name: Running tests against latest on hackage
command: stack test --resolver ${LTS}

cabalbuild: &cabalbuild
working_directory: ~/project

steps:
- checkout

- run:
name: Add GHC tools to PATH
command: |
echo "HOME=$HOME"
echo "BASH_ENV=$BASH_ENV"
echo "PATH=$PATH"
echo 'export PATH="$PATH:/opt/ghc/bin/"' >> $BASH_ENV
- run:
name: Copying scripts
command: |
mkdir -p ~/.local/bin
cp ./scripts/* ~/.local/bin
- run:
name: GHC version
command: |
echo "$GHC" > ghc.version
date +%Y-%m > month.version
- run:
name: Find all sub-projects
command: ./scripts/projects-summary > projects.summary

- run:
name: Generate cabal file
command: |
rm -f *.cabal
hpack
##### Building library
- restore_cache:
keys:
- cabal--{{ checksum "ghc.version" }}--{{ .Environment.CACHE_VERSION }}--{{ checksum "projects.summary" }}--extra
- cabal--{{ checksum "ghc.version" }}--{{ .Environment.CACHE_VERSION }}--{{ checksum "projects.summary" }}--
- cabal--{{ checksum "ghc.version" }}--{{ .Environment.CACHE_VERSION }}--{{ checksum "month.version"}}

- run:
name: Building build dependencies
command: |
./scripts/mk-cabal-project > cabal.project
cabal update
cabal new-build --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j${CABAL_THREADS:-4} all
cabal new-build --enable-tests --enable-benchmarks --project-file="cabal.project" --dep -j${CABAL_THREADS:-4} all
- save_cache:
key: cabal--{{ checksum "ghc.version" }}--{{ .Environment.CACHE_VERSION }}--{{ checksum "projects.summary" }}--
paths: [~/.cabal/packages, ~/.cabal/store]

- run:
name: Building project
command: |
cabal new-build --enable-tests --enable-benchmarks --project-file="cabal.project" -j${CABAL_THREADS:-4} all
- save_cache:
key: cabal--{{ checksum "ghc.version" }}--{{ .Environment.CACHE_VERSION }}--{{ checksum "projects.summary" }}--extra
paths: [~/.cabal/packages, ~/.cabal/store]

- save_cache:
key: cabal--{{ checksum "ghc.version" }}--{{ .Environment.CACHE_VERSION }}--{{ checksum "month.version"}}
paths: [~/.cabal/packages, ~/.cabal/store]

- run:
name: Running tests
command: |
if grep '^test-suite' *.cabal > /dev/null; then
cabal new-test --enable-tests --project-file="cabal.project" -j${CABAL_THREADS:-4} all
else
echo Not tests to run
fi
version: 2.0
jobs:
ghc-8.6.1:
environment:
- GHC: "ghc8.6.1"
docker:
- image: quay.io/haskell_works/ghc-8.6.1
<<: *cabalbuild

ghc-8.4.3:
environment:
- GHC: "ghc8.4.3"
docker:
- image: quay.io/haskell_works/ghc-8.4.3
<<: *cabalbuild

ghc-8.2.2:
environment:
- GHC: "ghc8.2.2"
docker:
- image: quay.io/haskell_works/ghc-8.2.2
<<: *cabalbuild

lts-12:
environment:
- LTS: "lts-12"
<<: *defaults

checked-builds:
docker:
- image: quay.io/haskell_works/ghc-8.4.3

steps:
- checkout

- run:
name: Add GHC tools to PATH
command: |
echo "HOME=$HOME"
echo "BASH_ENV=$BASH_ENV"
echo "PATH=$PATH"
echo 'export PATH="$PATH:/opt/ghc/bin/"' >> $BASH_ENV
- run:
name: Copying scripts
command: |
mkdir -p ~/.local/bin
cp ./scripts/* ~/.local/bin
- deploy:
command: |
hpack
if [ "$CIRCLE_PROJECT_USERNAME" == "haskell-works" ]; then
if [[ "$CIRCLE_BRANCH" == master ]]; then
when tag autotag
elif [[ "$CIRCLE_TAG" =~ v.* ]]; then
publish
fi
fi
release:
docker:
- image: quay.io/haskell_works/ghc-8.4.3

steps:
- checkout

- run:
name: Add GHC tools to PATH
command: |
echo "HOME=$HOME"
echo "BASH_ENV=$BASH_ENV"
echo "PATH=$PATH"
echo 'export PATH="$PATH:/opt/ghc/bin/"' >> $BASH_ENV
- run:
name: Copying scripts
command: |
mkdir -p ~/.local/bin
cp ./scripts/* ~/.local/bin
- deploy:
command: |
hpack
if [ "$CIRCLE_PROJECT_USERNAME" == "haskell-works" ]; then
if [[ "$CIRCLE_BRANCH" == master ]]; then
when tag autotag
elif [[ "$CIRCLE_TAG" =~ v.* ]]; then
publish
fi
fi
workflows:
version: 2
multiple-ghcs:
multiple-ghc-build:
jobs:
- ghc-8.6.1
- ghc-8.4.3
- ghc-8.2.2
- lts-12
- checked-builds:
- haskell/build:
name: GHC 8.2.2
executor: haskell/ghc-8_2_2
context: haskell-ci

- haskell/build:
name: GHC 8.4.4
executor: haskell/ghc-8_4_4
context: haskell-ci

- haskell/build:
name: GHC 8.6.4
executor: haskell/ghc-8_6_4
context: haskell-ci

- github/release-cabal:
name: GitHub Release
context: haskell-ci
requires:
- lts-12
- GHC 8.2.2
- GHC 8.4.4
- GHC 8.6.4
checkout: true
filters:
branches:
only: master

tagged-release:
jobs:
- release:
filters:
branches:
ignore: /.*/
tags:
only: /^v.*/
- hackage/upload:
context: haskell-ci
publish: true
requires:
- GitHub Release
username: ${HACKAGE_USER}
password: ${HACKAGE_PASS}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ cabal.sandbox.config
*.prof
*.aux
*.hp
*.cabal

/*.submodules
/.stack-work/
Expand Down
33 changes: 33 additions & 0 deletions hw-diagnostics.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: hw-diagnostics
version: 0.0.0.7
synopsis: Diagnostics library
description: Please see README.md
category: Profiling
homepage: http://github.com/haskell-works/hw-diagnostics#readme
bug-reports: https://github.com/haskell-works/hw-diagnostics/issues
author: John Ky
maintainer: newhoggy@gmail.com
copyright: 2016 John Ky
license: BSD3
license-file: LICENSE
build-type: Simple
cabal-version: >= 1.10
extra-source-files:
README.md

source-repository head
type: git
location: https://github.com/haskell-works/hw-diagnostics

library
exposed-modules:
HaskellWorks.Diagnostics
HaskellWorks.Diagnostics.Time
other-modules:
Paths_hw_diagnostics
hs-source-dirs:
src
ghc-options: -Wall
build-depends:
base >=4 && <5
default-language: Haskell2010
21 changes: 0 additions & 21 deletions package.yaml

This file was deleted.

Loading

0 comments on commit 2e4ff02

Please sign in to comment.