Skip to content

Commit 0616395

Browse files
committed
WIP - testing circle
1 parent 8035e3e commit 0616395

File tree

2 files changed

+49
-29
lines changed

2 files changed

+49
-29
lines changed

.circleci/config.yml

Lines changed: 48 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,55 @@
44
#
55
version: 2
66
jobs:
7-
build-test-and-publish:
7+
publish:
88
docker:
99
- image: fpco/stack-build-small:lts
10-
- image: postgres:11-alpine
11-
environment:
12-
POSTGRES_DB: postgres_ws_test
13-
POSTGRES_USER: root
1410
steps:
15-
- checkout
16-
- restore_cache:
17-
name: Restore Cached Dependencies
18-
keys:
19-
- postgres-websockets-v1-{{ checksum "postgres-websockets.cabal" }}
11+
- attach_workspace:
12+
at: ws
2013
- run:
2114
name: Install curl
2215
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 .
2616
- run:
2717
name: Download ghr
2818
command: |
2919
curl -sSLO https://github.com/tcnksm/ghr/releases/download/v0.12.0/ghr_v0.12.0_linux_386.tar.gz
3020
curl -sSLO https://github.com/tcnksm/ghr/releases/download/v0.12.0/v0.12.0_SHASUMS
3121
sha256sum --check --ignore-missing v0.12.0_SHASUMS
3222
tar --strip-components=1 -zxvf ghr_v0.12.0_linux_386.tar.gz ghr_v0.12.0_linux_386/ghr
23+
- run:
24+
name: Publish Release on GitHub
25+
command: |
26+
mkdir result
27+
cp ws/postgres-websockets.sha256 ws/postgres-websockets ./result/
28+
VERSION=$(awk '/^version: / { print $2 };' < ws/postgres-websockets.cabal)
29+
./ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} ./result/
30+
31+
build-test:
32+
docker:
33+
- image: fpco/stack-build:lts-13.14
34+
- image: postgres:11-alpine
35+
environment:
36+
POSTGRES_DB: postgres_ws_test
37+
POSTGRES_USER: root
38+
steps:
39+
- checkout
40+
- restore_cache:
41+
name: Restore Cached Dependencies
42+
keys:
43+
- postgres-websockets-v2-{{ checksum "stack.yaml" }}
3344
- run:
3445
name: Resolve and update dependencies
3546
command: stack setup
47+
- run:
48+
name: Install Cabal and hlint
49+
command: stack install --system-ghc --resolver=lts-13.14 Cabal hlint
50+
- save_cache:
51+
name: Cache Dependencies
52+
key: postgres-websockets-v2-{{ checksum "stack.yaml" }}
53+
paths:
54+
- ".stack"
55+
- ".stack-work"
3656
- run:
3757
name: Build the dependencies and the library
3858
command: stack --silent build
@@ -44,28 +64,28 @@ jobs:
4464
command: stack --silent install
4565
- run:
4666
name: Calculate and save checksum
47-
command: sha256sum ~/.local/bin/postgres-websockets > /root/postgres-websockets.sha256
67+
command: sha256sum ~/.local/bin/postgres-websockets > ~/.local/bin/postgres-websockets.sha256
68+
- run:
69+
name: Save cabal file to preserve version
70+
command: cp postgres-websockets.cabal ~/.local/bin/
4871
- save_cache:
4972
name: Cache Dependencies
50-
key: postgres-websockets-v1-{{ checksum "postgres-websockets.cabal" }}
73+
key: postgres-websockets-v2-{{ checksum "stack.yaml" }}
5174
paths:
5275
- ".stack"
5376
- ".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/
77+
- persist_to_workspace:
78+
root: ~/.local/bin/
79+
paths:
80+
- "postgres-websockets"
81+
- "postgres-websockets.sha256"
82+
- "postgres-websockets.cabal"
6183

6284
workflows:
6385
version: 2
6486
main:
6587
jobs:
66-
- build-test-and-publish:
67-
filters:
68-
branches:
69-
only: master
70-
tags:
71-
only: /^[\d.]+$/
88+
- build-test
89+
- publish:
90+
requires:
91+
- build-test

stack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ extra-deps:
66
- primitive-extras-0.7.1@sha256:23905c57089418b1a2d324cfee3e81bbd5a344a0fa56a827867b2dce275fdb5e
77

88
ghc-options:
9-
postgres-websockets: -O2 -Wall -fwarn-identities -fno-warn-redundant-constraints
9+
postgres-websockets: -Wall -fwarn-identities -fno-warn-redundant-constraints

0 commit comments

Comments
 (0)