Skip to content

Commit

Permalink
Merge pull request #497 from nttld/android-sdk
Browse files Browse the repository at this point in the history
Add option to symlink to Android SDK
  • Loading branch information
raftario authored Aug 26, 2023
2 parents ec9f304 + 1fa2a05 commit a6aae87
Show file tree
Hide file tree
Showing 10 changed files with 528 additions and 39 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
ndk-version: [r21e, r25b]
ndk-version: [r21e, r25c]
local-cache: [true, false]

runs-on: ${{ matrix.os }}
Expand All @@ -37,10 +37,16 @@ jobs:
with:
ndk-version: ${{ matrix.ndk-version }}
local-cache: ${{ matrix.local-cache }}
link-to-sdk: true

- run: ndk-build --version
- run: ${{ steps.install-ndk.outputs.ndk-path }}/ndk-build --version

- run: $ANDROID_HOME/ndk/${{ steps.install-ndk.outputs.ndk-full-version }}/ndk-build --version
if: matrix.os != 'windows-latest'
- run: "& $Env:ANDROID_HOME/ndk/${{ steps.install-ndk.outputs.ndk-full-version }}/ndk-build --version"
if: matrix.os == 'windows-latest'

test-multiple:
runs-on: ubuntu-latest
strategy:
Expand All @@ -58,7 +64,7 @@ jobs:
- uses: ./
id: install-ndk-25
with:
ndk-version: r25b
ndk-version: r25c
add-to-path: false
local-cache: ${{ matrix.local-cache }}

Expand Down
29 changes: 20 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# setup-ndk

![test status](https://github.com/nttld/setup-ndk/actions/workflows/test.yml/badge.svg)

This action sets up an Android NDK environment by downloading and caching a version of the NDK and adding it to the PATH
This action sets up an Android NDK environment by downloading and caching a version of the NDK and optionally adding it to the PATH and linking it to the Android SDK.

## Usage

Expand All @@ -12,18 +10,18 @@ See [action.yml](action.yml)

```yml
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: nttld/setup-ndk@v1
with:
ndk-version: r25b
ndk-version: r25c
- runs: ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk NDK_APPLICATION_MK=./Application.mk
```
### Using the installation path
```yml
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
Expand All @@ -34,13 +32,26 @@ steps:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
```
### Caching locally
### Linking to the SDK
```yml
steps:
- uses: actions/checkout@v3
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25c
link-to-sdk: true
- run: ./gradlew build
```
### Caching locally for the workflow
```yml
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: nttld/setup-ndk@v1
with:
ndk-version: r25b
ndk-version: r21e
local-cache: true
```
14 changes: 11 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Setup Android NDK
description: Setup an Android NDK environment by downloading and optionally caching it and adding it to the PATH
author: Raphaël Thériault
branding:
icon: play
color: green

inputs:
ndk-version:
description: Exact version to use
Expand All @@ -9,16 +13,20 @@ inputs:
description: Add installation directory to the PATH
required: false
default: "true"
link-to-sdk:
description: Add installed NDK to the Android SDK
required: false
default: "false"
local-cache:
description: Use the local job cache on top of the runner tool cache
required: false
default: "false"
outputs:
ndk-path:
description: Installation path
ndk-full-version:
description: Full NDK version

runs:
using: node16
main: dist/index.js
branding:
icon: play
color: green
Loading

0 comments on commit a6aae87

Please sign in to comment.