Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add build and test cache into github actions cache #1739

Conversation

Matovidlo
Copy link
Contributor

@Matovidlo Matovidlo commented Apr 30, 2024

Jira: PSGO-561

Changes:

  • Add caching of go build and tests into github actions cache.
  • Change mod time of files due to caching issues of test cases, where it is based on mod time and each git clone pulls the files and changes mod time to current time. cmd/go: test cache hash inputs include ModTime, often causing cache misses on CI golang/go#58571
  • Remove -coverprofile flag that prevents caching of tests.
  • Add -coverprofile flag for release pipeline. Tagged commits and main.
  • Create go tools cache to reduce size of cache per step.
  • Cache of e2e tests is already injected but not evaluated. Will be done in next PR.
  • Add go mod download step to cache also packages in tools cache.

@Matovidlo Matovidlo force-pushed the mv-PSGO-561-adopt-simple-caching-of-tests-similar-to-local-cache-into-ci branch 3 times, most recently from 3ce96ae to d7de716 Compare May 2, 2024 11:24
Matovidlo added 2 commits May 2, 2024 13:34
Linter goes faster than tests, remove the linter cache so the CI is
efficient and cache less poluted.

Fix makefile target with auto verbose tag.
@Matovidlo Matovidlo force-pushed the mv-PSGO-561-adopt-simple-caching-of-tests-similar-to-local-cache-into-ci branch 9 times, most recently from 8cc48bc to 623a995 Compare May 3, 2024 12:59
@Matovidlo Matovidlo force-pushed the mv-PSGO-561-adopt-simple-caching-of-tests-similar-to-local-cache-into-ci branch from 623a995 to 5aa193e Compare May 3, 2024 13:15
Copy link
Contributor Author

@Matovidlo Matovidlo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to fix the CI to generate coverprofile on tagged commits and main branch/ release.
Caches currently takes up 4.5 GB instead of 3.9GB which is not bad result as it is approximatelly ~600MB per ~/.cache/go-build for each platform. So ~1.8GB was approximate increase in general and ends up only increased by ~600MB.
The workflow takes up to ~11-12 minutes when no code change is made, the caching looks currently alright and hit ratio works.

.github/workflows/test-unit.yml Outdated Show resolved Hide resolved
scripts/tests.sh Show resolved Hide resolved
.github/workflows/test-unit.yml Show resolved Hide resolved
.github/workflows/test-e2e-service-stream.yml Outdated Show resolved Hide resolved
.github/actions/go-cache/action.yml Show resolved Hide resolved
@Matovidlo Matovidlo force-pushed the mv-PSGO-561-adopt-simple-caching-of-tests-similar-to-local-cache-into-ci branch 7 times, most recently from e61335a to 1751d01 Compare May 7, 2024 08:26
.github/actions/go-cache/action.yml Show resolved Hide resolved
.github/actions/go-tools-cache/action.yml Show resolved Hide resolved
.github/workflows/test-e2e-cli.yml Show resolved Hide resolved
.github/workflows/test-unit.yml Show resolved Hide resolved
scripts/tools.sh Show resolved Hide resolved
@Matovidlo Matovidlo force-pushed the mv-PSGO-561-adopt-simple-caching-of-tests-similar-to-local-cache-into-ci branch from ba19752 to 1693148 Compare May 7, 2024 09:58
@Matovidlo Matovidlo marked this pull request as ready for review May 7, 2024 09:59
@Matovidlo Matovidlo force-pushed the mv-PSGO-561-adopt-simple-caching-of-tests-similar-to-local-cache-into-ci branch from cb68d0a to f882f85 Compare May 7, 2024 10:26
@Matovidlo Matovidlo force-pushed the mv-PSGO-561-adopt-simple-caching-of-tests-similar-to-local-cache-into-ci branch 4 times, most recently from 804e077 to 8385b95 Compare May 7, 2024 11:36
move installation of Go before `go mod download`.
move installation of tools and modules into `go-tools-cache`.
@Matovidlo Matovidlo force-pushed the mv-PSGO-561-adopt-simple-caching-of-tests-similar-to-local-cache-into-ci branch from 8385b95 to 5ff3213 Compare May 7, 2024 11:49
Matovidlo and others added 4 commits May 7, 2024 13:54
…he miss

fix: touch takes different format in MacOS than Unix.
fix path to work also on Windows
reduces time to install tools on windows.
@Matovidlo Matovidlo force-pushed the mv-PSGO-561-adopt-simple-caching-of-tests-similar-to-local-cache-into-ci branch from 5ff3213 to 6a237bf Compare May 7, 2024 11:54
Copy link

github-actions bot commented May 7, 2024

Apps Proxy Kubernetes Diff [CI]

Between base e967004 ⬅️ head 6a237bf.

