From b968bb53a49993dfd57c9c13d5b3ca1d49631648 Mon Sep 17 00:00:00 2001 From: joneshf Date: Sun, 29 Jul 2018 13:07:43 -0700 Subject: [PATCH] Split out test targets It looks like, when we switch jobs in CI the new checkout has newer timestamps than what's in the make cache. Rather than dealing with that anymore, we alter the targets. We can change `test` to ensure builds are up to date. Then we can leave the individual test targets to run whatever is there. In CI this means we can set the workflow to run the tests separately. --- .circleci/config.yml | 9 ++++----- Makefile | 13 +++++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e38f9ae..617a11d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,7 +17,6 @@ jobs: - persist_to_workspace: root: . paths: - - .make - dist - save_cache: key: v1-stack-{{ checksum "package.yaml" }}-{{ checksum "stack.yaml" }} @@ -41,7 +40,7 @@ jobs: name: Build sdist command: make sdist - test: + doc-test: docker: - image: haskell:8.2.2 steps: @@ -49,8 +48,8 @@ jobs: - attach_workspace: at: . - run: - name: Test - command: make test + name: Doc test + command: make test-doc-test workflows: version: 2 @@ -58,6 +57,6 @@ workflows: jobs: - compile - sdist - - test: + - doc-test: requires: - compile diff --git a/Makefile b/Makefile index 240be7b..f2ea6b6 100644 --- a/Makefile +++ b/Makefile @@ -22,12 +22,13 @@ $(CABAL_FILE): package.yaml # We can run `hpack` indirectly with little overhead. $(STACK) $(STACK_FLAGS) build --dry-run -$(DOC_TEST): $(EMPTY)/build - $@ +$(DOC_TEST): + rm -f $(EMPTY)/build + $(MAKE) $(EMPTY)/build $(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 + cp -R $$($(STACK) $(STACK_FLAGS) path --dist-dir)/build $(DIST) touch $@ $(EMPTY)/stack-setup: | $(EMPTY) @@ -57,7 +58,11 @@ sdist: cabal-check | $(DIST) $(CABAL) sdist .PHONY: test -test: $(DOC_TEST) +test: $(EMPTY)/build test-doc-test + +.PHONY: test-doc-test +test-doc-test: $(DOC_TEST) + $< .PHONY: upload-hackage upload-hackage: sdist