Skip to content

Revert local iOS YAML to use local path (SDK auto-uploads) #15

Revert local iOS YAML to use local path (SDK auto-uploads)

Revert local iOS YAML to use local path (SDK auto-uploads) #15

name: BrowserStack SDK Tests
on:
push:
branches:
- main
- develop
- appiumMobile
pull_request:
branches:
- main
- develop
workflow_dispatch:
inputs:
platform:
description: 'Platform to test'
required: true
default: 'android'
type: choice
options:
- android
- ios
- both
tags:
description: 'Cucumber tags filter'
required: false
default: 'platform-default'
type: choice
options:
- platform-default
- '@androidOnly'
- '@iosOnly'
- '@smoke'
- '@regression'
- 'custom'
env:
JAVA_VERSION: '21'
MAVEN_OPTS: '-Xmx1024m'
jobs:
# ============================================================================
# Build & Validate
# ============================================================================
build:
name: Build & Validate
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'temurin'
cache: maven
- name: Validate & Compile
run: mvn clean compile test-compile --no-transfer-progress
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
# ============================================================================
# Android SDK Tests
# ============================================================================
test-android-sdk:
name: Android SDK Tests (BrowserStack)
runs-on: ubuntu-latest
needs: build
if: |
github.event.inputs.platform == 'android' ||
github.event.inputs.platform == 'both' ||
github.event.inputs.platform == '' ||
github.event_name != 'workflow_dispatch'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'temurin'
cache: maven
- name: Verify BrowserStack credentials
run: |
if [ -z "${{ secrets.BROWSERSTACK_USERNAME }}" ] || [ -z "${{ secrets.BROWSERSTACK_ACCESS_KEY }}" ]; then
echo "::error::BrowserStack credentials not configured. Add BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY to repository secrets."
exit 1
fi
- name: Determine Cucumber tags
id: tags
run: |
TAG_INPUT="${{ github.event.inputs.tags }}"
if [ "$TAG_INPUT" = "platform-default" ] || [ -z "$TAG_INPUT" ]; then
echo "filter=@androidOnly" >> $GITHUB_OUTPUT
elif [ "$TAG_INPUT" = "custom" ]; then
echo "filter=" >> $GITHUB_OUTPUT
else
echo "filter=$TAG_INPUT" >> $GITHUB_OUTPUT
fi
- name: Debug - Verify Configuration Files
run: |
echo "=== Configuration File Debug ==="
echo "Working Directory: $(pwd)"
echo ""
echo "=== Root Level Files ==="
ls -la browserstack-*.yml* 2>/dev/null || echo "No browserstack files in root"
echo ""
echo "=== src/test/resources/ ==="
ls -la src/test/resources/browserstack-*.yml* 2>/dev/null || echo "No files in src/test/resources"
echo ""
echo "=== target/test-classes/ ==="
ls -la target/test-classes/browserstack-*.yml* 2>/dev/null || echo "No files in target/test-classes (will exist after compilation)"
echo ""
echo "=== Full Directory Tree (first 20 lines) ==="
ls -R | head -30
- name: Run Android SDK Tests
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
run: |
mvn clean test \
-Pbrowserstack \
-Dbrowserstack.config=browserstack-android-ci.yml \
-Dplatform=android \
-Denv=browserstack \
-Dcucumber.filter.tags="${{ steps.tags.outputs.filter }}" \
--no-transfer-progress \
-q
- name: Upload Test Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: android-sdk-reports
path: |
target/extent-reports/
target/surefire-reports/
target/reports/cucumber-report/
retention-days: 30
- name: Upload Logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: android-sdk-logs
path: target/logs/
retention-days: 7
- name: Publish Test Results
if: always()
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: target/surefire-reports/TEST-*.xml
check_name: Android SDK Test Results
# ============================================================================
# iOS SDK Tests
# ============================================================================
test-ios-sdk:
name: iOS SDK Tests (BrowserStack)
runs-on: ubuntu-latest
needs: build
if: |
github.event.inputs.platform == 'ios' ||
github.event.inputs.platform == 'both' ||
github.event_name != 'workflow_dispatch'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'temurin'
cache: maven
- name: Verify BrowserStack credentials
run: |
if [ -z "${{ secrets.BROWSERSTACK_USERNAME }}" ] || [ -z "${{ secrets.BROWSERSTACK_ACCESS_KEY }}" ]; then
echo "::error::BrowserStack credentials not configured. Add BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY to repository secrets."
exit 1
fi
- name: Determine Cucumber tags
id: tags
run: |
TAG_INPUT="${{ github.event.inputs.tags }}"
if [ "$TAG_INPUT" = "platform-default" ] || [ -z "$TAG_INPUT" ]; then
echo "filter=@iosOnly" >> $GITHUB_OUTPUT
elif [ "$TAG_INPUT" = "custom" ]; then
echo "filter=" >> $GITHUB_OUTPUT
else
echo "filter=$TAG_INPUT" >> $GITHUB_OUTPUT
fi
- name: Debug - Verify Configuration Files
run: |
echo "=== Configuration File Debug (iOS) ==="
echo "Working Directory: $(pwd)"
echo ""
echo "=== Root Level Files ==="
ls -la browserstack-*.yml* 2>/dev/null || echo "No browserstack files in root"
echo ""
echo "=== src/test/resources/ ==="
ls -la src/test/resources/browserstack-*.yml* 2>/dev/null || echo "No files in src/test/resources"
echo ""
echo "=== target/test-classes/ ==="
ls -la target/test-classes/browserstack-*.yml* 2>/dev/null || echo "No files in target/test-classes (will exist after compilation)"
- name: Run iOS SDK Tests
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
run: |
mvn clean test \
-Pbrowserstack \
-Dbrowserstack.config=browserstack-ios-ci.yml \
-Dplatform=ios \
-Denv=browserstack \
-Dcucumber.filter.tags="${{ steps.tags.outputs.filter }}" \
--no-transfer-progress \
-q
- name: Upload Test Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: ios-sdk-reports
path: |
target/extent-reports/
target/surefire-reports/
target/reports/cucumber-report/
retention-days: 30
- name: Upload Logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: ios-sdk-logs
path: target/logs/
retention-days: 7
- name: Publish Test Results
if: always()
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: target/surefire-reports/TEST-*.xml
check_name: iOS SDK Test Results
# ============================================================================
# Summary Report
# ============================================================================
summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [test-android-sdk, test-ios-sdk]
if: always()
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: reports
- name: Generate Summary
run: |
echo "## 📊 Test Execution Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Workflow:** ${{ github.workflow }}" >> $GITHUB_STEP_SUMMARY
echo "**Trigger:** ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
echo "**Branch:** ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
echo "**Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Test Results" >> $GITHUB_STEP_SUMMARY
echo "- 🤖 Android SDK: ${{ needs.test-android-sdk.result }}" >> $GITHUB_STEP_SUMMARY
echo "- 🍎 iOS SDK: ${{ needs.test-ios-sdk.result }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "View detailed reports in artifacts section." >> $GITHUB_STEP_SUMMARY
- name: Check overall status
run: |
if [ "${{ needs.test-android-sdk.result }}" == "failure" ] || [ "${{ needs.test-ios-sdk.result }}" == "failure" ]; then
echo "::error::One or more test jobs failed"
exit 1
fi