From b81eafb8a933c38077cd2166745f2066514598fb Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Sat, 19 Oct 2024 13:34:37 +0100
Subject: [PATCH] Adopt the slightly better cache approach

---
 ci-cache-test.yml | 29 -----------------------------
 ci.yml            | 13 ++++++++-----
 2 files changed, 8 insertions(+), 34 deletions(-)
 delete mode 100644 ci-cache-test.yml

diff --git a/ci-cache-test.yml b/ci-cache-test.yml
deleted file mode 100644
index ebac5d0..0000000
--- a/ci-cache-test.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-go_test:
-  stage: test
-  image: registry.git.autistici.org/pipelines/images/test/golang:master
-  variables:
-    GOPATH: /tmp/.go-$CI_JOB_ID
-  before_script:
-    - mkdir -p .go
-    - mv .go $GOPATH
-  after_script:
-    - rm -fr .go
-    - mv $GOPATH .go
-  cache:
-    key: golang-test-3
-    unprotect: true
-    paths:
-      - .go/pkg/mod
-  script:
-    - if [ -n "$GO_TEST_PACKAGES" ]; then apt-get -q update; env DEBIAN_FRONTEND=noninteractive apt-get -qy install --no-install-recommends $GO_TEST_PACKAGES; fi
-    - if [ -n "$GO_TEST_GENERATE" ]; then go generate ./... ; fi
-    - run-go-test ${GO_TEST_ARGS:-} ./...
-  coverage: '/overall coverage: \d+.\d+%/'
-  artifacts:
-    when: always
-    reports:
-      coverage_report:
-        coverage_format: cobertura
-        path: cover.xml
-      junit: report.xml
-
diff --git a/ci.yml b/ci.yml
index 488ef53..bf92ae1 100644
--- a/ci.yml
+++ b/ci.yml
@@ -2,15 +2,18 @@ go_test:
   stage: test
   image: registry.git.autistici.org/pipelines/images/test/golang:master
   variables:
-    GOMODCACHE: $CI_PROJECT_DIR/.gocache/pkg/mod
-    GOCACHE: $CI_PROJECT_DIR/.gocache/build-cache
+    GOPATH: /tmp/.go-$CI_JOB_ID
   before_script:
-    - mkdir -p .gocache/pkg/mod .gocache/build-cache
+    - mkdir -p .go
+    - mv .go $GOPATH
+  after_script:
+    - rm -fr .go
+    - mv $GOPATH .go
   cache:
-    key: golang-test
+    key: go-test-cache
     unprotect: true
     paths:
-      - .gocache/
+      - .go/pkg/mod
   script:
     - if [ -n "$GO_TEST_PACKAGES" ]; then apt-get -q update; env DEBIAN_FRONTEND=noninteractive apt-get -qy install --no-install-recommends $GO_TEST_PACKAGES; fi
     - if [ -n "$GO_TEST_GENERATE" ]; then go generate ./... ; fi
-- 
GitLab