[fix][sdk-372] Fix CI - Old Android SDK removed from Ubuntu 20.04 image runner #249
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: rollbar-java CI | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
name: Java ${{ matrix.java }} | |
strategy: | |
matrix: | |
java: [8, 11] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Fetch git tags | |
run: ./.github/fetch_to_tag.sh | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
with: | |
cmdline-tools-version: 9477386 | |
# Our build uses JDK7's rt.jar to make sure the artifact is fully | |
# compatible with Java 7, so we let this action set Java 7 up for us | |
# and we store its JAVA_HOME | |
- name: Set up Java 7 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 7 | |
- name: Capture JDK7_HOME | |
run: echo "export JDK7_HOME=\"$JAVA_HOME\"" > ~/.jdk7_home | |
- name: Set up Java 8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 8 | |
- name: Capture JDK8_HOME and set it to SDK manager | |
run: | | |
echo "export JDK8_HOME=\"$JAVA_HOME\"" > ~/.jdk8_home | |
sed -i "2i export JAVA_HOME=${JAVA_HOME}" ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager | |
- name: Set up Java 17 (needed for Spring Boot 3) | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Capture JDK17_HOME | |
run: echo "export JDK17_HOME=\"$JAVA_HOME\"" > ~/.jdk17_home | |
# This is the JDK that'll run the build | |
- name: Set up Java ${{ matrix.java }} | |
uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ matrix.java }} | |
- name: Cache Gradle packages | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ matrix.java }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle-${{ matrix.java }}- | |
- name: Environment info | |
run: | | |
java -version | |
javac -version | |
echo JAVA_HOME: ${JAVA_HOME} | |
./gradlew --version | |
echo ANDROID_SDK_ROOT: ${ANDROID_SDK_ROOT} | |
${ANDROID_SDK_ROOT}/tools/bin/sdkmanager --version | |
- name: Build | |
run: 'source ~/.jdk7_home && ./gradlew clean build' | |
- name: Check | |
run: 'source ~/.jdk7_home && ./gradlew clean check' | |
- name: Cleanup Gradle cache | |
# Recommended by https://docs.github.com/en/actions/guides/building-and-testing-java-with-gradle | |
run: | | |
rm -f ~/.gradle/caches/modules-2/modules-2.lock | |
rm -f ~/.gradle/caches/modules-2/gc.properties | |
release: | |
runs-on: ubuntu-20.04 | |
# It would be nice to run this as part of the build job, since it would be | |
# faster and have less duplicated Yaml, it would not be possible to check | |
# for all matrix results before publishing if this were just another step | |
# in that job. | |
needs: build | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Java 7 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 7 | |
- name: Capture JDK7_HOME | |
run: echo "export JDK7_HOME=\"$JAVA_HOME\"" > ~/.jdk7_home | |
- name: Set up Java 8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 8 | |
- name: Cache Gradle packages | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-8-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle-8- | |
- name: Release | |
env: | |
SECRING_GPG_IV: ${{ secrets.SECRING_GPG_IV }} | |
SECRING_GPG_KEY: ${{ secrets.SECRING_GPG_KEY }} | |
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
ENCRYPTED_GPG_KEY_LOCATION: ./.github/secring.gpg.enc | |
GPG_KEY_LOCATION: ./.github/secring.gpg | |
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} | |
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} | |
run: | | |
if test "$GITHUB_REPOSITORY" = "rollbar/rollbar-java" -a "$GITHUB_BASE_REF" = ""; then | |
openssl enc -aes-256-cbc -K "$SECRING_GPG_KEY" -iv "$SECRING_GPG_IV" -in "$ENCRYPTED_GPG_KEY_LOCATION" -out "$GPG_KEY_LOCATION" -d | |
fi && | |
source ~/.jdk7_home && | |
./.github/release.sh | |
- name: Cleanup Gradle cache | |
run: | | |
rm -f ~/.gradle/caches/modules-2/modules-2.lock | |
rm -f ~/.gradle/caches/modules-2/gc.properties |