Expand
--- /tmp/artifacts/test-k8s-state.old.json.processed.kv	2024-05-07 12:01:30.822030694 +0000
+++ /tmp/artifacts/test-k8s-state.new.json.processed.kv	2024-05-07 12:01:30.946030185 +0000
@@ -105 +105 @@
-<Deployment/apps-proxy>.spec.template.spec.containers[0].image = "docker.io/keboola/apps-proxy:e967004";
+<Deployment/apps-proxy>.spec.template.spec.containers[0].image = "docker.io/keboola/apps-proxy:6a237bf";
@@ -461,3 +461,3 @@
-<Pod/apps-proxy-<hash>>.spec.containers[0].image = "docker.io/keboola/apps-proxy:e967004";
-<Pod/apps-proxy-<hash>>.spec.containers[0].image = "docker.io/keboola/apps-proxy:e967004";
-<Pod/apps-proxy-<hash>>.spec.containers[0].image = "docker.io/keboola/apps-proxy:e967004";
+<Pod/apps-proxy-<hash>>.spec.containers[0].image = "docker.io/keboola/apps-proxy:6a237bf";
+<Pod/apps-proxy-<hash>>.spec.containers[0].image = "docker.io/keboola/apps-proxy:6a237bf";
+<Pod/apps-proxy-<hash>>.spec.containers[0].image = "docker.io/keboola/apps-proxy:6a237bf";
@@ -879 +879 @@
-<ReplicaSet/apps-proxy-<hash>>.spec.template.spec.containers[0].image = "docker.io/keboola/apps-proxy:e967004";
+<ReplicaSet/apps-proxy-<hash>>.spec.template.spec.containers[0].image = "docker.io/keboola/apps-proxy:6a237bf";


(see artifacts in the Github Action for more information)

Copy link

github-actions bot commented May 7, 2024

Templates API Kubernetes Diff [CI]

Between base e967004 ⬅️ head 6a237bf.

Expand
--- /tmp/artifacts/test-k8s-state.old.json.processed.kv	2024-05-07 12:03:10.821410702 +0000
+++ /tmp/artifacts/test-k8s-state.new.json.processed.kv	2024-05-07 12:03:11.025411248 +0000
@@ -194 +194 @@
-<Deployment/templates-api>.spec.template.spec.containers[0].image = "docker.io/keboola/templates-api:e967004";
+<Deployment/templates-api>.spec.template.spec.containers[0].image = "docker.io/keboola/templates-api:6a237bf";
@@ -747,3 +747,3 @@
-<Pod/templates-api-<hash>>.spec.containers[0].image = "docker.io/keboola/templates-api:e967004";
-<Pod/templates-api-<hash>>.spec.containers[0].image = "docker.io/keboola/templates-api:e967004";
-<Pod/templates-api-<hash>>.spec.containers[0].image = "docker.io/keboola/templates-api:e967004";
+<Pod/templates-api-<hash>>.spec.containers[0].image = "docker.io/keboola/templates-api:6a237bf";
+<Pod/templates-api-<hash>>.spec.containers[0].image = "docker.io/keboola/templates-api:6a237bf";
+<Pod/templates-api-<hash>>.spec.containers[0].image = "docker.io/keboola/templates-api:6a237bf";
@@ -1406 +1406 @@
-<ReplicaSet/templates-api-<hash>>.spec.template.spec.containers[0].image = "docker.io/keboola/templates-api:e967004";
+<ReplicaSet/templates-api-<hash>>.spec.template.spec.containers[0].image = "docker.io/keboola/templates-api:6a237bf";
@@ -1477,0 +1478,12 @@
+<Secret/sh.helm.release.v1.templates-api-etcd.v2> = {};
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.apiVersion = "v1";
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.data = {};
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.kind = "Secret";
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.metadata = {};
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.metadata.labels = {};
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.metadata.labels.name = "templates-api-etcd";
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.metadata.labels.owner = "helm";
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.metadata.labels.version = "2";
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.metadata.name = "sh.helm.release.v1.templates-api-etcd.v2";
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.metadata.namespace = "templates-api";
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.type = "helm.sh/release.v1";


(see artifacts in the Github Action for more information)

Copy link
Contributor

@michaljurecko michaljurecko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 Let's try it.

.github/actions/go-tools-cache/action.yml Show resolved Hide resolved
.github/workflows/test-k8s-service-buffer.yml Show resolved Hide resolved
@michaljurecko michaljurecko requested a review from hosekpeter May 7, 2024 14:35
@Matovidlo Matovidlo merged commit 5c8bf42 into main May 9, 2024
15 checks passed
@Matovidlo Matovidlo deleted the mv-PSGO-561-adopt-simple-caching-of-tests-similar-to-local-cache-into-ci branch May 9, 2024 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants