From 71325e7e88cea07bdaf68cc93bc38f9f094fdfa4 Mon Sep 17 00:00:00 2001 From: Ryland Herrick Date: Mon, 18 Sep 2017 14:46:26 -0500 Subject: [PATCH 1/5] Changing Project A --- project_a/file | 1 + 1 file changed, 1 insertion(+) diff --git a/project_a/file b/project_a/file index 0835e4f..0b50a9d 100644 --- a/project_a/file +++ b/project_a/file @@ -1 +1,2 @@ change +change From 1a6dc6f7d3956fa58729b53adc073581fb496a2e Mon Sep 17 00:00:00 2001 From: Ryland Herrick Date: Mon, 18 Sep 2017 14:53:05 -0500 Subject: [PATCH 2/5] Changing Project B --- project_b/file | 1 + 1 file changed, 1 insertion(+) diff --git a/project_b/file b/project_b/file index 0835e4f..0b50a9d 100644 --- a/project_b/file +++ b/project_b/file @@ -1 +1,2 @@ change +change From e48ad6812742cfd230088720b07dc058c1a53c24 Mon Sep 17 00:00:00 2001 From: Ryland Herrick Date: Mon, 18 Sep 2017 14:53:47 -0500 Subject: [PATCH 3/5] Changing projects A and B --- project_a/file | 1 + project_b/file | 1 + 2 files changed, 2 insertions(+) diff --git a/project_a/file b/project_a/file index 0b50a9d..a90cf5c 100644 --- a/project_a/file +++ b/project_a/file @@ -1,2 +1,3 @@ change change +change diff --git a/project_b/file b/project_b/file index 0b50a9d..a90cf5c 100644 --- a/project_b/file +++ b/project_b/file @@ -1,2 +1,3 @@ change change +change From 33614ab1b948850804d307eb531fe3058b28de67 Mon Sep 17 00:00:00 2001 From: Ryland Herrick Date: Mon, 18 Sep 2017 15:06:01 -0500 Subject: [PATCH 4/5] Changing neither project --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 21a073a..80637c9 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # monorepo-builds -Playing around with configuring Circle CI for a monorepo +Playing around with configuring Circle CI for a monorepo. + +Builds subprojects separately depending on whether they've been changed. From 43631ca0b7bf2c53185225711022224dfbf17016 Mon Sep 17 00:00:00 2001 From: Ryland Herrick Date: Tue, 19 Sep 2017 18:06:55 -0500 Subject: [PATCH 5/5] Place temporary hashes into a directory So that we don't have to enumerate them when saving to our cache. --- .circleci/config.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ef75526..4de720f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,30 +19,31 @@ jobs: name: Initialize project metadata command: | mkdir -p .project-metadata - touch .project-{a,b}-hash + mkdir -p tmp + touch tmp/.project-{a,b}-hash - run: name: Hash projects command: | - git log --pretty=format:'%H' -n 1 -- project_a > .project-a-hash.new - git log --pretty=format:'%H' -n 1 -- project_b > .project-b-hash.new + git log --pretty=format:'%H' -n 1 -- project_a > tmp/.project-a-hash.new + git log --pretty=format:'%H' -n 1 -- project_b > tmp/.project-b-hash.new - run: name: Determine changed projects command: | - if ! diff .project-a-hash{,.new} > /dev/null; then + if ! diff tmp/.project-a-hash{,.new} > /dev/null; then touch .project-metadata/.project-a-changed fi - if ! diff .project-b-hash{,.new} > /dev/null; then + if ! diff tmp/.project-b-hash{,.new} > /dev/null; then touch .project-metadata/.project-b-changed fi - run: name: Set current project hashes command: | - mv .project-a-hash{.new,} - mv .project-b-hash{.new,} + mv tmp/.project-a-hash{.new,} + mv tmp/.project-b-hash{.new,} - persist_to_workspace: root: . @@ -52,8 +53,7 @@ jobs: - save_cache: key: v1-project-metadata-{{ .Branch }}-{{ epoch }} paths: - - .project-a-hash - - .project-b-hash + - tmp/* project_a: <<: *defaults