Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed May 12, 2024
1 parent 576e7de commit 23bd9aa
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 24 deletions.
57 changes: 34 additions & 23 deletions .github/actions/android-ndk/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,44 @@ name: 'Install Android SDK'
description: 'Install the android SDK'

inputs:
cargo-ndk:
description: 'Version of Cargo NDK to install'
required: false
default: '3.5.4'
android-target:
target:
description: 'Android target to activate'
required: true
android-platform:
description: 'SOMETHING'
required: false
default: '26'

runs:
using: composite
steps:
- run: find $ANDROID_NDK
shell: bash
- name: Set Up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- uses: actions/cache@v4
with:
path: ${{ runner.tool_cache }}/cargo-ndk
key: cargo-ndk-bin-${{ inputs.cargo-ndk }}
- run: echo "${{ runner.tool_cache }}/cargo-ndk/bin" >> $GITHUB_PATH
shell: bash
- run: cargo install --root ${{ runner.tool_cache }}/cargo-ndk --version ${{ inputs.cargo-ndk }} cargo-ndk --locked
shell: bash
- run: cargo ndk-env -t ${{ inputs.android-target }} --json | jq -r 'to_entries[] | [.key, .value] | @tsv' | sed 's/\t/=/' | grep -v LINKER >> $GITHUB_ENV
# - run: find $ANDROID_NDK
# shell: bash
- run: |
rust=${{ inputs.target }}
which=$ANDROID_NDK/ndk-which
upcase=$(echo $rust | awk '{ print toupper($0) }' | sed 's/-/_/g')
ndk_bin=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin
linker=$ndk_bin/${rust}${{ inputs.android-platform }}-clang
echo CARGO_TARGET_${upcase}_LINKER=$linker >> $GITHUB_ENV
echo CC_${rust}=$linker >> $GITHUB_ENV
echo RANLIB_${rust}=$ndk_bin/llvm-ranlib >> $GITHUB_ENV
echo AR_${rust}=$ndk_bin/llvm-ar >> $GITHUB_ENV
shell: bash
# - name: Set Up JDK 17
# uses: actions/setup-java@v4
# with:
# java-version: '17'
# distribution: 'temurin'
# - name: Setup Android SDK
# uses: android-actions/setup-android@v3
# - uses: actions/cache@v4
# with:
# path: ${{ runner.tool_cache }}/cargo-ndk
# key: cargo-ndk-bin-${{ inputs.cargo-ndk }}
# - run: echo "${{ runner.tool_cache }}/cargo-ndk/bin" >> $GITHUB_PATH
# shell: bash
# - run: cargo install --root ${{ runner.tool_cache }}/cargo-ndk --version ${{ inputs.cargo-ndk }} cargo-ndk --locked
# shell: bash
# - run: cargo ndk-env -t ${{ inputs.android-target }} --json | jq -r 'to_entries[] | [.key, .value] | @tsv' | sed 's/\t/=/' | grep -v LINKER >> $GITHUB_ENV
# shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ jobs:
- uses: ./.github/actions/android-ndk
if: matrix.android-target != ''
with:
android-target: ${{ matrix.android-target }}
target: ${{ matrix.target }}


- run: $CENTOS ./ci/build-release-artifacts.sh "${{ matrix.build }}" "${{ matrix.target }}"
Expand Down

0 comments on commit 23bd9aa

Please sign in to comment.