Skip to content

Commit

Permalink
Merge pull request #3 from haskell-works/use-circleci-orb
Browse files Browse the repository at this point in the history
Use CircleCI Orbs
  • Loading branch information
newhoggy authored Feb 15, 2019
2 parents 31d07b4 + 6a9c6ab commit 7dc57c7
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 297 deletions.
276 changes: 29 additions & 247 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,257 +1,39 @@
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@1.5.1
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
workflows:
multiple-ghc-build:
jobs:
- haskell/build:
name: GHC 8.2.2
executor: haskell/ghc-8_2_2

- 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
- haskell/build:
name: GHC 8.4.4
executor: haskell/ghc-8_4_4

- run:
name: Copying scripts
command: |
mkdir -p ~/.local/bin
cp ./scripts/* ~/.local/bin
- haskell/build:
name: GHC 8.6.3
executor: haskell/ghc-8_6_3

- 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:
jobs:
- ghc-8.6.1
- ghc-8.4.3
- ghc-8.2.2
- lts-12
- checked-builds:
- github/release-cabal:
name: GitHub Release
requires:
- lts-12
- GHC 8.2.2
- GHC 8.4.4
- GHC 8.6.3
checkout: true
filters:
branches:
only: master

tagged-release:
jobs:
- release:
filters:
branches:
ignore: /.*/
tags:
only: /^v.*/
- hackage/upload:
publish: true
requires:
- GitHub Release
username: ${HACKAGE_USER}
password: ${HACKAGE_PASS}
1 change: 1 addition & 0 deletions .circleci/whitelist-dependencies.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vector
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
67 changes: 67 additions & 0 deletions hw-packed-vector.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: hw-packed-vector
version: 0.0.0.1
synopsis: Packed Vector
description: Packed Vector. Please see README.md
category: Data, Vector
stability: Experimental
homepage: http://github.com/haskell-works/hw-packed-vector#readme
bug-reports: https://github.com/haskell-works/hw-packed-vector/issues
author: John Ky
maintainer: newhoggy@gmail.com
copyright: 2016-2018 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-packed-vector

library
exposed-modules:
HaskellWorks.Data.PackedVector
HaskellWorks.Data.PackedVector.Internal
HaskellWorks.Data.PackedVector.PackedVector64
other-modules:
Paths_hw_packed_vector
hs-source-dirs:
src
ghc-options: -Wall -O2 -msse4.2
build-depends:
base >=4 && <5
, bytestring
, hw-bits >=0.4.0.0
, hw-int >=0.0.0.1
, hw-prim >=0.4.0.0
, hw-string-parse >=0.0.0.1
, safe
, vector
default-language: Haskell2010

test-suite hw-packed-vector-test
type: exitcode-stdio-1.0
main-is: Spec.hs
other-modules:
HaskellWorks.Data.PackedVector.InternalSpec
HaskellWorks.Data.PackedVector.PackedVector64Spec
HaskellWorks.Gen
Paths_hw_packed_vector
hs-source-dirs:
test
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
build-depends:
QuickCheck
, base >=4 && <5
, bytestring
, hedgehog
, hspec
, hw-bits >=0.4.0.0
, hw-hedgehog
, hw-hspec-hedgehog
, hw-packed-vector
, hw-prim >=0.4.0.0
, vector
default-language: Haskell2010
Loading

0 comments on commit 7dc57c7

Please sign in to comment.