Skip to content

Commit

Permalink
Try setup remote build cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Su5eD committed Jul 6, 2023
1 parent 469aca3 commit 31be303
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Build
on: [push, pull_request, merge_group]
env:
GRADLE_CACHE_URL: ${{ secrets.GRADLE_CACHE_URL }}
GRADLE_CACHE_USER: ${{ secrets.GRADLE_CACHE_USER }}
GRADLE_CACHE_PASSWORD: ${{ secrets.GRADLE_CACHE_PASSWORD }}
jobs:
build:
runs-on: ubuntu-22.04
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ permissions:
actions: read
contents: write

env:
GRADLE_CACHE_URL: ${{ secrets.GRADLE_CACHE_URL }}
GRADLE_CACHE_USER: ${{ secrets.GRADLE_CACHE_USER }}
GRADLE_CACHE_PASSWORD: ${{ secrets.GRADLE_CACHE_PASSWORD }}

jobs:
build:
runs-on: ubuntu-22.04
Expand Down
18 changes: 17 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,31 @@ plugins {
id("com.gradle.enterprise") version("3.13.4")
}

def ENV = System.getenv()
gradleEnterprise {
if (System.getenv("CI") != null) {
if (ENV.CI) {
buildScan {
publishAlways()
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
}
}
}
buildCache {
local {
enabled = !ENV.CI
}
if (ENV.GRADLE_CACHE_URL) {
remote(HttpBuildCache) {
url = ENV.GRADLE_CACHE_URL
push = ENV.CI
credentials {
username = ENV.GRADLE_CACHE_USER
password = ENV.GRADLE_CACHE_PASSWORD
}
}
}
}

rootProject.name = "fabric-api"

Expand Down

0 comments on commit 31be303

Please sign in to comment.