From 04cbf7e7afc2dcb19926a75dbe1c666fdff7b5a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Sun, 13 Aug 2023 08:11:58 +0200 Subject: [PATCH] ci: enable minio cache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Squashed commit of the following: commit e14be61983115bf4ff75e9cf681850a846f9c356 Author: Tomáš Mládek Date: Sun Aug 13 08:11:32 2023 +0200 ci: wrap up cache commit 968fa479169ef104aff826113f925d82a35d6f50 Author: Tomáš Mládek Date: Sun Aug 13 07:56:41 2023 +0200 ci, wip: fix cargo cache, env expansion commit 9f6e9992b23f16bc99ab7f2da98370075117de70 Author: Tomáš Mládek Date: Sat Aug 12 21:07:21 2023 +0200 wip: upload test commit e5fe319ef771fce68eff2e85577cb03385c2f6c4 Author: Tomáš Mládek Date: Sat Aug 12 20:39:52 2023 +0200 ci: add s3 cache --- .woodpecker.yml | 64 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 12 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 0a44e5d..4db162f 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,26 +1,47 @@ pipeline: + cache:get: + image: meltwater/drone-cache:v1 + pull: true + settings: + restore: true + endpoint: + from_secret: S3_ENDPOINT + access-key: + from_secret: S3_ACCESS_KEY + secret-key: + from_secret: S3_SECRET_KEY + bucket: "upend-ci-cache" + cache_key: "{{ .Commit.Branch }}" + path-style: true + region: anabasis + mount: + - ".cargo" + - ".pnpm" + secrets: [S3_ENDPOINT, S3_ACCESS_KEY, S3_SECRET_KEY] + when: + event: push + prepare:cache:frontend: group: init image: albedo.lan:5000/upend-node:latest pull: true commands: - - pnpm config set store-dir $PWD/.pnpm + - pnpm config set store-dir $CI_WORKSPACE/.pnpm + - mkdir -p $CI_WORKSPACE/.pnpm prepare:cache:backend: group: init image: albedo.lan:5000/upend-rust:latest pull: true - environment: - CARGO_HOME: ${CI_WORKSPACE}/.cargo commands: - - cp -r /usr/local/cargo $CARGO_HOME + - export CARGO_HOME=$CI_WORKSPACE/.cargo + - test -d $CARGO_HOME || cp -vr /usr/local/cargo $CARGO_HOME prepare:build:wasmlib: image: albedo.lan:5000/upend-rust:latest pull: true - environment: - CARGO_HOME: ${CI_WORKSPACE}/.cargo commands: + - export CARGO_HOME=$CI_WORKSPACE/.cargo - rustc --version && cargo --version - task build:wasmlib # volumes: @@ -30,9 +51,8 @@ pipeline: group: build image: albedo.lan:5000/upend-rust:latest pull: true - environment: - CARGO_HOME: ${CI_WORKSPACE}/.cargo commands: + - export CARGO_HOME=$CI_WORKSPACE/.cargo - rustc --version && cargo --version - task build:backend # volumes: @@ -50,9 +70,8 @@ pipeline: group: lint image: albedo.lan:5000/upend-rust:latest pull: true - environment: - CARGO_HOME: ${CI_WORKSPACE}/.cargo commands: + - export CARGO_HOME=$CI_WORKSPACE/.cargo - rustup component add clippy - task lint:backend - git status -vvv @@ -105,13 +124,34 @@ pipeline: group: test image: albedo.lan:5000/upend-rust:latest pull: true - environment: - CARGO_HOME: ${CI_WORKSPACE}/.cargo commands: + - export CARGO_HOME=$CI_WORKSPACE/.cargo - task test:backend # volumes: # - rust_registry:/usr/local/cargo + cache:push: + image: meltwater/drone-cache:v1 + pull: true + settings: + rebuild: true + endpoint: + from_secret: S3_ENDPOINT + access-key: + from_secret: S3_ACCESS_KEY + secret-key: + from_secret: S3_SECRET_KEY + bucket: "upend-ci-cache" + cache_key: "{{ .Commit.Branch }}" + path-style: true + region: anabasis + mount: + - ".cargo" + - ".pnpm" + secrets: [S3_ENDPOINT, S3_ACCESS_KEY, S3_SECRET_KEY] + when: + event: push + package: image: albedo.lan:5000/upend-deploy:latest pull: true