Add Kokoro build config #1080
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: Build | |
on: | |
push: | |
branches: | |
- main | |
- 'axt_**_release_branch' | |
pull_request: | |
branches: | |
- main | |
- 'axt_**_release_branch' | |
env: | |
cache-version: v1 | |
jobs: | |
build: | |
runs-on: | |
group: Large Runners | |
timeout-minutes: 20 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Install Java 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- name: 'Cache Bazel files' | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/bazel | |
key: ${{ runner.os }}-${{ env.cache-version }}-bazel-build-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-${{ env.cache-version }}-bazel-build- | |
- name: Build maven artifacts | |
run: bazelisk build //:axt_m2repository | |
shell: bash | |
- name: cp to upload dir | |
run: | | |
mkdir -p ~/download | |
cp bazel-bin/axt_m2repository.zip ~/download | |
shell: bash | |
- name: 'Upload local snapshot for tests' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: local-snapshot | |
path: ~/download | |
- name: 'Clean bazel cache' | |
# Don't cache the bazel/external directory, since it can be > 2GB | |
# and is expensive to restore and save | |
# According to the documentation, we should be able to exclude these via | |
# the actions/cache path, e.g. "!~/.cache/bazel/*/*/external/" but that | |
# doesn't seem to work. | |
run: | | |
rm -rf $(bazel info repository_cache) | |
rm -rf ~/.cache/bazel/*/*/external/ | |
shell: bash | |
test: | |
runs-on: | |
group: Large Runners | |
timeout-minutes: 20 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Install Java 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- name: 'Cache Bazel files' | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/bazel | |
key: ${{ runner.os }}-${{ env.cache-version }}-bazel-test-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-${{ env.cache-version }}-bazel-test- | |
- name: Run Robolectric tests | |
run: bazelisk test --test_tag_filters=robolectric --build_tag_filters=robolectric --test_output=all ... | |
shell: bash | |
- name: 'Clean bazel cache' | |
# Don't cache the bazel/external directory, since it can be > 2GB | |
# and is expensive to restore and save | |
# According to the documentation, we should be able to exclude these via | |
# the actions/cache path, e.g. "!~/.cache/bazel/*/*/external/" but that | |
# doesn't seem to work. | |
run: | | |
rm -rf $(bazel info repository_cache) | |
rm -rf ~/.cache/bazel/*/*/external/ | |
shell: bash | |
gradle-emulator-test: | |
runs-on: | |
group: Large Runners | |
needs: build | |
timeout-minutes: 20 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Install Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Enable KVM group perms | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: 'Cache Gradle files' | |
uses: gradle/gradle-build-action@v2 | |
- name: 'Download local snapshot for tests' | |
uses: actions/download-artifact@v3 | |
with: | |
name: local-snapshot | |
path: ~/download | |
- name: 'Install to local maven repo' | |
run: | | |
mkdir -p ~/.m2 | |
unzip ~/download/axt_m2repository.zip -d ~/.m2/ | |
shell: bash | |
- name: 'Setup Android SDK' | |
uses: android-actions/setup-android@v2 | |
- name: 'Run gradle tests' | |
run: | | |
cd ${{ github.workspace }}/gradle-tests | |
./gradlew nexusOneApi30DebugAndroidTest -Dorg.gradle.workers.max=1 -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true --info | |
shell: bash | |
- name: 'Upload test reports' | |
if: success() || failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-reports | |
path: gradle-tests/**/build/reports/androidTests/ | |
gradle-emulator-test_mac: | |
runs-on: macos-latest | |
needs: build | |
timeout-minutes: 20 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Install Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: 'Cache Gradle files' | |
uses: gradle/gradle-build-action@v2 | |
- name: 'Download local snapshot for tests' | |
uses: actions/download-artifact@v3 | |
with: | |
name: local-snapshot | |
path: ~/download | |
- name: 'Install to local maven repo' | |
run: | | |
mkdir -p ~/.m2 | |
unzip ~/download/axt_m2repository.zip -d ~/.m2/ | |
shell: bash | |
- name: 'Setup Android SDK' | |
uses: android-actions/setup-android@v2 | |
- name: 'Run gradle tests' | |
run: | | |
cd ${{ github.workspace }}/gradle-tests | |
./gradlew nexusOneApi30DebugAndroidTest -Dorg.gradle.workers.max=1 -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true --info | |
shell: bash | |
- name: 'Upload test reports' | |
if: success() || failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-reports | |
path: gradle-tests/**/build/reports/androidTests/ | |