-
-
Notifications
You must be signed in to change notification settings - Fork 135
123 lines (120 loc) · 4.24 KB
/
pull_request.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
on:
pull_request:
env:
NPM_TAG: "pr"
EMULATOR_NAME: "runtime-emu"
NDK_VERSION: r23c
ANDROID_API: 29
ANDROID_ABI: x86_64
NDK_ARCH: darwin-x86_64
jobs:
build:
name: Build
runs-on: macos-latest
outputs:
npm_version: ${{ steps.npm_version_output.outputs.NPM_VERSION }}
npm_tag: ${{ steps.npm_version_output.outputs.NPM_TAG }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
cache: gradle
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Homebrew dependencies
run: |
brew install wget
- name: Setup NDK
run: |
echo "y" | sdkmanager "cmake;3.6.4111459"
wget https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-darwin.zip
chmod +x android-ndk-$NDK_VERSION-darwin.zip
unzip -q android-ndk-$NDK_VERSION-darwin.zip
rm -rf android-ndk-$NDK_VERSION-darwin.zip
export ANDROID_NDK_HOME=`pwd`/android-ndk-$NDK_VERSION
echo ANDROID_NDK_HOME=${ANDROID_NDK_HOME} >> $GITHUB_ENV
echo ANDROID_NDK=${ANDROID_NDK_HOME} >> $GITHUB_ENV
echo ${ANDROID_NDK_HOME} >> $GITHUB_PATH
- name: Install Dependencies
run: |
npm install
npm install --prefix ./test-app/tools
- name: Get Current Version
run: |
NPM_VERSION=$(node -e "console.log(require('./package.json').version);")
echo NPM_VERSION=$NPM_VERSION >> $GITHUB_ENV
- name: Bump version for dev release
if: ${{ !contains(github.ref, 'refs/tags/') }}
run: |
NPM_VERSION=$(node ./scripts/get-next-version.js)
echo NPM_VERSION=$NPM_VERSION >> $GITHUB_ENV
npm version $NPM_VERSION --no-git-tag-version
- name: Output NPM Version and tag
id: npm_version_output
run: |
NPM_TAG=$(node ./scripts/get-npm-tag.js)
echo NPM_VERSION=$NPM_VERSION >> $GITHUB_OUTPUT
echo NPM_TAG=$NPM_TAG >> $GITHUB_OUTPUT
- name: Build npm package
run: ./gradlew -PgitCommitVersion=${{ github.sha }} -PnoCCache --stacktrace
- name: Upload npm package artifact
uses: actions/upload-artifact@v3
with:
name: npm-package
path: dist/nativescript-android-${{steps.npm_version_output.outputs.NPM_VERSION}}.tgz
test:
name: Test
runs-on: macos-latest
needs: build
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
cache: gradle
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Homebrew dependencies
run: |
brew install wget
- name: Setup NDK
run: |
echo "y" | sdkmanager "cmake;3.6.4111459"
wget https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-darwin.zip
chmod +x android-ndk-$NDK_VERSION-darwin.zip
unzip -q android-ndk-$NDK_VERSION-darwin.zip
rm -rf android-ndk-$NDK_VERSION-darwin.zip
export ANDROID_NDK_HOME=`pwd`/android-ndk-$NDK_VERSION
echo ANDROID_NDK_HOME=${ANDROID_NDK_HOME} >> $GITHUB_ENV
echo ANDROID_NDK=${ANDROID_NDK_HOME} >> $GITHUB_ENV
echo ${ANDROID_NDK_HOME} >> $GITHUB_PATH
- name: Install Dependencies
run: |
npm install
npm install --prefix ./test-app/tools
- name: SBG tests
run: ./gradlew runSbgTests --stacktrace
- name: Run unit tests
uses: ReactiveCircus/android-emulator-runner@v2
with:
api-level: ${{env.ANDROID_API}}
# this is needed on API 30+
#target: google_apis
arch: ${{env.ANDROID_ABI}}
script: ./gradlew runtestsAndVerifyResults --stacktrace