Skip to content

Commit

Permalink
Merge pull request #28 from rubik/travis-update
Browse files Browse the repository at this point in the history
Drop support for older and fix for newer ghc and stack. Update travis:
  • Loading branch information
lehins authored Mar 17, 2021
2 parents 1322071 + c597cf8 commit ee43102
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 115 deletions.
48 changes: 21 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,35 @@
sudo: false

language: haskell

env:
- GHCVER=7.8.4 STACK_YAML=stack-7.8.yaml STACK_VERSION=0.1.7.0
- GHCVER=7.8.4 STACK_YAML=stack-7.8.yaml STACK_VERSION=0.1.8.0
- GHCVER=7.10.2 STACK_YAML=stack.yaml STACK_VERSION=0.1.7.0
- GHCVER=7.10.2 STACK_YAML=stack.yaml STACK_VERSION=0.1.8.0
cache:
directories:
- $HOME/.stack
- $TRAVIS_BUILD_DIR/.stack-work
timeout: 360

matrix:
include:

#branches:
# only:
# - master
- env: GHC="8.6.5" RESOLVER="lts-14.27" STACK_YAML=stack.ghc-8.6.yaml
addons: {apt: {packages: [libgmp-dev]}}

sudo: false
- env: GHC="8.8.4" RESOLVER="lts-16.31"
addons: {apt: {packages: [libgmp-dev]}}

cache:
directories:
- $HOME/.stack/
- env: GHC="8.10.4" RESOLVER="lts-17"
addons: {apt: {packages: [libgmp-dev]}}

before_install:
- mkdir -p $HOME/.local/bin
- export PATH=$HOME/.local/bin:$PATH
- export STACK_FULLVERSION=stack-$STACK_VERSION-linux-x86_64
- if [ $STACK_VERSION == "0.1.7.0" ]; then
curl -L https://github.com/rubik/argon/releases/download/test-stack-1.7/stack-linux-x64.tar.bz2 | tar -xj -C $HOME/.local/bin;
else
curl -L https://github.com/commercialhaskell/stack/releases/download/v$STACK_VERSION/$STACK_FULLVERSION.tar.gz | tar xz --strip-components 1 -C ~/.local/bin $STACK_FULLVERSION/stack;
fi

- chmod a+x $HOME/.local/bin/stack
- travis_retry curl -sSL https://get.haskellstack.org/ | sh -s - -f
- stack --version

install:
- stack setup --no-terminal
- stack setup --no-terminal --resolver $RESOLVER

script:
- stack test :shc-test --no-terminal --coverage
- stack test :shc-test --no-terminal --coverage --resolver $RESOLVER

