diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-08 10:30:44 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-08 12:12:52 +0300 |
commit | 09e0891c5172a1a6783f450f30cbede5384aa376 (patch) | |
tree | 494bce632effce45099c7e299f51f1570e49218d /.gitlab-ci.yml | |
parent | bc27aa6e3e862217c592251917546cd91797da94 (diff) |
ci: Introduce cache for Go modules
While we already have caches for build-time dependencies and Ruby Gems,
we don't have any for Go modules. As a result, each job needs to fetch
and build Go modules anew, which adds to the time it takes for these
jobs to finish.
Add a new Go module cache and include it as required.
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r-- | .gitlab-ci.yml | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0affab0ce..d8ed16d70 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,6 +19,7 @@ variables: POSTGRES_VERSION: "12.6-alpine" PGBOUNCER_VERSION: "1.16.1" BUNDLE_PATH: "${CI_PROJECT_DIR}/.ruby" + GOPATH: "${CI_PROJECT_DIR}/.go" include: - template: Workflows/MergeRequest-Pipelines.gitlab-ci.yml @@ -48,11 +49,23 @@ include: - .ruby policy: pull +.cache_go: + cache: &cache_go_configuration + key: + files: + - go.sum + prefix: go-${GO_VERSION} + paths: + - .go/pkg/mod + - _build/cache + policy: pull + .test_template: &test_definition stage: test cache: - *cache_deps_configuration - *cache_gems_configuration + - *cache_go_configuration services: - postgres:${POSTGRES_VERSION} variables: &postgres_variables @@ -102,6 +115,8 @@ build: policy: pull-push - <<: *cache_gems_configuration policy: pull-push + - <<: *cache_go_configuration + policy: pull-push script: - go version - make all git @@ -119,6 +134,7 @@ build:binaries: stage: build cache: - *cache_deps_configuration + - *cache_go_configuration only: - tags script: @@ -246,6 +262,7 @@ verify: stage: test cache: - *cache_gems_configuration + - *cache_go_configuration script: - make verify artifacts: @@ -259,6 +276,7 @@ dbschema: stage: test cache: - *cache_deps_configuration + - *cache_go_configuration services: # The database version we use must match the version of `pg_dump` we have # available in the build image. |