Skip to content

Fix/bump http android pckages #4788

Fix/bump http android pckages

Fix/bump http android pckages #4788

name: test android emulator
on:
workflow_dispatch:
schedule:
# run this workflow every 12 hours
- cron: "0 */12 * * *"
pull_request_target:
types: [opened, synchronize]
paths:
- 'packages/patrol/**'
- 'packages/patrol_finders/**'
- 'packages/patrol_log/**'
- 'packages/patrol_cli/**'
- 'packages/adb/**'
- 'packages/patrol_gen/**'
- 'dev/e2e_app/**'
- 'schema.dart'
- 'gen_from_schema'
- '!**.md'
- '!**.mdx'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
run_tests:
name: Flutter ${{ matrix.flutter-version }} on API ${{ matrix.api-level }}
runs-on: ubuntu-latest
timeout-minutes: 55
outputs:
SLACK_MESSAGE_TITLE: Flutter ${{ matrix.flutter-version }} on API ${{ matrix.api-level }}
TESTS_EXIT_CODE: ${{ steps.tests_step.outputs.TESTS_EXIT_CODE }}
URL_TO_DETAILS: ${{ steps.tests_step.outputs.URL_TO_DETAILS }}
strategy:
fail-fast: false
matrix:
flutter-version: ["3.38.x"]
flutter-channel: ["stable"]
api-level: [36, 35, 34, 33, 32]
defaults:
run:
working-directory: dev/e2e_app
steps:
- name: Get User Permission
id: checkAccess
uses: actions-cool/check-user-permission@v2
with:
require: write
username: ${{ github.triggering_actor }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check User Permission
if: steps.checkAccess.outputs.require-result == 'false'
run: |
echo "${{ github.triggering_actor }} does not have permissions on this repo."
echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}"
echo "Job originally triggered by ${{ github.actor }}"
exit 1
- name: Clone repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Gradle cache
uses: gradle/gradle-build-action@v2
with:
generate-job-summary: false
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}
- name: Preload Flutter artifacts
run: flutter precache --android
- name: Set up Melos and activate workspace
working-directory: .
run: |
dart pub global activate melos
melos bootstrap
- name: Set up Patrol CLI
working-directory: packages/patrol_cli
run: dart pub global activate --source path . && patrol
- name: Generate Gradle wrapper
env:
MAPS_API_KEY: ${{ secrets.MAPS_API_KEY }}
run: flutter build apk --config-only
- name: Install ew-cli
run: |
mkdir -p "$HOME/bin"
curl "https://maven.emulator.wtf/releases/ew-cli" -o "$HOME/bin/ew-cli"
chmod a+x "$HOME/bin/ew-cli"
echo "$HOME/bin" >> $GITHUB_PATH
echo "EW_API_TOKEN=${{ secrets.EW_API_TOKEN }}" >> $GITHUB_ENV
- name: patrol build android
env:
MAPS_API_KEY: ${{ secrets.MAPS_API_KEY }}
run: |
patrol build android \
--tags='android && emulator' \
--exclude patrol_test/web/,patrol_test/native_tests/volume_test.dart,patrol_test/volume_test.dart \
--dart-define-from-file=defines_1.json --dart-define-from-file=defines_2.json --dart-define-from-file=defines_3.env \
--verbose
- name: Upload APKs to emulator.wtf and wait for tests to finish
id: tests_step
run: |
set +e
output="$(ew-cli emulatorwtf.yaml:multi_api \
--device model=Pixel7,version=${{ matrix.api-level }} \
--display-name "Patrol example app API ${{ matrix.api-level }} (${GITHUB_SHA::7})")"
TESTS_EXIT_CODE=$?
set -e
# Extract the results URL and write it to Github Summary
link="$(echo "$output" | jq -r ".resultsUrl")"
echo "[Test details on emulator.wtf]($link) (LeanCode members only)" >> "$GITHUB_STEP_SUMMARY"
echo "URL_TO_DETAILS=$link" >> "$GITHUB_OUTPUT"
echo "TESTS_EXIT_CODE=$TESTS_EXIT_CODE" >> "$GITHUB_OUTPUT"
exit $TESTS_EXIT_CODE
call_send_slack_message:
name: Notify on Slack
uses: ./.github/workflows/send-slack-message.yaml
needs: run_tests
if: always()
with:
TESTS_EXIT_CODE: ${{ needs.run_tests.outputs.TESTS_EXIT_CODE }}
SLACK_MESSAGE_TITLE: ${{ needs.run_tests.outputs.SLACK_MESSAGE_TITLE }}
URL_TO_DETAILS: ${{ needs.run_tests.outputs.URL_TO_DETAILS }}
secrets: inherit