[build,ci] Enable artifactory build cache (#4200)

This commit is contained in:
Austin Shalit
2022-04-30 20:27:23 -07:00
committed by GitHub
parent 63cf3aaa3f
commit 03230fc842
3 changed files with 45 additions and 3 deletions

View File

@@ -35,7 +35,10 @@ jobs:
run: echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v')
- name: Build with Gradle
run: ./gradlew build -PbuildServer -PskipJavaFormat ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }}
run: ./gradlew build --build-cache -PbuildServer -PskipJavaFormat ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }}
env:
ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact-name }}
@@ -83,7 +86,10 @@ jobs:
shell: bash
if: startsWith(github.ref, 'refs/tags/v')
- name: Build with Gradle
run: ./gradlew build -PbuildServer -PskipJavaFormat ${{ env.EXTRA_GRADLE_ARGS }}
run: ./gradlew build --build-cache -PbuildServer -PskipJavaFormat ${{ env.EXTRA_GRADLE_ARGS }}
env:
ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- name: Sign Libraries with Developer ID
run: ./gradlew build -PbuildServer -PskipJavaFormat -PdeveloperID=${{ secrets.APPLE_DEVELOPER_ID }} ${{ env.EXTRA_GRADLE_ARGS }}
if: |
@@ -110,7 +116,10 @@ jobs:
run: echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v')
- name: Build with Gradle
run: ./gradlew docs:zipDocs -PbuildServer ${{ env.EXTRA_GRADLE_ARGS }}
run: ./gradlew docs:zipDocs --build-cache -PbuildServer ${{ env.EXTRA_GRADLE_ARGS }}
env:
ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- uses: actions/upload-artifact@v2
with:
name: Documentation

View File

@@ -83,6 +83,14 @@ If opening from a fresh clone, generated java dependencies will not exist. Most
`./gradlew buildDesktopCpp` and `./gradlew buildDesktopJava` will compile `wpilibcExamples` and `wpilibjExamples` respectively. The results can't be ran, but they can compile.
### Build Cache
Run with `--build-cache` on the command-line to use the shared [build cache](https://docs.gradle.org/current/userguide/build_cache.html) artifacts generated by the continuous integration server. Example:
```bash
./gradlew build --build-cache
```
### Using Development Builds
Please read the documentation available [here](OtherVersions.md)

View File

@@ -49,3 +49,28 @@ include 'wpilibNewCommands'
include 'myRobot'
include 'docs'
include 'msvcruntime'
buildCache {
def cred = {
if (System.env[it] != null) {
return System.env[it]
} else {
return System.getProperty(it)
}
}
local {
enabled = !System.getenv().containsKey("CI")
}
remote(HttpBuildCache) {
url = "https://frcmaven.wpi.edu/artifactory/wpilib-generic-gradle-cache/"
String user = cred('ARTIFACTORY_PUBLISH_USERNAME')
String pass = cred('ARTIFACTORY_PUBLISH_PASSWORD')
if (user && pass) {
push = true
credentials {
username = user
password = pass
}
}
}
}