Skip to content

Commit

Permalink
CI: optimize caches used by CircleCI and GHA (#4461)
Browse files Browse the repository at this point in the history
* save Go build/test cache after tests complete
* optimize caches
  • Loading branch information
cce authored Sep 2, 2022
1 parent c47d718 commit eeeb7c3
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 10 deletions.
42 changes: 32 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,7 @@ commands:
- checkout
- prepare_go
- restore_libsodium
- restore_cache:
keys:
- 'go-mod-1.17.13-v4-{{ arch }}-{{ checksum "go.mod" }}-{{ checksum "go.sum" }}'
- restore_cache:
keys:
- 'go-cache-v4-{{ arch }}-{{ .Branch }}-{{ .Revision }}'
- 'go-cache-v4-{{ arch }}-{{ .Branch }}-'
- 'go-cache-v4-{{ arch }}-'
- restore_go_caches
- run:
name: scripts/travis/build.sh --make_debug
command: |
Expand All @@ -258,15 +251,42 @@ commands:
export GIMME_VERSION_PREFIX=<< parameters.build_dir >>/.gimme/versions
scripts/travis/build.sh --make_debug
- cache_libsodium
- save_go_caches

save_go_caches:
description: Cache Go source and build caches
parameters:
build_dir:
type: string
default: << pipeline.parameters.build_dir >>
steps:
- save_cache:
key: 'go-mod-1.17.13-v4-{{ arch }}-{{ checksum "go.mod" }}-{{ checksum "go.sum" }}'
name: Saving Go mod source cache
key: go-mod-v5-{{ .Branch }}-{{ checksum "go.sum" }}
paths:
- << parameters.build_dir >>/go/pkg/mod
- save_cache:
key: 'go-cache-v4-{{ arch }}-{{ .Branch }}-{{ .Revision }}'
name: Saving Go build cache
key: go-cache-v5-{{ arch }}-{{ .Branch }}-{{ checksum "go.sum" }}
paths:
- tmp/go-cache

restore_go_caches:
description: Restore Go source and build caches
steps:
- restore_cache:
name: Restoring Go mod source cache
keys:
- go-mod-v5-{{ .Branch }}-{{ checksum "go.sum" }}
- go-mod-v5-{{ .Branch }}-
- go-mod-v5-master-
- restore_cache:
name: Restoring Go build cache
keys:
- go-cache-v5-{{ arch }}-{{ .Branch }}-{{ checksum "go.sum" }}
- go-cache-v5-{{ arch }}-{{ .Branch }}-
- go-cache-v5-{{ arch }}-master-

cache_libsodium:
description: Cache libsodium for build
steps:
Expand All @@ -276,6 +296,7 @@ commands:
mkdir -p tmp
find crypto/libsodium-fork -type f -exec openssl md5 "{}" + > tmp/libsodium.md5
- save_cache:
name: Save cached libsodium build
key: 'libsodium-fork-v4-{{ arch }}-{{ checksum "tmp/libsodium.md5" }}'
paths:
- crypto/libs
Expand All @@ -289,6 +310,7 @@ commands:
mkdir -p tmp
find crypto/libsodium-fork -type f -exec openssl md5 "{}" + > tmp/libsodium.md5
- restore_cache:
name: Restore cached libsodium build
keys:
- 'libsodium-fork-v4-{{ arch }}-{{ checksum "tmp/libsodium.md5" }}'

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: "Build Windows"
on:
push:
branches:
- master
pull_request:
jobs:
build-windows:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/codegen_verification.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: "codegen verification"
on:
push:
branches:
- master
pull_request:
jobs:
codegen_verification:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: "ReviewDog workflow"
on:
push:
branches:
- master
pull_request:
jobs:
# Blocking Errors Section
Expand Down

0 comments on commit eeeb7c3

Please sign in to comment.