Skip to content

Commit

Permalink
chore: enable local build cache, and use burrunan/gradle-cache-action…
Browse files Browse the repository at this point in the history
…@v1 for GitHub Actions caching
  • Loading branch information
vlsi committed Aug 7, 2020
1 parent 34cd4f9 commit 3802b45
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 28 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/buildcache.yml
Expand Up @@ -22,12 +22,10 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.jdk }}
- uses: actions/cache@v2
name: Cache ./gradle/caches/
- uses: burrunan/gradle-cache-action@v1
name: Cache .gradle
with:
path: |
~/.gradle/caches/
key: gradle-${{ runner.os }}-caches-${{ hashFiles('build.properties', '**/*.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }}
job-id: jdk${{ matrix.jdk }}
- name: Build pgjdbc
env:
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }}
Expand Down
32 changes: 12 additions & 20 deletions .github/workflows/main.yml
Expand Up @@ -23,12 +23,10 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 8
- uses: actions/cache@v2
name: Cache ./gradle/caches/
- uses: burrunan/gradle-cache-action@v1
name: Cache .gradle
with:
path: |
~/.gradle/caches/
key: gradle-${{ runner.os }}-caches-${{ hashFiles('build.properties', '**/*.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }}
job-id: jdk8
- name: 'Verify code style'
env:
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }}
Expand Down Expand Up @@ -70,12 +68,10 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 8
- uses: actions/cache@v2
name: Cache ./gradle/caches/
- uses: burrunan/gradle-cache-action@v1
name: Cache .gradle
with:
path: |
~/.gradle/caches/
key: gradle-${{ runner.os }}-caches-${{ hashFiles('build.properties', '**/*.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }}
job-id: jdk${{ matrix.jdk }}
- name: 'Test'
env:
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }}
Expand All @@ -97,12 +93,10 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 11
- uses: actions/cache@v2
name: Cache ./gradle/caches/
- uses: burrunan/gradle-cache-action@v1
name: Cache .gradle
with:
path: |
~/.gradle/caches/
key: gradle-${{ runner.os }}-caches-${{ hashFiles('build.properties', '**/*.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }}
job-id: checker-jdk11
- name: 'Run CheckerFramework'
env:
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }}
Expand All @@ -127,12 +121,10 @@ jobs:
sudo -- sh -c "echo 127.0.0.1 localhost auth-test-localhost.postgresql.example.com > /etc/hosts"
cat /etc/hosts
- uses: actions/cache@v2
name: Cache ./gradle/caches/
- uses: burrunan/gradle-cache-action@v1
name: Cache .gradle
with:
path: |
~/.gradle/caches/
key: gradle-${{ runner.os }}-caches-${{ hashFiles('build.properties', '**/*.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }}
job-id: gss-jdk8
- name: 'Build pgjdbc'
run: ./gradlew publishToMavenLocal -Ppgjdbc.version=1.0.0-dev-master -PskipJavadoc
- name: 'Run tests'
Expand Down
4 changes: 1 addition & 3 deletions settings.gradle.kts
Expand Up @@ -73,9 +73,7 @@ if (isCiServer) {
// Cache build artifacts, so expensive operations do not need to be re-computed
buildCache {
local {
// Local build cache is dangerous as it might produce inconsistent results
// in case developer modifies files while the build is running
isEnabled = false
isEnabled = !isCiServer || System.getenv().containsKey("GITHUB_ACTIONS")
}
if (property("s3.build.cache")?.ifBlank { "true" }?.toBoolean() == true) {
val pushAllowed = property("s3.build.cache.push")?.ifBlank { "true" }?.toBoolean() ?: true
Expand Down

0 comments on commit 3802b45

Please sign in to comment.