From ea70e073ec94454148a42e931affca24f34d9932 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Thu, 4 Jan 2024 12:27:22 +1100 Subject: [PATCH] test build with cache --- .drone.sh | 1 + .drone.yml | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/.drone.sh b/.drone.sh index e27c75c..ce89b18 100644 --- a/.drone.sh +++ b/.drone.sh @@ -5,6 +5,7 @@ export CGO_ENABLED=0 export now=$(TZ=Australia/Sydney date '+%Y%m%d-%H%M%S') echo $now +make drone-cache echo "build commences" go build -ldflags "-X main.sha1ver=`git rev-parse HEAD` -X main.buildTime=$now" -o smt echo "build complete" diff --git a/.drone.yml b/.drone.yml index 45f0c39..5d6b7c8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -17,6 +17,21 @@ steps: - pandoc -s README.md --embed-resources -c www/mvp.css --template template.html -o ./www/index.html - cp ./www/index.html /shared/index.html +- name: restore-cache-with-filesystem + image: meltwater/drone-cache + pull: true + settings: + backend: "filesystem" + restore: true + cache_key: "volume" + archive_format: "gzip" + # filesystem_cache_root: "/tmp/cache" + mount: + - 'vendor' + volumes: + - name: cache + path: /tmp/cache + - name: build image: golang volumes: @@ -26,6 +41,21 @@ steps: - cp /shared/index.html ./www/ - sh ./.drone.sh +- name: rebuild-cache-with-filesystem + image: meltwater/drone-cache + pull: true + settings: + backend: "filesystem" + rebuild: true + cache_key: "volume" + archive_format: "gzip" + # filesystem_cache_root: "/tmp/cache" + mount: + - 'vendor' + volumes: + - name: cache + path: /tmp/cache + # Copy binary to test server - name: coadcorp-deploy image: appleboy/drone-scp @@ -77,4 +107,7 @@ steps: volumes: - name: shared - temp: {} \ No newline at end of file + temp: {} +- name: cache + host: + path: /var/lib/cache \ No newline at end of file