Skip to content

Reworked the circleci file to upload releases to Github. #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# This file is heavily inspired by these pages:
# - https://circleci.com/docs/2.0/language-haskell/
# - https://circleci.com/blog/publishing-to-github-releases-via-circleci/
#
version: 2
jobs:
build-test-and-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" }}
- 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: |
curl -sSLO https://github.com/tcnksm/ghr/releases/download/v0.12.0/ghr_v0.12.0_linux_386.tar.gz
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: Resolve and update dependencies
command: stack setup
- run:
name: Build the dependencies and the library
command: stack --silent build
- run:
name: Run tests
command: stack test
- run:
name: Install executable
command: stack --silent install
- run:
name: Calculate and save checksum
command: sha256sum ~/.local/bin/postgres-websockets > /root/postgres-websockets.sha256
- save_cache:
name: Cache Dependencies
key: postgres-websockets-v1-{{ checksum "postgres-websockets.cabal" }}
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/

workflows:
version: 2
main:
jobs:
- build-test-and-publish:
filters:
branches:
only: master
tags:
only: /^[\d.]+$/
22 changes: 0 additions & 22 deletions circle.yml

This file was deleted.

3 changes: 1 addition & 2 deletions postgres-websockets.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ library
, bytestring >= 0.10
, postgresql-libpq
, lens
, lens-aeson
, jose >= 0.6
, unordered-containers >= 0.2
, postgresql-libpq >= 0.9 && < 1.0
Expand All @@ -40,7 +39,7 @@ library
, jwt >= 0.7.2 && < 0.8
, hasql >= 0.19
, either
, stm-containers
, stm-containers == 0.2.16
, stm
, retry
, stringsearch
Expand Down