diff --git a/.circleci/config.yml b/.circleci/config.yml index 1f16446..c674ff5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,25 +4,15 @@ # version: 2 jobs: - build-test-and-publish: + publish: docker: - image: fpco/stack-build-small:lts - - image: postgres:11-alpine - environment: - POSTGRES_DB: postgres_ws_test - POSTGRES_USER: root steps: - - checkout - - restore_cache: - name: Restore Cached Dependencies - keys: - - postgres-websockets-v1-{{ checksum "postgres-websockets.cabal" }} + - attach_workspace: + at: ws - run: name: Install curl command: apt-get update && apt-get -qq -y install curl libpq-dev - - run: - name: Download and run hlint - command: curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s . - run: name: Download ghr command: | @@ -30,9 +20,39 @@ jobs: curl -sSLO https://github.com/tcnksm/ghr/releases/download/v0.12.0/v0.12.0_SHASUMS sha256sum --check --ignore-missing v0.12.0_SHASUMS tar --strip-components=1 -zxvf ghr_v0.12.0_linux_386.tar.gz ghr_v0.12.0_linux_386/ghr + - run: + name: Publish Release on GitHub + command: | + mkdir result + cp ws/postgres-websockets.sha256 ws/postgres-websockets ./result/ + VERSION=$(awk '/^version: / { print $2 };' < ws/postgres-websockets.cabal) + ./ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} ./result/ + + build-test: + docker: + - image: fpco/stack-build:lts-13.14 + - image: postgres:11-alpine + environment: + POSTGRES_DB: postgres_ws_test + POSTGRES_USER: root + steps: + - checkout + - restore_cache: + name: Restore Cached Dependencies + keys: + - postgres-websockets-v2-{{ checksum "stack.yaml" }} - run: name: Resolve and update dependencies command: stack setup + - run: + name: Install Cabal and hlint + command: stack install --system-ghc --resolver=lts-13.14 Cabal hlint + - save_cache: + name: Cache Dependencies + key: postgres-websockets-v2-{{ checksum "stack.yaml" }} + paths: + - ".stack" + - ".stack-work" - run: name: Build the dependencies and the library command: stack --silent build @@ -44,28 +64,31 @@ jobs: command: stack --silent install - run: name: Calculate and save checksum - command: sha256sum ~/.local/bin/postgres-websockets > /root/postgres-websockets.sha256 + command: sha256sum ~/.local/bin/postgres-websockets > ~/.local/bin/postgres-websockets.sha256 + - run: + name: Save cabal file to preserve version + command: cp postgres-websockets.cabal ~/.local/bin/ - save_cache: name: Cache Dependencies - key: postgres-websockets-v1-{{ checksum "postgres-websockets.cabal" }} + key: postgres-websockets-v2-{{ checksum "stack.yaml" }} paths: - ".stack" - ".stack-work" - - run: - name: Publish Release on GitHub - command: | - mkdir /root/result/ - cp /root/postgres-websockets.sha256 /root/.local/bin/postgres-websockets /root/result/ - VERSION=$(awk '/^version: / { print $2 };' < postgres-websockets.cabal) - ./ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} /root/result/ + - persist_to_workspace: + root: ~/.local/bin/ + paths: + - "postgres-websockets" + - "postgres-websockets.sha256" + - "postgres-websockets.cabal" workflows: version: 2 main: jobs: - - build-test-and-publish: + - build-test + - publish: + requires: + - build-test filters: branches: only: master - tags: - only: /^[\d.]+$/ diff --git a/postgres-websockets.cabal b/postgres-websockets.cabal index 9c3e2fa..a19ae87 100644 --- a/postgres-websockets.cabal +++ b/postgres-websockets.cabal @@ -36,10 +36,9 @@ library , postgresql-libpq >= 0.9 && < 1.0 , aeson >= 0.11 , protolude >= 0.2 - , jwt >= 0.7.2 && < 0.8 , hasql >= 0.19 , either - , stm-containers == 0.2.16 + , stm-containers , stm , retry , stringsearch diff --git a/src/PostgresWebsockets/Broadcast.hs b/src/PostgresWebsockets/Broadcast.hs index 43144d9..7477265 100644 --- a/src/PostgresWebsockets/Broadcast.hs +++ b/src/PostgresWebsockets/Broadcast.hs @@ -18,7 +18,7 @@ module PostgresWebsockets.Broadcast ( Multiplexer (src) ) where import Protolude -import qualified STMContainers.Map as M +import qualified StmContainers.Map as M import Control.Concurrent.STM.TChan import Control.Concurrent.STM.TQueue diff --git a/stack.yaml b/stack.yaml index 19cf054..b77eda9 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,6 +1,9 @@ -resolver: lts-12.14 +resolver: lts-13.14 extra-deps: -- envparse-0.4.1@sha256:989902e6368532548f61de1fa245ad2b39176cddd8743b20071af519a709ce30 +- envparse-0.4.1@sha256:989902e6368532548f61de1fa245ad2b39176cddd8743b20071af519a709ce30 +- stm-containers-1.1.0.2@sha256:8976df591e61f378ef29dc0443dbe2d5d34818c898093af3ca138ea1d013b5eb +- stm-hamt-1.2.0.2@sha256:18126db7bf2d9c967a6020c677b3005dd957a4c39d69aeaea3c29c90de8f6124 +- primitive-extras-0.7.1@sha256:23905c57089418b1a2d324cfee3e81bbd5a344a0fa56a827867b2dce275fdb5e ghc-options: - postgres-websockets: -O2 -Wall -fwarn-identities -fno-warn-redundant-constraints + postgres-websockets: -Wall -fwarn-identities -fno-warn-redundant-constraints