• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: build android
2
3description: build android for a specific arch
4
5inputs:
6  arch:
7    description: arch to build
8    required: true
9  arch-for-build-env:
10    description: |
11      arch to pass to build environment.
12      This is currently different than the arch name we use elswhere, which
13      should be fixed.
14    required: true
15  github-secret:
16    description: github token
17    required: true
18  build-environment:
19    required: true
20    description: Top-level label for what's being built/tested.
21  docker-image:
22    required: true
23    description: Name of the base docker image to build with.
24  branch:
25    required: true
26    description: What branch we are building on.
27outputs:
28  container_id:
29    description: Docker container identifier used to build the artifacts
30    value: ${{ steps.build.outputs.container_id }}
31
32runs:
33  using: composite
34  steps:
35    - name: Build-${{ inputs.arch }}
36      id: build
37      shell: bash
38      env:
39        BRANCH: ${{ inputs.branch }}
40        BUILD_ENVIRONMENT: pytorch-linux-xenial-py3-clang5-android-ndk-r19c-${{ inputs.arch-for-build-env }}-build"
41        AWS_DEFAULT_REGION: us-east-1
42        PR_NUMBER: ${{ github.event.pull_request.number }}
43        SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
44        SCCACHE_BUCKET: ossci-compiler-cache-circleci-v2
45        DOCKER_IMAGE: ${{ inputs.docker-image  }}
46        MATRIX_ARCH: ${{ inputs.arch }}
47      run: |
48        # detached container should get cleaned up by teardown_ec2_linux
49        set -exo pipefail
50        export container_name
51        container_name=$(docker run \
52          -e BUILD_ENVIRONMENT \
53          -e MAX_JOBS="$(nproc --ignore=2)" \
54          -e AWS_DEFAULT_REGION \
55          -e PR_NUMBER \
56          -e SHA1 \
57          -e BRANCH \
58          -e SCCACHE_BUCKET \
59          -e SKIP_SCCACHE_INITIALIZATION=1 \
60          --env-file="/tmp/github_env_${GITHUB_RUN_ID}" \
61          --security-opt seccomp=unconfined \
62          --cap-add=SYS_PTRACE \
63          --tty \
64          --detach \
65          --user jenkins \
66          -w /var/lib/jenkins/workspace \
67          "${DOCKER_IMAGE}"
68        )
69        git submodule sync && git submodule update -q --init --recursive --depth 1
70        docker cp "${GITHUB_WORKSPACE}/." "${container_name}:/var/lib/jenkins/workspace"
71        (echo "sudo chown -R jenkins . && .ci/pytorch/build.sh && find ${BUILD_ROOT} -type f -name "*.a" -or -name "*.o" -delete" | docker exec -u jenkins -i "${container_name}" bash) 2>&1
72
73        # Copy install binaries back
74        mkdir -p "${GITHUB_WORKSPACE}/build_android_install_${MATRIX_ARCH}"
75        docker cp "${container_name}:/var/lib/jenkins/workspace/build_android/install" "${GITHUB_WORKSPACE}/build_android_install_${MATRIX_ARCH}"
76        echo "container_id=${container_name}" >> "${GITHUB_OUTPUT}"
77