Skip to content

Commit

Permalink
Set up build cache
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebemish committed Nov 24, 2023
1 parent 981b5c0 commit b92c875
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 12 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,23 @@ jobs:
- uses: fregante/setup-git-user@v2
- uses: gradle/gradle-build-action@v2
name: Setup Gradle
with:
gradle-home-cache-excludes: |
caches/build-cache-1
- name: Tag Release
run: |
./gradlew tagRelease
env:
BUILD_CACHE_URL: ${{ secrets.BUILD_CACHE_URL }}
BUILD_CACHE_USER: ${{ secrets.BUILD_CACHE_USER }}
BUILD_CACHE_PASSWORD: ${{ secrets.BUILD_CACHE_PASSWORD }}
- name: Build
run: |
./gradlew build
env:
BUILD_CACHE_URL: ${{ secrets.BUILD_CACHE_URL }}
BUILD_CACHE_USER: ${{ secrets.BUILD_CACHE_USER }}
BUILD_CACHE_PASSWORD: ${{ secrets.BUILD_CACHE_PASSWORD }}
- name: Publish
run: |
./gradlew release closeAndReleaseSonatypeStagingRepository
Expand All @@ -36,6 +47,9 @@ jobs:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PLUGIN_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PLUGIN_SECRET }}
BUILD_CACHE_URL: ${{ secrets.BUILD_CACHE_URL }}
BUILD_CACHE_USER: ${{ secrets.BUILD_CACHE_USER }}
BUILD_CACHE_PASSWORD: ${{ secrets.BUILD_CACHE_PASSWORD }}
- run: |
git push
git push --tags
Expand All @@ -47,5 +61,9 @@ jobs:
:opensesame-compile
:opensesame-groovy
:opensesame-javac
:opensesame-fabric
:opensesame-plugin
gradle-build-configuration: |-
compileClasspath
compileClasspath
sub-module-mode: COMBINED
include-build-environment: true
19 changes: 9 additions & 10 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@ jobs:
- uses: fregante/setup-git-user@v2
- uses: gradle/gradle-build-action@v2
name: Setup Gradle
with:
gradle-home-cache-excludes: |
caches/build-cache-1
- name: Assemble
id: assemble
run: |
./gradlew assemble
env:
SNAPSHOT_MAVEN_URL: https://maven.lukebemish.dev/snapshots/
BUILD_CACHE_URL: ${{ secrets.BUILD_CACHE_URL }}
BUILD_CACHE_USER: ${{ secrets.BUILD_CACHE_USER }}
BUILD_CACHE_PASSWORD: ${{ secrets.BUILD_CACHE_PASSWORD }}
- name: Test
run: |
./gradlew check --continue
Expand Down Expand Up @@ -56,13 +62,6 @@ jobs:
MAVEN_USER: github
MAVEN_PASSWORD: ${{ secrets.SNAPSHOT_MAVEN_PASSWORD }}
SNAPSHOT_MAVEN_URL: https://maven.lukebemish.dev/snapshots/
- name: Submit Dependencies
uses: mikepenz/[email protected]
with:
gradle-build-module: |-
:opensesame-core
:opensesame-compile
:opensesame-groovy
:opensesame-javac
gradle-build-configuration: |-
compileClasspath
BUILD_CACHE_URL: ${{ secrets.BUILD_CACHE_URL }}
BUILD_CACHE_USER: ${{ secrets.BUILD_CACHE_USER }}
BUILD_CACHE_PASSWORD: ${{ secrets.BUILD_CACHE_PASSWORD }}
32 changes: 31 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,34 @@ subprojects.each {
project(":$it").name = "opensesame-$it"
}

include 'testtargets'
include 'testtargets'

buildCache {
if (providers.gradleProperty('buildCacheUrl').orNull) {
remote(HttpBuildCache) {
url = providers.gradleProperty('buildCacheUrl').orNull
credentials {
username = providers.gradleProperty('buildCacheUser').orNull
password = providers.gradleProperty('buildCachePassword').orNull
}
if (providers.gradleProperty('buildCachePush').orNull) {
push = true
} else {
push = false
}
}
} else if (System.getenv('BUILD_CACHE_URL')) {
remote(HttpBuildCache) {
url = System.getenv('BUILD_CACHE_URL')
credentials {
username = System.getenv('BUILD_CACHE_USER')
password = System.getenv('BUILD_CACHE_PASSWORD')
}
if (System.getenv('BUILD_CACHE_PUSH') || System.getenv('CI')) {
push = true
} else {
push = false
}
}
}
}

0 comments on commit b92c875

Please sign in to comment.