diff --git a/.travis.yml b/.travis.yml index 53af9bc..76d3eaf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/app/Main.hs b/app/Main.hs index 02fc4a2..ede60a0 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -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" diff --git a/src/SHC/Api.hs b/src/SHC/Api.hs index d51adc9..cb27bcc 100644 --- a/src/SHC/Api.hs +++ b/src/SHC/Api.hs @@ -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 (..), @@ -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 diff --git a/src/SHC/Lix.hs b/src/SHC/Lix.hs index 8734696..b34dd22 100644 --- a/src/SHC/Lix.hs +++ b/src/SHC/Lix.hs @@ -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 diff --git a/src/SHC/Stack.hs b/src/SHC/Stack.hs index a603248..f7ef21b 100644 --- a/src/SHC/Stack.hs +++ b/src/SHC/Stack.hs @@ -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) @@ -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. diff --git a/src/SHC/Types.hs b/src/SHC/Types.hs index dfe1634..383bc36 100644 --- a/src/SHC/Types.hs +++ b/src/SHC/Types.hs @@ -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 diff --git a/stack-7.10.yaml b/stack-7.10.yaml deleted file mode 100644 index 1ed817f..0000000 --- a/stack-7.10.yaml +++ /dev/null @@ -1,33 +0,0 @@ -# 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-6.3 - -# Local packages, usually specified by relative directory name -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] diff --git a/stack-7.8.yaml b/stack-7.8.yaml deleted file mode 100644 index 72dd1eb..0000000 --- a/stack-7.8.yaml +++ /dev/null @@ -1,8 +0,0 @@ -flags: {} -extra-package-dbs: [] -packages: -- '.' -extra-deps: -- docopt-0.7.0.4 -- hspec-contrib-0.3.0 -resolver: lts-2.22 diff --git a/stack-hpc-coveralls.cabal b/stack-hpc-coveralls.cabal index a82c78b..12452d3 100644 --- a/stack-hpc-coveralls.cabal +++ b/stack-hpc-coveralls.cabal @@ -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 @@ -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 @@ -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 diff --git a/stack.ghc-8.10.yaml b/stack.ghc-8.10.yaml new file mode 100644 index 0000000..27d5266 --- /dev/null +++ b/stack.ghc-8.10.yaml @@ -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 diff --git a/stack.ghc-8.6.yaml b/stack.ghc-8.6.yaml new file mode 100644 index 0000000..3edc0a9 --- /dev/null +++ b/stack.ghc-8.6.yaml @@ -0,0 +1,5 @@ +resolver: lts-14.27 +packages: +- '.' +extra-deps: +- docopt-0.7.0.5@sha256:0ff280d90aa667350f743623708107bdef427a49b64b1bdf3df15905d8cbe345,3540 diff --git a/stack.yaml b/stack.yaml index 28c0db5..bccee48 100644 --- a/stack.yaml +++ b/stack.yaml @@ -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 diff --git a/test/SHCSpec.hs b/test/SHCSpec.hs index 8b44623..15316bb 100644 --- a/test/SHCSpec.hs +++ b/test/SHCSpec.hs @@ -19,7 +19,6 @@ import Trace.Hpc.Util import SHCHUnits -import SHC.Api import SHC.Coverage import SHC.Lix import SHC.Types