Add check for SNAPSHOT dependencies in PRs to staging #5
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 Test | |
on: | |
push: | |
branches: | |
- 'task/**' | |
- 'bug/**' | |
- 'fix/**' | |
- 'epic/**' | |
pull_request: | |
branches: | |
- 'staging' | |
- 'epic/**' | |
jobs: | |
build_test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- 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 | |
ls /dev/kvm | |
- name: Setup Java 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Check for SNAPSHOT dependencies | |
if: github.event_name == 'pull_request' && github.base_ref == 'epic/**' | |
run: | | |
if grep -q "SNAPSHOT" build.gradle.kts lib/build.gradle.kts; then | |
echo "Error: SNAPSHOT dependencies found in build files when opening PR to staging." | |
echo "Please remove SNAPSHOT dependencies before merging to staging." | |
exit 1 | |
fi | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
- name: Accept licenses | |
run: yes | sdkmanager --licenses || true | |
- name: Setup GMD | |
run: ./gradlew :lib:pixel6Api33Setup | |
--info | |
-Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true | |
-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" | |
- name: Build lib and run instrumentation tests | |
run: ./gradlew :lib:pixel6Api33DebugAndroidTest | |
-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" | |
-Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true | |
-Pandroid.experimental.androidTest.numManagedDeviceShards=1 | |
-Pandroid.experimental.testOptions.managedDevices.maxConcurrentDevices=1 | |
-Pandroid.experimental.testOptions.managedDevices.setupTimeoutMinutes=5 | |
- name: Upload test results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
path: lib/build/outputs/androidTest-results |