mirror of
https://github.com/typeable/rollbar-hs.git
synced 2024-09-11 05:35:27 +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
|
version: 2
|
||||||
jobs:
|
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:
|
sdist:
|
||||||
docker:
|
docker:
|
||||||
- image: haskell:8.2.2
|
- image: haskell:8.2.2
|
||||||
@ -20,25 +45,18 @@ jobs:
|
|||||||
- image: haskell:8.2.2
|
- image: haskell:8.2.2
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- attach_workspace:
|
||||||
keys:
|
at: dist
|
||||||
- v1-stack-{{ checksum "package.yaml" }}-{{ checksum "stack.yaml" }}
|
|
||||||
- v1-stack-{{ checksum "package.yaml" }}-
|
|
||||||
- v1-stack-
|
|
||||||
name: Restoring stack cache
|
|
||||||
- run:
|
- run:
|
||||||
name: Test
|
name: Test
|
||||||
command: make test
|
command: make test
|
||||||
- save_cache:
|
|
||||||
key: v1-stack-{{ checksum "package.yaml" }}-{{ checksum "stack.yaml" }}
|
|
||||||
name: Caching stack
|
|
||||||
paths:
|
|
||||||
- .stack-work
|
|
||||||
- /root/.stack
|
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
base:
|
base:
|
||||||
jobs:
|
jobs:
|
||||||
|
- compile
|
||||||
- sdist
|
- sdist
|
||||||
- test
|
- test:
|
||||||
|
requires:
|
||||||
|
- compile
|
||||||
|
31
Makefile
31
Makefile
@ -8,14 +8,31 @@ STACK_WORK ?= .stack-work
|
|||||||
VERBOSITY ?= warn
|
VERBOSITY ?= warn
|
||||||
|
|
||||||
CABAL_FILE := $(PROJECT_NAME).cabal
|
CABAL_FILE := $(PROJECT_NAME).cabal
|
||||||
|
DOC_TEST := $(DIST)/build/doc-test/doc-test
|
||||||
GHCID := $(BIN)/ghcid
|
GHCID := $(BIN)/ghcid
|
||||||
STACK_FLAGS := --verbosity $(VERBOSITY)
|
STACK_FLAGS := --verbosity $(VERBOSITY)
|
||||||
|
|
||||||
.DEFAULT_GOAL := build
|
.DEFAULT_GOAL := $(EMPTY)/build
|
||||||
|
|
||||||
$(BIN) $(DIST) $(EMPTY):
|
$(BIN) $(DIST) $(EMPTY):
|
||||||
mkdir -p $@
|
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)
|
$(EMPTY)/stack-setup: | $(EMPTY)
|
||||||
$(STACK) $(STACK_FLAGS) setup
|
$(STACK) $(STACK_FLAGS) setup
|
||||||
touch $@
|
touch $@
|
||||||
@ -23,15 +40,6 @@ $(EMPTY)/stack-setup: | $(EMPTY)
|
|||||||
$(GHCID): $(EMPTY)/stack-setup | $(BIN)
|
$(GHCID): $(EMPTY)/stack-setup | $(BIN)
|
||||||
$(STACK) $(STACK_FLAGS) install ghcid --local-bin-path $(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
|
.PHONY: cabal-check
|
||||||
cabal-check: $(CABAL_FILE)
|
cabal-check: $(CABAL_FILE)
|
||||||
$(CABAL) check
|
$(CABAL) check
|
||||||
@ -49,8 +57,7 @@ sdist: cabal-check | $(DIST)
|
|||||||
$(CABAL) sdist
|
$(CABAL) sdist
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: build
|
test: $(DOC_TEST)
|
||||||
$(STACK) $(STACK_FLAGS) test
|
|
||||||
|
|
||||||
.PHONY: upload-hackage
|
.PHONY: upload-hackage
|
||||||
upload-hackage: sdist
|
upload-hackage: sdist
|
||||||
|
Loading…
Reference in New Issue
Block a user