• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: Upload AWS Device Farm Android test specs
2
3on:
4  pull_request:
5    paths:
6      - .github/workflows/upload-android-test-specs.yml
7      - extension/benchmark/android/benchmark/android-llm-device-farm-test-spec.yml
8  push:
9    branches:
10      - main
11    paths:
12      - .github/workflows/upload-android-test-specs.yml
13      - extension/benchmark/android/benchmark/android-llm-device-farm-test-spec.yml
14
15concurrency:
16  # NB: This concurency group needs to be different than the one used in android-perf, otherwise
17  # GH complains about concurrency deadlock
18  group: android-spec-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
19  cancel-in-progress: true
20
21jobs:
22  upload-android-test-spec-for-validation:
23    runs-on: linux.2xlarge
24    steps:
25      - uses: actions/checkout@v3
26
27      - name: Upload the spec as a GitHub artifact for validation
28        uses: seemethere/upload-artifact-s3@v5
29        with:
30          s3-bucket: gha-artifacts
31          s3-prefix: |
32            ${{ github.repository }}/${{ github.run_id }}/artifacts
33          retention-days: 1
34          if-no-files-found: error
35          path: extension/benchmark/android/benchmark/android-llm-device-farm-test-spec.yml
36
37  validate-android-test-spec:
38    needs: upload-android-test-spec-for-validation
39    uses: ./.github/workflows/android-perf.yml
40    permissions:
41      id-token: write
42      contents: read
43    with:
44      # Just use a small model here with a minimal amount of configuration to test the spec
45      models: stories110M
46      devices: samsung_galaxy_s22
47      delegates: xnnpack
48      test_spec: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/android-llm-device-farm-test-spec.yml
49
50  upload-android-test-spec:
51    needs: validate-android-test-spec
52    runs-on: ubuntu-22.04
53    timeout-minutes: 15
54    permissions:
55      id-token: write
56      contents: read
57    steps:
58      - uses: actions/checkout@v3
59
60      - uses: actions/setup-python@v4
61        with:
62          python-version: '3.11'
63          cache: pip
64
65      - name: configure aws credentials
66        uses: aws-actions/configure-aws-credentials@v1.7.0
67        with:
68          role-to-assume: arn:aws:iam::308535385114:role/gha_executorch_upload-frameworks-android
69          aws-region: us-east-1
70
71      - name: Only push to S3 when running the workflow manually from main branch
72        if: ${{ github.ref == 'refs/heads/main' }}
73        shell: bash
74        run: |
75          set -eux
76          echo "UPLOAD_ON_MAIN=1" >> "${GITHUB_ENV}"
77
78      - name: Upload the spec to S3 ossci-android bucket
79        shell: bash
80        working-directory: extension/benchmark/android/benchmark/
81        env:
82          SPEC_FILE: android-llm-device-farm-test-spec.yml
83        run: |
84          set -eux
85
86          pip install awscli==1.32.18
87
88          AWS_CMD="aws s3 cp --dryrun"
89          if [[ "${UPLOAD_ON_MAIN:-0}" == "1" ]]; then
90            AWS_CMD="aws s3 cp"
91          fi
92
93          shasum -a 256 "${SPEC_FILE}"
94          ${AWS_CMD} "${SPEC_FILE}" s3://ossci-android/executorch/ --acl public-read
95