• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: Android Release Artifacts
2
3on:
4  workflow_dispatch:
5    inputs:
6      version:
7        description: Version name to be uploaded for AAR release
8        required: false
9        type: string
10
11concurrency:
12  group: ${{ github.workflow }}-${{ github.ref }}
13  cancel-in-progress: true
14
15jobs:
16  check-if-aar-exists:
17    name: check-if-aar-exists
18    runs-on: ubuntu-22.04
19    timeout-minutes: 10
20    steps:
21      - name: Check if this RC version is already in S3
22        shell: bash
23        run: |
24          VERSION="${{ inputs.version }}"
25          if curl -I "https://ossci-android.s3.amazonaws.com/executorch/release/${VERSION}/executorch.aar" | grep "200 OK"; then
26            echo "AAR already exists at https://ossci-android.s3.amazonaws.com/executorch/release/${VERSION}/executorch.aar"
27            echo "Will skip build/upload"
28            exit 1
29          fi
30
31  build-aar:
32    name: build-aar
33    needs: check-if-aar-exists
34    uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
35    with:
36      runner: linux.2xlarge
37      docker-image: executorch-ubuntu-22.04-clang12-android
38      submodules: 'true'
39      ref: ${{ github.sha }}
40      timeout: 90
41      upload-artifact: android-apps
42      upload-artifact-to-s3: true
43      script: |
44        set -eux
45
46        # The generic Linux job chooses to use base env, not the one setup by the image
47        CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
48        conda activate "${CONDA_ENV}"
49        PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh buck2
50        export ARTIFACTS_DIR_NAME=artifacts-to-be-uploaded
51
52        # Build LLM Demo for Android
53        bash build/build_android_llm_demo.sh ${ARTIFACTS_DIR_NAME}
54
55        shasum -a 256 "${ARTIFACTS_DIR_NAME}/llm_demo/executorch.aar"
56
57  upload-release-aar:
58    name: upload-release-aar
59    needs: build-aar
60    runs-on: ubuntu-22.04
61    timeout-minutes: 10
62    permissions:
63      id-token: write
64      contents: read
65    steps:
66      - name: configure aws credentials
67        uses: aws-actions/configure-aws-credentials@v1.7.0
68        with:
69          role-to-assume: arn:aws:iam::308535385114:role/gha_executorch_upload-frameworks-android
70          aws-region: us-east-1
71      - name: Upload AAR RC to AWS S3
72        shell: bash
73        run: |
74          wget https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/llm_demo/executorch.aar
75          shasum -a 256 executorch.aar > executorch.aar.sha256sums
76
77          pip install awscli==1.32.18
78          AWS_CMD="aws s3 cp"
79          VERSION="${{ inputs.version }}"
80          VERSION_NAME="${VERSION:-temp_snapshot}"
81          ${AWS_CMD} executorch.aar s3://ossci-android/executorch/release/${VERSION_NAME}/executorch.aar --acl public-read
82          ${AWS_CMD} executorch.aar.sha256sums s3://ossci-android/executorch/release/${VERSION_NAME}/executorch.aar.sha256sums --acl public-read
83