From 2c37ecde3a20471c812d9f201d25f55dbc2430e4 Mon Sep 17 00:00:00 2001 From: John Ky Date: Wed, 6 Nov 2019 08:18:58 +1100 Subject: [PATCH] Maintenance --- .circleci/config.yml | 58 ++++++++ .circleci/whitelist-dependencies.txt | 1 + .stylish-haskell.yaml | 189 +++++++++++++++++++++++++++ .vscode/tasks.json | 69 ++++++++++ circle.yml | 28 ---- hw-all.cabal | 91 +++++++++---- scripts/autotag | 46 ------- scripts/fetch | 29 ---- scripts/publish | 34 ----- scripts/setup-cred | 9 -- scripts/up | 71 ---------- scripts/when | 18 --- 12 files changed, 383 insertions(+), 260 deletions(-) create mode 100644 .circleci/config.yml create mode 100644 .circleci/whitelist-dependencies.txt create mode 100644 .stylish-haskell.yaml create mode 100644 .vscode/tasks.json delete mode 100644 circle.yml delete mode 100755 scripts/autotag delete mode 100755 scripts/fetch delete mode 100755 scripts/publish delete mode 100755 scripts/setup-cred delete mode 100755 scripts/up delete mode 100755 scripts/when diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..be1aad6 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,58 @@ +version: 2.1 + +orbs: + haskell: haskell-works/haskell-build@4.0.2 + github: haskell-works/github-release@1.2.1 + hackage: haskell-works/hackage@1.0.0 + +workflows: + multiple-ghc-build: + jobs: + - haskell/build-with-binary-cache: + name: GHC 8.2.2 + executor: haskell/ghc-8_2_2 + context: haskell-ci + binary-cache-uri: ${BINARY_CACHE_URI-"http://hw-binary-cache-us-west-2-a.s3-website-us-west-2.amazonaws.com/archive"} + cabal-build-extra: --write-ghc-environment-files=always + + - haskell/build-with-binary-cache: + name: GHC 8.4.4 + executor: haskell/ghc-8_4_4 + context: haskell-ci + binary-cache-uri: ${BINARY_CACHE_URI-"http://hw-binary-cache-us-west-2-a.s3-website-us-west-2.amazonaws.com/archive"} + cabal-build-extra: --write-ghc-environment-files=always + + - haskell/build-with-binary-cache: + name: GHC 8.6.5 + executor: haskell/ghc-8_6_5 + context: haskell-ci + binary-cache-uri: ${BINARY_CACHE_URI-"http://hw-binary-cache-us-west-2-a.s3-website-us-west-2.amazonaws.com/archive"} + cabal-build-extra: --write-ghc-environment-files=always + + - haskell/build-with-binary-cache: + name: GHC 8.8.1 + executor: haskell/ghc-8_8_1 + context: haskell-ci + binary-cache-uri: ${BINARY_CACHE_URI-"http://hw-binary-cache-us-west-2-a.s3-website-us-west-2.amazonaws.com/archive"} + cabal-build-extra: --write-ghc-environment-files=always + + - github/release-cabal: + name: GitHub Release + context: haskell-ci + requires: + - GHC 8.2.2 + - GHC 8.4.4 + - GHC 8.6.5 + - GHC 8.8.1 + checkout: true + filters: + branches: + only: master + + - hackage/upload: + context: haskell-ci + publish: true + requires: + - GitHub Release + username: ${HACKAGE_USER} + password: ${HACKAGE_PASS} diff --git a/.circleci/whitelist-dependencies.txt b/.circleci/whitelist-dependencies.txt new file mode 100644 index 0000000..e2e962e --- /dev/null +++ b/.circleci/whitelist-dependencies.txt @@ -0,0 +1 @@ +vector \ No newline at end of file diff --git a/.stylish-haskell.yaml b/.stylish-haskell.yaml new file mode 100644 index 0000000..9b110e2 --- /dev/null +++ b/.stylish-haskell.yaml @@ -0,0 +1,189 @@ +# stylish-haskell configuration file +# ================================== + +# The stylish-haskell tool is mainly configured by specifying steps. These steps +# are a list, so they have an order, and one specific step may appear more than +# once (if needed). Each file is processed by these steps in the given order. +steps: + # Convert some ASCII sequences to their Unicode equivalents. This is disabled + # by default. + # - unicode_syntax: + # # In order to make this work, we also need to insert the UnicodeSyntax + # # language pragma. If this flag is set to true, we insert it when it's + # # not already present. You may want to disable it if you configure + # # language extensions using some other method than pragmas. Default: + # # true. + # add_language_pragma: true + + # Align the right hand side of some elements. This is quite conservative + # and only applies to statements where each element occupies a single + # line. + - simple_align: + cases: true + top_level_patterns: true + records: true + + # Import cleanup + - imports: + # There are different ways we can align names and lists. + # + # - global: Align the import names and import list throughout the entire + # file. + # + # - file: Like global, but don't add padding when there are no qualified + # imports in the file. + # + # - group: Only align the imports per group (a group is formed by adjacent + # import lines). + # + # - none: Do not perform any alignment. + # + # Default: global. + align: group + + # Folowing options affect only import list alignment. + # + # List align has following options: + # + # - after_alias: Import list is aligned with end of import including + # 'as' and 'hiding' keywords. + # + # > import qualified Data.List as List (concat, foldl, foldr, head, + # > init, last, length) + # + # - with_alias: Import list is aligned with start of alias or hiding. + # + # > import qualified Data.List as List (concat, foldl, foldr, head, + # > init, last, length) + # + # - new_line: Import list starts always on new line. + # + # > import qualified Data.List as List + # > (concat, foldl, foldr, head, init, last, length) + # + # Default: after_alias + list_align: after_alias + + # Long list align style takes effect when import is too long. This is + # determined by 'columns' setting. + # + # - inline: This option will put as much specs on same line as possible. + # + # - new_line: Import list will start on new line. + # + # - new_line_multiline: Import list will start on new line when it's + # short enough to fit to single line. Otherwise it'll be multiline. + # + # - multiline: One line per import list entry. + # Type with contructor list acts like single import. + # + # > import qualified Data.Map as M + # > ( empty + # > , singleton + # > , ... + # > , delete + # > ) + # + # Default: inline + long_list_align: inline + + # Align empty list (importing instances) + # + # Empty list align has following options + # + # - inherit: inherit list_align setting + # + # - right_after: () is right after the module name: + # + # > import Vector.Instances () + # + # Default: inherit + empty_list_align: inherit + + # List padding determines indentation of import list on lines after import. + # This option affects 'long_list_align'. + # + # - : constant value + # + # - module_name: align under start of module name. + # Useful for 'file' and 'group' align settings. + list_padding: 4 + + # Separate lists option affects formating of import list for type + # or class. The only difference is single space between type and list + # of constructors, selectors and class functions. + # + # - true: There is single space between Foldable type and list of it's + # functions. + # + # > import Data.Foldable (Foldable (fold, foldl, foldMap)) + # + # - false: There is no space between Foldable type and list of it's + # functions. + # + # > import Data.Foldable (Foldable(fold, foldl, foldMap)) + # + # Default: true + separate_lists: true + + # Language pragmas + - language_pragmas: + # We can generate different styles of language pragma lists. + # + # - vertical: Vertical-spaced language pragmas, one per line. + # + # - compact: A more compact style. + # + # - compact_line: Similar to compact, but wrap each line with + # `{-#LANGUAGE #-}'. + # + # Default: vertical. + style: vertical + + # Align affects alignment of closing pragma brackets. + # + # - true: Brackets are aligned in same collumn. + # + # - false: Brackets are not aligned together. There is only one space + # between actual import and closing bracket. + # + # Default: true + align: true + + # stylish-haskell can detect redundancy of some language pragmas. If this + # is set to true, it will remove those redundant pragmas. Default: true. + remove_redundant: true + + # Replace tabs by spaces. This is disabled by default. + # - tabs: + # # Number of spaces to use for each tab. Default: 8, as specified by the + # # Haskell report. + # spaces: 8 + + # Remove trailing whitespace + - trailing_whitespace: {} + +# A common setting is the number of columns (parts of) code will be wrapped +# to. Different steps take this into account. Default: 80. +columns: 800 + +# By default, line endings are converted according to the OS. You can override +# preferred format here. +# +# - native: Native newline format. CRLF on Windows, LF on other OSes. +# +# - lf: Convert to LF ("\n"). +# +# - crlf: Convert to CRLF ("\r\n"). +# +# Default: native. +newline: native + +# Sometimes, language extensions are specified in a cabal file or from the +# command line instead of using language pragmas in the file. stylish-haskell +# needs to be aware of these, so it can parse the file correctly. +# +# No language extensions are enabled by default. +# language_extensions: + # - TemplateHaskell + # - QuasiQuotes diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..1f6f012 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,69 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Build", + "type": "shell", + "command": "bash", + "args": ["-lc", "cabal new-build && echo 'Done'"], + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": { + "owner": "haskell", + "fileLocation": "relative", + "pattern": [ + { + "regexp": "^(.+?):(\\d+):(\\d+):\\s+(error|warning|info):.*$", + "file": 1, "line": 2, "column": 3, "severity": 4 + }, + { + "regexp": "\\s*(.*)$", + "message": 1 + } + ] + }, + "presentation": { + "echo": false, + "reveal": "always", + "focus": false, + "panel": "shared", + "showReuseMessage": false, + "clear": true + } + }, + { + "label": "Test", + "type": "shell", + "command": "bash", + "args": ["-lc", "cabal new-test --enable-tests && echo 'Done'"], + "group": { + "kind": "test", + "isDefault": true + }, + "problemMatcher": { + "owner": "haskell", + "fileLocation": "relative", + "pattern": [ + { + "regexp": "^(.+?):(\\d+):(\\d+):.*$", + "file": 1, "line": 2, "column": 3, "severity": 4 + }, + { + "regexp": "\\s*(\\d\\)\\s)?(.*)$", + "message": 2 + } + ] + }, + "presentation": { + "echo": false, + "reveal": "always", + "focus": false, + "panel": "shared", + "showReuseMessage": false, + "clear": true + } + } + ] +} diff --git a/circle.yml b/circle.yml deleted file mode 100644 index e801a12..0000000 --- a/circle.yml +++ /dev/null @@ -1,28 +0,0 @@ -dependencies: - cache_directories: - - "~/.cabal" - - "~/.stack" - pre: - - wget -qO- https://get.haskellstack.org/ | sh - - cp ./scripts/* ~/bin/ - override: - - fetch - - stack init --resolver lts-7.2 - - stack build --only-dependencies - -test: - override: - - stack test - -deployment: - release_branch: - owner: haskell-works - branch: /.*-branch/ - commands: - - when tag autotag - - hackage: - owner: haskell-works - tag: /v.*/ - commands: - - publish diff --git a/hw-all.cabal b/hw-all.cabal index f1ac05a..1411ec7 100644 --- a/hw-all.cabal +++ b/hw-all.cabal @@ -1,58 +1,99 @@ +cabal-version: 2.4 + name: hw-all version: 0.0.0.1 synopsis: Demo library description: Please see README.md -homepage: http://github.com/haskell-works/hw-json#readme -license: BSD3 +homepage: http://github.com/haskell-works/hw-all#readme +license: BSD-3-Clause license-file: LICENSE author: John Ky maintainer: newhoggy@gmail.com -copyright: 2016 John Ky +copyright: 2016-2019 John Ky category: Data, Conduit +tested-with: GHC == 8.8.1, GHC == 8.6.5, GHC == 8.4.4, GHC == 8.2.2 build-type: Simple extra-source-files: README.md -cabal-version: >= 1.22 + +source-repository head + type: git + location: https://github.com/haskell-works/hw-all + +common base { build-depends: base >= 4.8 && < 5 } + +common bits-extra { build-depends: bits-extra >= 0.0.1.4 && < 0.1 } +common hw-aeson { build-depends: hw-aeson >= 0.1.0.2 && < 0.2 } +common hw-balancedparens { build-depends: hw-balancedparens >= 0.3.0.2 && < 0.4 } +common hw-bits { build-depends: hw-bits >= 0.7.0.8 && < 0.8 } +common hw-conduit { build-depends: hw-conduit >= 0.2.0.6 && < 0.3 } +common hw-diagnostics { build-depends: hw-diagnostics >= 0.0.0.7 && < 0.1 } +common hw-dsv { build-depends: hw-dsv >= 0.3.7 && < 0.4 } +common hw-dump { build-depends: hw-dump >= 0.1.0.1 && < 0.2 } +common hw-eliasfano { build-depends: hw-eliasfano >= 0.1.1.1 && < 0.2 } +common hw-excess { build-depends: hw-excess >= 0.2.2.1 && < 0.3 } +common hw-fingertree { build-depends: hw-fingertree >= 0.1.1.1 && < 0.2 } +common hw-fingertree-strict { build-depends: hw-fingertree-strict >= 0.1.1.3 && < 0.2 } +common hw-hedgehog { build-depends: hw-hedgehog >= 0.1.0.5 && < 0.2 } +common hw-hspec-hedgehog { build-depends: hw-hspec-hedgehog >= 0.1.0.9 && < 0.2 } +common hw-int { build-depends: hw-int >= 0.0.0.4 && < 0.1 } +common hw-ip { build-depends: hw-ip >= 2.3.4.2 && < 2.4 } +common hw-json { build-depends: hw-json >= 1.3.1.1 && < 1.4 } +common hw-json-lens { build-depends: hw-json-lens >= 0.2.0.0 && < 0.3 } +common hw-json-simd { build-depends: hw-json-simd >= 0.1.0.4 && < 0.2 } +common hw-json-simple-cursor { build-depends: hw-json-simple-cursor >= 0.1.0.2 && < 0.2 } +common hw-json-standard-cursor { build-depends: hw-json-standard-cursor >= 0.2.1.2 && < 0.3 } +common hw-mquery { build-depends: hw-mquery >= 0.2.0.2 && < 0.3 } +common hw-packed-vector { build-depends: hw-packed-vector >= 0.2.0.1 && < 0.3 } +common hw-parser { build-depends: hw-parser >= 0.1.0.2 && < 0.2 } +common hw-prim { build-depends: hw-prim >= 0.6.2.28 && < 0.7 } +common hw-rankselect { build-depends: hw-rankselect >= 0.13.3.1 && < 0.14 } +common hw-rankselect-base { build-depends: hw-rankselect-base >= 0.3.2.3 && < 0.4 } +common hw-simd { build-depends: hw-simd >= 0.1.1.5 && < 0.2 } +common hw-streams { build-depends: hw-streams >= 0.0.0.12 && < 0.1 } +common hw-string-parse { build-depends: hw-string-parse >= 0.0.0.4 && < 0.1 } +common hw-succinct { build-depends: hw-succinct >= 0.1.0.1 && < 0.2 } +common hw-uri { build-depends: hw-uri >= 0.2.0.1 && < 0.3 } +common hw-xml { build-depends: hw-xml >= 0.4.0.2 && < 0.5 } + +common config + default-language: Haskell2010 + ghc-options: -Wall library + import: base, config hs-source-dirs: src exposed-modules: HaskellWorks build-depends: base >= 4 && < 5 - , aeson - , array - , attoparsec - , bytestring - , conduit - , containers - , deepseq - , dlist + , bits-extra + , hw-aeson , hw-balancedparens , hw-bits , hw-conduit , hw-diagnostics + , hw-dsv + , hw-dump , hw-eliasfano , hw-excess + , hw-fingertree + , hw-fingertree-strict + , hw-hedgehog + , hw-hspec-hedgehog , hw-int + , hw-ip , hw-json , hw-json-lens + , hw-json-simd + , hw-json-simple-cursor + , hw-json-standard-cursor , hw-mquery , hw-packed-vector , hw-parser , hw-prim , hw-rankselect , hw-rankselect-base + , hw-simd + , hw-streams , hw-string-parse , hw-succinct + , hw-uri , hw-xml - , mmap - , mono-traversable - , resourcet - , text - , vector - , word8 - - default-language: Haskell2010 - ghc-options: -Wall -O2 -msse4.2 - -source-repository head - type: git - location: https://github.com/haskell-works/hw-all diff --git a/scripts/autotag b/scripts/autotag deleted file mode 100755 index 9a1ed37..0000000 --- a/scripts/autotag +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash - -if [ "$_system_type" == "Darwin" ]; then - sed () { - gsed "$@" - } -fi - -_repo_name=$(basename `git rev-parse --show-toplevel`) - -_version=$( - cat $_repo_name.cabal | grep '^version:' | head | cut -d ':' -f 2 | xargs -) - -_branch=$(git rev-parse --abbrev-ref HEAD) -_branch_prefix=${_branch%-branch} - -if [[ "$_version" != "$_branch_prefix".* ]]; then - echo "The version $_version does not belong to the branch $_branch" - exit 1 -fi - -if [[ $(git ls-remote origin "refs/tags/v$_version") ]]; then - echo "The tag v$_version already exists. Will not tag" - exit 0 -fi - -_commit=$(git rev-parse --verify HEAD) - -_release_data=$(cat < /dev/null - -cp ../$_project.cabal ./ - -projects() { - for x in $(direct_deps | sort | uniq); do - cabal install $x --dry-run | grep hw- | grep -v "^${_project}-[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+$" - done -} - -for x in $(projects | sort | uniq); do - cabal unpack $x -done - -rm ./$_project.cabal - -popd > /dev/null diff --git a/scripts/publish b/scripts/publish deleted file mode 100755 index bff95bc..0000000 --- a/scripts/publish +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash - -if [ "$_system_type" == "Darwin" ]; then - sed () { - gsed "$@" - } -fi - -if [ "$HACKAGE_USER" == "" ] || [ "$HACKAGE_PASS" == "" ]; then - echo "Must supply credentials" - exit 1 -fi - -_repo_name=$(basename `git rev-parse --show-toplevel`) - -_version=$( - cat $_repo_name.cabal | grep '^version:' | head | cut -d ':' -f 2 | xargs -) - -if [ "v$_version" != "$CIRCLE_TAG" ]; then - echo "Tag mismatch: "v$_version != $CIRCLE_TAG"" - exit 1 -fi - -cabal configure - -cabal sdist - -if [ "$ALLOW_UPLOAD" != "" ]; then - cabal upload \ - --username=$HACKAGE_USER \ - --password=$HACKAGE_PASS \ - "dist/${_repo_name}-${_version}.tar.gz" -fi diff --git a/scripts/setup-cred b/scripts/setup-cred deleted file mode 100755 index 6b5b24d..0000000 --- a/scripts/setup-cred +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -cred=~/.stack/upload/credentials.json -if [ ! -f "${cred}" ]; then - if [ ! -e ~/.stack/upload ]; then - mkdir -p ~/.stack/upload - fi - echo "{\"username\":\"${HACKAGE_USER}\",\"password\":\"${HACKAGE_PASS}\"}" > ${cred} -fi diff --git a/scripts/up b/scripts/up deleted file mode 100755 index 9739cca..0000000 --- a/scripts/up +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env bash - -if [ "$_system_type" == "Darwin" ]; then - sed () { - gsed "$@" - } -fi - -_repo_name=$(basename `git rev-parse --show-toplevel`) - -_version=$( - cat $_repo_name.cabal | grep '^version:' | head | cut -d ':' -f 2 | xargs -) - -_major=$( - echo $_version | sed 's|^\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)|\1|g' -) - -_minor=$( - echo $_version | sed 's|^\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)|\2|g' -) - -_point=$( - echo $_version | sed 's|^\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)|\3|g' -) - -_patch=$( - echo $_version | sed 's|^\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)|\4|g' -) - - -case $1 in -major) - _new_version="$(($_major + 1)).0.0.0" - _new_branch="$(($_major + 1))" - ;; -minor) - _new_version="$_major.$(($_minor + 1)).0.0" - ;; -point) - _new_version="$_major.$_minor.$(($_point + 1)).0" - ;; -patch) - _new_version="$_major.$_minor.$_point.$(($_patch + 1))" - ;; -*) - echo "./scripts/up (major|minor|point|patch)" - exit 1 -esac - -sed "s|^\(version:\s*\)\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)$|\1$_new_version|g" -i $_repo_name.cabal - -echo "Cabal project version upgrade to $_new_version" -echo "" -echo "Please review and run the following commands:" -echo "" - -if [ "$_new_branch" != "" ]; then - echo " git checkout -b ${_new_branch}-branch" -fi - -echo " git add $_repo_name.cabal" -echo " git commit -m 'New version $_new_version'" - -if [ "$_new_branch" != "" ]; then - echo " git push --set-upstream origin ${_new_branch}-branch" -else - echo " git push origin" -fi - -echo "" diff --git a/scripts/when b/scripts/when deleted file mode 100755 index 43fcc4d..0000000 --- a/scripts/when +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -set -e - -_expected_stage="$1" - -if [ "$BUILD_STAGES" == "" ]; then - BUILD_STAGES=all -fi - -for stage in $BUILD_STAGES; do - if [ "$stage" == "$_expected_stage" ] || [ "$stage" == "all" ]; then - shift 1 - "$@" - - break - fi -done