after_script:
- travis_retry curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.2.0/shc-linux-x64-$GHCVER.tar.bz2 | tar -xj
- ./shc stack-hpc-coveralls shc-test
# after_script:
# - travis_retry curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.2.0/shc-linux-x64-$GHCVER.tar.bz2 | tar -xj
# - ./shc stack-hpc-coveralls shc-test
10 changes: 3 additions & 7 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,11 @@ getConfig :: Arguments -> IO Config
getConfig args = do
pn <- args `getArgOrExit` argument "package-name"
let suites = args `getAllArgs` argument "suite-name"
unless (not $ null suites) $
when (null suites) $
putStrLn "Error: provide at least one test-suite name" >> exitFailure
(sn, jId) <- getServiceAndJobId
Config <$> pure pn
<*> pure suites
<*> pure sn
<*> pure jId
<*> pure (args `getArg` longOption "repo-token")
<*> getGitInfo
Config pn suites sn jId (args `getArg` longOption "repo-token")
<$> getGitInfo
<*> defaultOr args (longOption "hpc-dir") (getHpcDir pn)
<*> pure (args `getArg` longOption "mix-dir")
<*> pure (if args `isPresent` longOption "partial-coverage"
Expand Down
4 changes: 2 additions & 2 deletions src/SHC/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import Control.Applicative ((<$>))
#endif
import Control.Lens
import Network.HTTP.Client (RequestBody (RequestBodyLBS))
import Network.HTTP.Client.MultipartFormData (partFileRequestBody)
import Network.HTTP.Client.MultipartFormData (PartM, partFileRequestBody)
import Network.Wreq

import SHC.Types (Config (..),
Expand All @@ -39,7 +39,7 @@ sendData :: Config -- ^ SHC configuration
-> Value -- ^ The JSON object
-> IO PostResult
sendData conf url json = do
r <- postWith httpOptions url [partFileRequestBody "json_file" fileName requestBody]
r <- postWith httpOptions url [partFileRequestBody "json_file" fileName requestBody :: PartM IO]
if r ^. responseStatus . statusCode == 200
then return $ readResponse r
else return . PostFailure $ formatResponseError r
Expand Down
2 changes: 1 addition & 1 deletion src/SHC/Lix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ toLix :: Int -- ^ Source line count
-> [CoverageEntry] -- ^ Mix entries and associated hit count
-> Lix -- ^ Line coverage
toLix lineCount entries = map toHit $ groupByIndex lineCount sortedLineHits
where sortedLineHits = sortBy (comparing fst) lineHits
where sortedLineHits = sortOn fst lineHits
lineHits = map (toLineHit . adjust) entries
3 changes: 1 addition & 2 deletions src/SHC/Stack.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import Data.Version
import Control.Applicative ((<$>), (<*>))
#endif
import Control.Monad (forM, guard)
import Data.List (elem)
import System.Directory (makeRelativeToCurrentDirectory)
import System.FilePath ((</>), equalFilePath, splitPath)

Expand Down Expand Up @@ -50,7 +49,7 @@ getBaseMixDir = (</> "hpc") <$> stack ["path", "--dist-dir"]
-- | Get relevant information from @stack query@. Used to find
-- package filepaths.
getStackQuery :: IO StackQuery
getStackQuery = (Y.decodeEither' . BS8.pack <$> stack ["query"]) >>= either err return
getStackQuery = either err return . Y.decodeEither' . BS8.pack =<< stack ["query"]
where err = fail . (++) "getStackQuery: Couldn't decode the result of 'stack query' as YAML: " . show

-- | Get the key that GHC uses for the given package.
Expand Down
2 changes: 1 addition & 1 deletion src/SHC/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ instance ToJSON Remote where
]

-- | Data returned by the @stack query@ command.
data StackQuery =
newtype StackQuery =
StackQuery
{ stackQueryLocals :: [(String, FilePath)]
-- ^ A list of pairs of @(package-name, filepath)@, where the
Expand Down
33 changes: 0 additions & 33 deletions stack-7.10.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions stack-7.8.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions stack-hpc-coveralls.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: stack-hpc-coveralls
version: 0.0.6.0
version: 0.0.6.1
synopsis: Initial project template from stack
description: Please see README.md
homepage: http://github.com/rubik/stack-hpc-coveralls
Expand Down Expand Up @@ -36,7 +36,7 @@ library
, utf8-string >=1
, text >=1.2
, wreq >=0.3
, http-client >=0.4
, http-client >=0.6
, lens >=4.7
, lens-aeson >=1.0
, yaml >=0.8
Expand Down Expand Up @@ -80,7 +80,7 @@ test-suite style
hs-source-dirs: test
main-is: HLint.hs
build-depends: base >=4.7 && <5
, hlint ==2.*
, hlint >=2
default-language: Haskell2010
ghc-options: -Wall

Expand Down
9 changes: 9 additions & 0 deletions stack.ghc-8.10.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resolver: lts-17.6
packages:
- '.'
extra-deps:
- hlint-3.3
- ghc-lib-parser-9.0.1.20210207@sha256:1599bb845533c2833b6265fbc7f7f09e665ad4cb07352ee6c6abf6e6a94f6c44,10746
- ghc-lib-parser-ex-9.0.0.4@sha256:8282b11c3797fc8ba225b245e736cc9a0745d9c48d0f9fea7f9bffb5c9997709,3642
- github: gelisam/docopt.hs
commit: 16dc7bc596c0ea4fa4466b12f474b1abfa72c885
5 changes: 5 additions & 0 deletions stack.ghc-8.6.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resolver: lts-14.27
packages:
- '.'
extra-deps:
- docopt-0.7.0.5@sha256:0ff280d90aa667350f743623708107bdef427a49b64b1bdf3df15905d8cbe345,3540
36 changes: 6 additions & 30 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,9 @@
# For more information, see: https://github.com/commercialhaskell/stack/blob/release/doc/yaml_configuration.md

# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)
resolver: lts-11.5

# Local packages, usually specified by relative directory name
resolver: lts-16.31
packages:
- '.'

# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
extra-deps:
- docopt-0.7.0.4

# Override default flag values for local packages and extra-deps
flags: {}

# Extra package databases containing global packages
extra-package-dbs: []

# Control whether we use the GHC we find on the path
# system-ghc: true

# Require a specific version of stack, using version ranges
# require-stack-version: -any # Default
# require-stack-version: >= 0.1.4.0

# Override the architecture used by stack, especially useful on Windows
# arch: i386
# arch: x86_64

# Extra directories used by stack for building
# extra-include-dirs: [/path/to/dir]
# extra-lib-dirs: [/path/to/dir]
- hlint-3.3
- ghc-lib-parser-9.0.1.20210207@sha256:1599bb845533c2833b6265fbc7f7f09e665ad4cb07352ee6c6abf6e6a94f6c44,10746
- ghc-lib-parser-ex-9.0.0.4@sha256:8282b11c3797fc8ba225b245e736cc9a0745d9c48d0f9fea7f9bffb5c9997709,3642
- github: gelisam/docopt.hs
commit: 16dc7bc596c0ea4fa4466b12f474b1abfa72c885
1 change: 0 additions & 1 deletion test/SHCSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import Trace.Hpc.Util

import SHCHUnits

import SHC.Api
import SHC.Coverage
import SHC.Lix
import SHC.Types
Expand Down

0 comments on commit ee43102

Please sign in to comment.