Skip to content

Commit fcb335b

Browse files
authored
Merge pull request #45 from Rembane/feature/create-automatic-release
Reworked the circleci file to upload releases to Github.
2 parents af30833 + 77c00b5 commit fcb335b

File tree

3 files changed

+72
-24
lines changed

3 files changed

+72
-24
lines changed

.circleci/config.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# This file is heavily inspired by these pages:
2+
# - https://circleci.com/docs/2.0/language-haskell/
3+
# - https://circleci.com/blog/publishing-to-github-releases-via-circleci/
4+
#
5+
version: 2
6+
jobs:
7+
build-test-and-publish:
8+
docker:
9+
- image: fpco/stack-build-small:lts
10+
- image: postgres:11-alpine
11+
environment:
12+
POSTGRES_DB: postgres_ws_test
13+
POSTGRES_USER: root
14+
steps:
15+
- checkout
16+
- restore_cache:
17+
name: Restore Cached Dependencies
18+
keys:
19+
- postgres-websockets-v1-{{ checksum "postgres-websockets.cabal" }}
20+
- run:
21+
name: Install curl
22+
command: apt-get update && apt-get -qq -y install curl libpq-dev
23+
- run:
24+
name: Download and run hlint
25+
command: curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s .
26+
- run:
27+
name: Download ghr
28+
command: |
29+
curl -sSLO https://github.com/tcnksm/ghr/releases/download/v0.12.0/ghr_v0.12.0_linux_386.tar.gz
30+
curl -sSLO https://github.com/tcnksm/ghr/releases/download/v0.12.0/v0.12.0_SHASUMS
31+
sha256sum --check --ignore-missing v0.12.0_SHASUMS
32+
tar --strip-components=1 -zxvf ghr_v0.12.0_linux_386.tar.gz ghr_v0.12.0_linux_386/ghr
33+
- run:
34+
name: Resolve and update dependencies
35+
command: stack setup
36+
- run:
37+
name: Build the dependencies and the library
38+
command: stack --silent build
39+
- run:
40+
name: Run tests
41+
command: stack test
42+
- run:
43+
name: Install executable
44+
command: stack --silent install
45+
- run:
46+
name: Calculate and save checksum
47+
command: sha256sum ~/.local/bin/postgres-websockets > /root/postgres-websockets.sha256
48+
- save_cache:
49+
name: Cache Dependencies
50+
key: postgres-websockets-v1-{{ checksum "postgres-websockets.cabal" }}
51+
paths:
52+
- ".stack"
53+
- ".stack-work"
54+
- run:
55+
name: Publish Release on GitHub
56+
command: |
57+
mkdir /root/result/
58+
cp /root/postgres-websockets.sha256 /root/.local/bin/postgres-websockets /root/result/
59+
VERSION=$(awk '/^version: / { print $2 };' < postgres-websockets.cabal)
60+
./ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} /root/result/
61+
62+
workflows:
63+
version: 2
64+
main:
65+
jobs:
66+
- build-test-and-publish:
67+
filters:
68+
branches:
69+
only: master
70+
tags:
71+
only: /^[\d.]+$/

circle.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

postgres-websockets.cabal

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ library
3131
, bytestring >= 0.10
3232
, postgresql-libpq
3333
, lens
34-
, lens-aeson
3534
, jose >= 0.6
3635
, unordered-containers >= 0.2
3736
, postgresql-libpq >= 0.9 && < 1.0
@@ -40,7 +39,7 @@ library
4039
, jwt >= 0.7.2 && < 0.8
4140
, hasql >= 0.19
4241
, either
43-
, stm-containers
42+
, stm-containers == 0.2.16
4443
, stm
4544
, retry
4645
, stringsearch

0 commit comments

Comments
 (0)