Skip to content

Commit

Permalink
Disable build cache since Github Action runners fail with 'no space l…
Browse files Browse the repository at this point in the history
…eft on device'

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
  • Loading branch information
reta committed Oct 5, 2023
1 parent 1eec0f1 commit ee0a39e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,41 @@ name: Gradle Precommit and Assemble
on: [pull_request]

jobs:

precommit:
if: github.repository == 'opensearch-project/OpenSearch'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Clear cache
uses: actions/github-script@v6
with:
script: |
console.log("About to clear")
const caches = await github.rest.actions.getActionsCacheList({
owner: context.repo.owner,
repo: context.repo.repo,
})
for (const cache of caches.data.actions_caches) {
console.log(cache)
github.rest.actions.deleteActionsCacheById({
owner: context.repo.owner,
repo: context.repo.repo,
cache_id: cache.id,
})
}
console.log("Clear completed")
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
cache: gradle
- name: Run Gradle (precommit)
run: |
./gradlew javadoc precommit --parallel
./gradlew javadoc precommit --parallel --no-build-cache -PDISABLE_BUILD_CACHE -Dorg.gradle.caching=false
- name: Setup docker (missing on MacOS)
if: runner.os == 'macos'
run: |
Expand All @@ -27,4 +45,4 @@ jobs:
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
- name: Run Gradle (assemble)
run: |
./gradlew assemble --parallel
./gradlew assemble --parallel --no-build-cache -PDISABLE_BUILD_CACHE -Dorg.gradle.caching=false
4 changes: 3 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ plugins {
id "com.gradle.enterprise" version "3.14.1"
}

ext.disableBuildCache = hasProperty('DISABLE_BUILD_CACHE') || System.getenv().containsKey('DISABLE_BUILD_CACHE')

buildCache {
local {
enabled = true
enabled = !disableBuildCache
removeUnusedEntriesAfterDays = 14
}
}
Expand Down

0 comments on commit ee0a39e

Please sign in to comment.