add exclude to gradle #29
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: Espresso Test | |
on: | |
push: | |
branches: | |
- feature-testing-tool | |
pull_request: | |
branches: | |
- feature-testing-tool | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Cache Gradle packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Add Client ID | |
env: | |
CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
run: ./gradlew updateLocalsXmlFile | |
- name: Build APKs | |
run: | | |
./gradlew :demo:assembleDebug :demo:assembleAndroidTest | |
- name: Upload App to BrowserStack | |
env: | |
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | |
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
run: | | |
APP_APK_PATH=./demo/build/outputs/apk/debug/demo-debug.apk | |
TEST_APK_PATH=./demo/build/outputs/apk/androidTest/debug/demo-debug-androidTest.apk | |
echo "App APK path: $APP_APK_PATH" | |
echo "Test APK path: $TEST_APK_PATH" | |
if [[ -z "$APP_APK_PATH" || -z "$TEST_APK_PATH" ]]; then | |
echo "Error: APK file not found." | |
exit 1 | |
fi | |
# Upload app APK and capture response | |
APP_UPLOAD_RESPONSE=$(curl -s -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" \ | |
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/app" \ | |
-F "file=@$APP_APK_PATH") | |
echo "App upload response: $APP_UPLOAD_RESPONSE" | |
APP_URL=$(echo $APP_UPLOAD_RESPONSE | jq -r '.app_url') | |
if [[ -z "$APP_URL" ]]; then | |
echo "Error: App URL not found in response." | |
exit 1 | |
fi | |
# Upload test suite APK and capture response | |
TEST_SUITE_UPLOAD_RESPONSE=$(curl -s -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" \ | |
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/test-suite" \ | |
-F "file=@$TEST_APK_PATH") | |
echo "Test suite upload response: $TEST_SUITE_UPLOAD_RESPONSE" | |
TEST_SUITE_URL=$(echo $TEST_SUITE_UPLOAD_RESPONSE | jq -r '.test_suite_url') | |
if [[ -z "$TEST_SUITE_URL" ]]; then | |
echo "Error: Test suite URL not found in response." | |
exit 1 | |
fi | |
# Use the app_url and test_suite_url in another cURL request | |
FINAL_RESPONSE=$(curl -s -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" \ | |
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/build" \ | |
-d "{\"app\": \"$APP_URL\", \"testSuite\": \"$TEST_SUITE_URL\", \"devices\": [\"Samsung Galaxy S23-13.0\"], \"project\": \"Paypal_Messages_Android\"}" \ | |
-H "Content-Type: application/json") | |
echo "Final response: $FINAL_RESPONSE" |