|
| 1 | +name: SDK metrics |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths: |
| 6 | + - .github/workflows/metrics.yml |
| 7 | + - dart/** |
| 8 | + - flutter/** |
| 9 | + - metrics/** |
| 10 | + - "!**/*.md" |
| 11 | + branches-ignore: |
| 12 | + - deps/** |
| 13 | + - dependabot/** |
| 14 | + tags-ignore: ["**"] |
| 15 | + |
| 16 | +jobs: |
| 17 | + cancel-previous-workflow: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Cancel Previous Runs |
| 21 | + uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # [email protected] |
| 22 | + with: |
| 23 | + access_token: ${{ github.token }} |
| 24 | + |
| 25 | + metrics: |
| 26 | + name: ${{ matrix.name }} |
| 27 | + runs-on: ${{ matrix.host }} |
| 28 | + timeout-minutes: 30 |
| 29 | + strategy: |
| 30 | + # We want that the matrix keeps running, default is to cancel all jobs if a single fails. |
| 31 | + fail-fast: false |
| 32 | + matrix: |
| 33 | + include: |
| 34 | + - platform: ios |
| 35 | + name: iOS |
| 36 | + appPlain: test-app-plain.ipa |
| 37 | + host: macos-latest |
| 38 | + - platform: android |
| 39 | + name: Android |
| 40 | + appPlain: metrics/perf-test-app-plain/build/app/outputs/apk/release/app-arm64-v8a-release.apk |
| 41 | + host: ubuntu-latest |
| 42 | + |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v4 |
| 45 | + |
| 46 | + # Let's stick to an explicit version and update manually because a version change may affect results. |
| 47 | + # If it would update implicitly it could confuse people to think the change is actually caused by the PR. |
| 48 | + # Instead, we use Updater (update-deps.yml) to create PRs for explicit Flutter SDK update. |
| 49 | + - name: Read configured Flutter SDK version |
| 50 | + id: conf |
| 51 | + run: | |
| 52 | + version=$(grep "version" metrics/flutter.properties | cut -d'=' -f2 | xargs) |
| 53 | + echo "flutter=$version" >> "$GITHUB_OUTPUT" |
| 54 | +
|
| 55 | + - name: Install Flutter v${{ steps.conf.outputs.flutter }} |
| 56 | + uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff # [email protected] |
| 57 | + with: |
| 58 | + flutter-version: ${{ steps.conf.outputs.flutter }} |
| 59 | + |
| 60 | + - uses: actions/setup-java@v4 |
| 61 | + if: ${{ matrix.platform == 'android' }} |
| 62 | + with: |
| 63 | + java-version: "17" |
| 64 | + distribution: "adopt" |
| 65 | + |
| 66 | + - run: ./metrics/prepare.sh |
| 67 | + |
| 68 | + - uses: actions/cache@v4 |
| 69 | + id: app-plain-cache |
| 70 | + with: |
| 71 | + path: ${{ matrix.appPlain }} |
| 72 | + key: ${{ github.workflow }}-${{ github.job }}-appplain-${{ matrix.platform }}-${{ hashFiles('metrics/perf-test-app-plain/pubspec.yaml') }} |
| 73 | + |
| 74 | + - name: Build |
| 75 | + run: ./metrics/build.sh ${{ matrix.platform }} |
| 76 | + env: |
| 77 | + # Necessary to build an iOS .ipa (using fastlane) |
| 78 | + APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }} |
| 79 | + APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} |
| 80 | + APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }} |
| 81 | + FASTLANE_KEYCHAIN_PASSWORD: ${{ secrets.FASTLANE_KEYCHAIN_PASSWORD }} |
| 82 | + MATCH_GIT_PRIVATE_KEY: ${{ secrets.MATCH_GIT_PRIVATE_KEY }} |
| 83 | + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} |
| 84 | + MATCH_USERNAME: ${{ secrets.MATCH_USERNAME }} |
| 85 | + APP_PLAIN: ${{ matrix.appPlain }} |
| 86 | + |
| 87 | + - name: Collect apps metrics |
| 88 | + uses: getsentry/action-app-sdk-overhead-metrics@v1 |
| 89 | + with: |
| 90 | + name: ${{ matrix.name }} |
| 91 | + config: ./metrics/metrics-${{ matrix.platform }}.yml |
| 92 | + sauce-user: ${{ secrets.SAUCE_USERNAME }} |
| 93 | + sauce-key: ${{ secrets.SAUCE_ACCESS_KEY }} |
0 commit comments