[#45] First attempt at using S3 cache

pull/72/head
Jef Roosens 2021-05-10 21:52:24 +02:00
parent 785acd5c2e
commit cd4075d294
Signed by: Jef Roosens
GPG Key ID: B580B976584B5F30
1 changed files with 64 additions and 10 deletions

View File

@ -1,24 +1,78 @@
pipeline: 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: build-frontend:
image: node:15-alpine3.13 image: node:15-alpine3.13
pull: true
commands: commands:
- cd web - cd web
- yarn install - yarn install
- yarn run build - yarn run build
lint-frontend:
image: node:15-alpine3.13
commands:
- cd web
- yarn run lint
# This doesn't require compiling anything build-backend:
lint-backend:
image: chewingbever/fej-builder:latest image: chewingbever/fej-builder:latest
pull: true
commands: 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: # publish-builder:
# image: plugins/docker # image: plugins/docker