git.iko.soy/typeable/rollbar-hs
on master help sign in
Add rules for uploading to hackage

While it would be really nice to run this from CI, The only way to upload a package involves using account-wide credentials. We can either use a username/password, or an API token. Both of these credentials have the same privileges, and that's too much power to give to CI. For now, we run this from the local machine. Maybe we can think of another way that's a bit safer.

commitd5d6d737698c331ac37b88f4e24361de7fbf1b6b authorjoneshf <jones3.hardy@gmail.com> dateFri 27 Jul 2018, 05:03 (8 years ago) parente1dfee6
2 files changed+45−4
.circleci/config.yml+11 Makefile+34−4
.circleci/config.yml+11
@@ -1,5 +1,14 @@
11version: 2
22jobs:
3+ sdist:
4+ docker:
5+ - image: haskell:8.2.2
6+ steps:
7+ - checkout
8+ - run:
9+ name: Build sdist
10+ command: make sdist
11+
312 test:
413 docker:
514 - image: haskell:8.2.2
@@ -20,8 +29,10 @@ jobs:
2029 paths:
2130 - .stack-work
2231 - /root/.stack
32+
2333workflows:
2434 version: 2
2535 base:
2636 jobs:
37+ - sdist
2738 - test
Makefile+34−4
@@ -1,4 +1,9 @@
1+PROJECT_NAME := rollbar-hs
2+
13BIN := bin
4+CABAL := cabal
5+CABAL_FILE := $(PROJECT_NAME).cabal
6+DIST := dist
27EMPTY := .make
38GHCID := $(BIN)/ghcid
49STACK := stack
@@ -6,30 +11,55 @@ STACK_WORK := .stack-work
611
712.DEFAULT_GOAL := build
813
14+$(BIN):
15+ mkdir -p $@
16+
17+$(DIST):
18+ mkdir -p $@
19+
920$(EMPTY):
10− mkdir $@
21+ mkdir -p $@
1122
1223$(EMPTY)/stack-setup: | $(EMPTY)
1324 $(STACK) setup
1425 touch $@
1526
16−$(GHCID): $(EMPTY)/stack-setup
27+$(GHCID): $(EMPTY)/stack-setup | $(BIN)
1728 $(STACK) install ghcid --local-bin-path $(BIN)
1829
30+$(CABAL_FILE):
31+ # `stack` has no way to run `hpack` directly.
32+ # We can run `hpack` indirectly with little overhead.
33+ $(STACK) build --dry-run
34+
1935.PHONY: build
2036build: $(EMPTY)/stack-setup
2137 $(STACK) build --no-run-tests --test
2238
39+.PHONY: cabal-check
40+cabal-check: $(CABAL_FILE)
41+ $(CABAL) check
42+
2343.PHONY: clean
2444clean:
25− rm -f $(BIN)/*
26− rm -f $(EMPTY)/*
45+ rm -f $(CABAL_FILE)
46+ rm -fr $(BIN)
47+ rm -fr $(DIST)
48+ rm -fr $(EMPTY)
2749 rm -fr $(STACK_WORK)
2850
51+.PHONY: sdist
52+sdist: cabal-check | $(DIST)
53+ $(CABAL) sdist
54+
2955.PHONY: test
3056test: build
3157 $(STACK) test
3258
59+.PHONY: upload-hackage
60+upload-hackage: sdist
61+ @ $(CABAL) upload $(DIST)/$(PROJECT_NAME)-*.tar.gz
62+
3363.PHONY: watch
3464watch: $(GHCID)
3565 $(GHCID)