From cd4075d294ed3a8ae95c5e95bac7aa720bf3e3f5 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Mon, 10 May 2021 21:52:24 +0200 Subject: [PATCH] [#45] First attempt at using S3 cache --- .woodpecker.yml | 74 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 64 insertions(+), 10 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 45bb910..0711f6f 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,24 +1,78 @@ pipeline: + # Download the cache from S3 + restore-cache: + image: plugins/drone-s3-cache + pull: true + + endpoint: $S3_ENDPOINT + access_key: $S3_USER + secret_key: $S3_PASSWORD + root: fej_build-cache + restore: true + + secrets: [ s3_endpoint, s3_user, s3_password ] + + + # =====LINTING===== + lint-frontend: + image: node:15-alpine3.13 + group: lint + commands: + - cd web + - yarn run lint + + lint-backend: + image: chewingbever/fej-builder:latest + pull: true + group: lint + commands: + - cargo fmt -- --check + + + # =====BUILDING===== build-frontend: image: node:15-alpine3.13 - pull: true commands: - cd web - yarn install - yarn run build - lint-frontend: - image: node:15-alpine3.13 - commands: - - cd web - - yarn run lint - # This doesn't require compiling anything - lint-backend: + build-backend: image: chewingbever/fej-builder:latest - pull: true commands: - - cargo fmt -- --check + - cargo build + + + # =====TESTING===== + test-backend: + image: chewingbever/fej-builder:latest + commands: + # This is run here because it requires compilation + - cargo clippy -- --no-deps -D warnings + - cargo test + + + # =====REBUILD CACHE===== + rebuild-cache: + image: plugins/drone-s3-cache + + endpoint: $S3_ENDPOINT + access_key: $S3_USER + secret_key: $S3_PASSWORD + root: fej_build-cache + rebuild: true + flush: true + # Delete cache older than 30 days (might lower this) + flush_age: 30 + mount: + - target + - web/node_modules + + secrets: [ s3_endpoint, s3_user, s3_password ] + # Push the cache, even on failure + when: [ success, failure ] + # publish-builder: # image: plugins/docker