Native JNI S3 PyTorch Android #410
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Native JNI S3 PyTorch Android | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 6 * * *' | |
jobs: | |
build-pytorch-jni-android: | |
runs-on: ubuntu-latest | |
env: | |
NDK_VERSION: "21.1.6352462" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'corretto' | |
java-version: 11 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Install NDK | |
run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;${NDK_VERSION}" | |
- name: build android | |
run: | | |
export ANDROID_NDK=${ANDROID_SDK_ROOT}/ndk/${NDK_VERSION} | |
PYTORCH_VERSION=${PYTORCH_VERSION:-$(cat gradle.properties | awk -F '=' '/pytorch_version/ {print $2}')} | |
./gradlew :engines:pytorch:pytorch-native:compileAndroidJNI -Ppt_version=${PYTORCH_VERSION} | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-2 | |
- name: Copy files to S3 with the AWS CLI | |
run: | | |
PYTORCH_VERSION=${PYTORCH_VERSION:-$(cat gradle.properties | awk -F '=' '/pytorch_version/ {print $2}')} | |
aws s3 sync engines/pytorch/pytorch-native/jnilib s3://djl-ai/publish/pytorch/${PYTORCH_VERSION}/jnilib | |
aws cloudfront create-invalidation --distribution-id E371VB8JQ6NRVY --paths "/pytorch/${PYTORCH_VERSION}/jnilib*" |