From d2df9cc1ec54e2d7350af442d3b2bc61bf03d7f9 Mon Sep 17 00:00:00 2001 From: Mike Hardy Date: Sun, 29 Nov 2020 16:11:11 -0500 Subject: [PATCH] chore(CI): device log artifacts, soft-fail retries, bump deps - emulator and simulator logging is captured and uploaded as workflow artifact - all soft-fails (e.g., steps susceptible to transient network errors) are retried - cancel action can work inside a workflow run vs as a separate step - bump checkout version --- .github/workflows/firebase_remote_config.yaml | 4 +- .github/workflows/firebase_storage.yaml | 102 +++++++++++++++--- .github/workflows/pr_title.yaml | 2 +- .github/workflows/scripts/drive-example.sh | 10 +- 4 files changed, 97 insertions(+), 21 deletions(-) diff --git a/.github/workflows/firebase_remote_config.yaml b/.github/workflows/firebase_remote_config.yaml index 9434900d41bf..bd9a36419f52 100644 --- a/.github/workflows/firebase_remote_config.yaml +++ b/.github/workflows/firebase_remote_config.yaml @@ -21,7 +21,7 @@ jobs: runs-on: macos-latest timeout-minutes: 30 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 with: fetch-depth: 0 - name: "Install Flutter" @@ -43,7 +43,7 @@ jobs: runs-on: macos-latest timeout-minutes: 35 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 with: fetch-depth: 0 - name: "Install Flutter" diff --git a/.github/workflows/firebase_storage.yaml b/.github/workflows/firebase_storage.yaml index 82e0dce5d958..4f408c2f4515 100644 --- a/.github/workflows/firebase_storage.yaml +++ b/.github/workflows/firebase_storage.yaml @@ -10,6 +10,7 @@ on: - master paths-ignore: - "docs/**" + - "**/*.md" env: FLUTTERFIRE_PLUGIN_SCOPE: "*firebase_storage*" @@ -21,15 +22,33 @@ jobs: runs-on: macos-latest timeout-minutes: 30 steps: - - uses: actions/checkout@v1 + - uses: styfle/cancel-workflow-action@0.6.0 + with: + access_token: ${{ github.token }} + - uses: actions/checkout@v2 with: fetch-depth: 0 - name: "Install Flutter" - run: ./.github/workflows/scripts/install-flutter.sh dev + uses: nick-invision/retry@v2 + with: + timeout_minutes: 10 + retry_wait_seconds: 60 + max_attempts: 3 + command: ./.github/workflows/scripts/install-flutter.sh dev - name: "Install Tools" - run: ./.github/workflows/scripts/install-tools.sh + uses: nick-invision/retry@v2 + with: + timeout_minutes: 10 + retry_wait_seconds: 60 + max_attempts: 3 + command: ./.github/workflows/scripts/install-tools.sh - name: "Build Example" - run: ./.github/workflows/scripts/build-example.sh android + uses: nick-invision/retry@v2 + with: + timeout_minutes: 10 + retry_wait_seconds: 60 + max_attempts: 3 + command: ./.github/workflows/scripts/build-example.sh android - name: "Drive Example" uses: reactivecircus/android-emulator-runner@v2 with: @@ -40,26 +59,66 @@ jobs: target: default profile: Nexus 5X script: ./.github/workflows/scripts/drive-example.sh android + - name: Compress Emulator Log + if: always() + run: gzip -9 adb-log.txt + shell: bash + - name: Upload Emulator Log + uses: actions/upload-artifact@v2 + if: always() + with: + name: adb_logs + path: adb-log.txt.gz apple: runs-on: macos-latest timeout-minutes: 35 steps: - - uses: actions/checkout@v1 + - uses: styfle/cancel-workflow-action@0.6.0 + with: + access_token: ${{ github.token }} + - uses: actions/checkout@v2 with: fetch-depth: 0 - name: "Install Flutter" - run: ./.github/workflows/scripts/install-flutter.sh dev + uses: nick-invision/retry@v2 + with: + timeout_minutes: 10 + retry_wait_seconds: 60 + max_attempts: 3 + command: ./.github/workflows/scripts/install-flutter.sh dev - name: "Install Tools" - run: | - ./.github/workflows/scripts/install-tools.sh - flutter config --enable-macos-desktop + uses: nick-invision/retry@v2 + with: + timeout_minutes: 10 + retry_wait_seconds: 60 + max_attempts: 3 + command: ./.github/workflows/scripts/install-tools.sh && flutter config --enable-macos-desktop - name: "Build iOS Example" - run: ./.github/workflows/scripts/build-example.sh ios + uses: nick-invision/retry@v2 + with: + timeout_minutes: 10 + retry_wait_seconds: 60 + max_attempts: 3 + command: ./.github/workflows/scripts/build-example.sh ios - name: "Drive iOS Example" run: ./.github/workflows/scripts/drive-example.sh ios + - name: Compress Simulator Log + if: always() + run: gzip -9 simulator.log + - name: Upload Simulator Log + uses: actions/upload-artifact@v2 + if: always() + with: + name: simulator_logs + path: simulator.log.gz - name: "Build MacOS Example" - run: ./.github/workflows/scripts/build-example.sh macos + uses: nick-invision/retry@v2 + with: + timeout_minutes: 10 + retry_wait_seconds: 60 + max_attempts: 3 + command: ./.github/workflows/scripts/build-example.sh macos - name: "Drive MacOS Example" run: ./.github/workflows/scripts/drive-example.sh macos @@ -67,14 +126,25 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 15 steps: - - uses: actions/checkout@v1 + - uses: styfle/cancel-workflow-action@0.6.0 + with: + access_token: ${{ github.token }} + - uses: actions/checkout@v2 with: fetch-depth: 0 - name: "Install Flutter" - run: ./.github/workflows/scripts/install-flutter.sh beta + uses: nick-invision/retry@v2 + with: + timeout_minutes: 10 + retry_wait_seconds: 60 + max_attempts: 3 + command: ./.github/workflows/scripts/install-flutter.sh beta - name: "Install Tools" - run: | - ./.github/workflows/scripts/install-tools.sh - flutter config --enable-web + uses: nick-invision/retry@v2 + with: + timeout_minutes: 10 + retry_wait_seconds: 60 + max_attempts: 3 + command: ./.github/workflows/scripts/install-tools.sh && flutter config --enable-web - name: "Drive Example" run: ./.github/workflows/scripts/drive-example.sh web diff --git a/.github/workflows/pr_title.yaml b/.github/workflows/pr_title.yaml index e3e8135acd6b..4ba4fd9ca693 100644 --- a/.github/workflows/pr_title.yaml +++ b/.github/workflows/pr_title.yaml @@ -11,6 +11,6 @@ jobs: validate: runs-on: ubuntu-latest steps: - - uses: amannn/action-semantic-pull-request@v1.2.0 + - uses: amannn/action-semantic-pull-request@v2.1.0 env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/scripts/drive-example.sh b/.github/workflows/scripts/drive-example.sh index 48d693c04aac..51d043312267 100755 --- a/.github/workflows/scripts/drive-example.sh +++ b/.github/workflows/scripts/drive-example.sh @@ -6,6 +6,10 @@ if [ "$ACTION" == "android" ] then # Sleep to allow emulator to settle. sleep 15 + + # Create an emulator log for troubleshooting, will be uploaded as an artifact + nohup sh -c "$ANDROID_HOME/platform-tools/adb logcat '*:D' > adb-log.txt" & + melos exec -c 1 --fail-fast --scope="$FLUTTERFIRE_PLUGIN_SCOPE_EXAMPLE" --dir-exists=test_driver -- \ flutter drive --no-pub --target=./test_driver/MELOS_PARENT_PACKAGE_NAME_e2e.dart --dart-define=CI=true exit @@ -19,8 +23,10 @@ then xcrun simctl logverbose "$SIMULATOR" enable # Sleep to allow simulator to settle. sleep 15 - # Uncomment following line to have simulator logs printed out for debugging purposes. - # xcrun simctl spawn booted log stream --predicate 'eventMessage contains "flutter"' & + + # Create a simulator log for troubleshooting, will be uploaded as an artifact + nohup sh -c "sleep 30 && xcrun simctl spawn booted log stream --level debug --style compact > simulator.log 2>&1 &" + melos exec -c 1 --fail-fast --scope="$FLUTTERFIRE_PLUGIN_SCOPE_EXAMPLE" --dir-exists=test_driver -- \ flutter drive -d \"$SIMULATOR\" --no-pub --target=./test_driver/MELOS_PARENT_PACKAGE_NAME_e2e.dart --dart-define=CI=true MELOS_EXIT_CODE=$?