mirror of
https://github.com/typeable/rollbar-hs.git
synced 2024-08-15 16:50:25 +03:00
Separate the compile stage from testing
Might be overkill for this small of a workflow. Good to get practice with circleci and Make.
This commit is contained in:
parent
3b0f694ff3
commit
5deb32b2c0
@ -1,5 +1,30 @@
|
||||
version: 2
|
||||
jobs:
|
||||
compile:
|
||||
docker:
|
||||
- image: haskell:8.2.2
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-stack-{{ checksum "package.yaml" }}-{{ checksum "stack.yaml" }}
|
||||
- v1-stack-{{ checksum "package.yaml" }}-
|
||||
- v1-stack-
|
||||
name: Restoring stack cache
|
||||
- run:
|
||||
name: Compile
|
||||
command: make build
|
||||
- presist_to_workspace:
|
||||
root: dist
|
||||
paths:
|
||||
- '*'
|
||||
- save_cache:
|
||||
key: v1-stack-{{ checksum "package.yaml" }}-{{ checksum "stack.yaml" }}
|
||||
name: Caching stack
|
||||
paths:
|
||||
- .stack-work
|
||||
- /root/.stack
|
||||
|
||||
sdist:
|
||||
docker:
|
||||
- image: haskell:8.2.2
|
||||
@ -20,25 +45,18 @@ jobs:
|
||||
- image: haskell:8.2.2
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-stack-{{ checksum "package.yaml" }}-{{ checksum "stack.yaml" }}
|
||||
- v1-stack-{{ checksum "package.yaml" }}-
|
||||
- v1-stack-
|
||||
name: Restoring stack cache
|
||||
- attach_workspace:
|
||||
at: dist
|
||||
- run:
|
||||
name: Test
|
||||
command: make test
|
||||
- save_cache:
|
||||
key: v1-stack-{{ checksum "package.yaml" }}-{{ checksum "stack.yaml" }}
|
||||
name: Caching stack
|
||||
paths:
|
||||
- .stack-work
|
||||
- /root/.stack
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
base:
|
||||
jobs:
|
||||
- compile
|
||||
- sdist
|
||||
- test
|
||||
- test:
|
||||
requires:
|
||||
- compile
|
||||
|
31
Makefile
31
Makefile
@ -8,14 +8,31 @@ STACK_WORK ?= .stack-work
|
||||
VERBOSITY ?= warn
|
||||
|
||||
CABAL_FILE := $(PROJECT_NAME).cabal
|
||||
DOC_TEST := $(DIST)/build/doc-test/doc-test
|
||||
GHCID := $(BIN)/ghcid
|
||||
STACK_FLAGS := --verbosity $(VERBOSITY)
|
||||
|
||||
.DEFAULT_GOAL := build
|
||||
.DEFAULT_GOAL := $(EMPTY)/build
|
||||
|
||||
$(BIN) $(DIST) $(EMPTY):
|
||||
mkdir -p $@
|
||||
|
||||
$(CABAL_FILE): package.yaml
|
||||
# `stack` has no way to run `hpack` directly.
|
||||
# We can run `hpack` indirectly with little overhead.
|
||||
$(STACK) $(STACK_FLAGS) build --dry-run
|
||||
|
||||
$(DOC_TEST): $(EMPTY)/build golden/**/*.json
|
||||
$@
|
||||
|
||||
$(EMPTY)/build: $(EMPTY)/stack-setup README.md Setup.hs package.yaml stack.yaml src/**/*.hs test/**/*.hs | $(DIST)
|
||||
$(STACK) $(STACK_FLAGS) build --no-run-tests --test
|
||||
cp -R $$($(STACK) $(STACK_FLAGS) path --dist-dir)/build $(DIST)/build
|
||||
touch $@
|
||||
|
||||
$(EMPTY)/doc-test: $(EMPTY)/build
|
||||
touch $@
|
||||
|
||||
$(EMPTY)/stack-setup: | $(EMPTY)
|
||||
$(STACK) $(STACK_FLAGS) setup
|
||||
touch $@
|
||||
@ -23,15 +40,6 @@ $(EMPTY)/stack-setup: | $(EMPTY)
|
||||
$(GHCID): $(EMPTY)/stack-setup | $(BIN)
|
||||
$(STACK) $(STACK_FLAGS) install ghcid --local-bin-path $(BIN)
|
||||
|
||||
$(CABAL_FILE): package.yaml
|
||||
# `stack` has no way to run `hpack` directly.
|
||||
# We can run `hpack` indirectly with little overhead.
|
||||
$(STACK) $(STACK_FLAGS) build --dry-run
|
||||
|
||||
.PHONY: build
|
||||
build: $(EMPTY)/stack-setup
|
||||
$(STACK) $(STACK_FLAGS) build --no-run-tests --test
|
||||
|
||||
.PHONY: cabal-check
|
||||
cabal-check: $(CABAL_FILE)
|
||||
$(CABAL) check
|
||||
@ -49,8 +57,7 @@ sdist: cabal-check | $(DIST)
|
||||
$(CABAL) sdist
|
||||
|
||||
.PHONY: test
|
||||
test: build
|
||||
$(STACK) $(STACK_FLAGS) test
|
||||
test: $(DOC_TEST)
|
||||
|
||||
.PHONY: upload-hackage
|
||||
upload-hackage: sdist
|
||||
|
Loading…
Reference in New Issue
Block a user