gitlab ci: properly cache dependencies

This commit is contained in:
Bixilon 2022-11-14 11:48:30 +01:00
parent 08c26e8c3d
commit 9ee2df005a
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -6,28 +6,31 @@ variables:
before_script: before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle - export GRADLE_USER_HOME=`pwd`/.gradle
cache:
paths:
- .gradle/wrapper
- .gradle/caches
stages: stages:
- build - build
- test - test
- package - package
cache:
- key: "$CI_COMMIT_REF_NAME"
policy: push
paths:
- build
- key:
files:
- "*gradle/**"
- "**.kts"
policy: pull-push
paths:
- .gradle
build: build:
stage: build stage: build
script: ./gradlew --build-cache assemble script: ./gradlew --build-cache assemble
only: only:
- master - master
- merge_requests - merge_requests
cache:
key: "$CI_COMMIT_REF_NAME"
policy: push
paths:
- build
- .gradle
test: test:
stage: test stage: test
@ -39,12 +42,6 @@ test:
when: always when: always
reports: reports:
junit: build/test-results/**/TEST-*.xml junit: build/test-results/**/TEST-*.xml
cache:
key: "$CI_COMMIT_REF_NAME"
policy: pull
paths:
- build
- .gradle
package: package:
stage: package stage: package
@ -55,9 +52,3 @@ package:
artifacts: artifacts:
paths: paths:
- build/libs/minosoft-fat-*.jar - build/libs/minosoft-fat-*.jar
cache:
key: "$CI_COMMIT_REF_NAME"
policy: pull
paths:
- build
- .gradle