Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
skwasjer committed Jan 1, 2022
2 parents 0b75d41 + 5d73c4e commit b279a03
Show file tree
Hide file tree
Showing 17 changed files with 4,261 additions and 183 deletions.
17 changes: 9 additions & 8 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ end_of_line = crlf
insert_final_newline = true

[*.{js,java}]
indent_style = tab
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
trim_trailing_whitespace = false

[*.{xml,json}]
[*.{xml,json,yml,yaml}]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
trim_trailing_whitespace = false

[plugin.xml]
end_of_line = lf
indent_size = 4

[*.json]
end_of_line = lf
trim_trailing_whitespace = true

[*.{h,m}]
indent_style = space
indent_size = 4
Expand Down
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.github/
docs/
coverage/
node_modules/
sample/
30 changes: 30 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
root: true
extends:
- "@cordova/eslint-config/node"

plugins:
- es

parserOptions:
ecmaFeatures:
impliedStrict: true

overrides:
- files:
- tests/specs/**/*.js
extends:
- "@cordova/eslint-config/node-tests"
rules:
quotes: ["error", "double"]

- files:
- www/**/*.js
extends:
# ES5
- "plugin:es/no-new-in-es2015"
- "@cordova/eslint-config/browser"
rules:
quotes: ["error", "double"]

rules:
quotes: ["error", "double"]
277 changes: 277 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
name: Node CI

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'

jobs:
darwin:
name: NodeJS ${{ matrix.node-version }} on ${{ matrix.os }}, cordova@${{ matrix.cordova.v }}, cordova-ios@${{ matrix.cordova.ios.v }}, cordova-android@${{ matrix.cordova.android.v }} (Min SDK ${{ matrix.cordova.android.minSdk }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version:
- 10.x
- 14.x
os:
- macos-latest
cordova:
- v: '8.0.0'
ios:
v: '5.1.1'
android:
v: '7.1.4'
minSdk: 19
- v: '9.0.0'
ios:
v: '6.2.0'
android:
v: '9.0.0'
minSdk: 22
- v: '10.0.0'
ios:
v: '6.2.0'
android:
v: '10.0.0'
minSdk: 22
exclude:
# NodeJS 10 deprecated in cordova-android@10
- node-version: 10.x
cordova:
android:
v: '10.0.0'

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache npm
uses: actions/cache@v2
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: npm install and test
run: npm cit
env:
CI: true

- name: Install XCode latest-stable
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Install Java 8
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 8

- name: npm install cordova@${{ matrix.cordova.v }}
run: npm install cordova@${{ matrix.cordova.v }} -g

- name: Cache .gradle
uses: burrunan/gradle-cache-action@v1
with:
job-id: jdk8
gradle-version: wrapper

- name: Checkout clean plugin
uses: actions/checkout@v2
with:
path: plugin

- name: cordova create
run: cordova create testApp com.skwas.testApp testApp

- name: Minimum Android SDK ${{ matrix.cordova.android.minSdk }}
run: npm run cordova-preference -- ./testApp android-minSdkVersion ${{ matrix.cordova.android.minSdk }}

# cordova-android@8 requires shim to enable AndroidX.
- name: Enable AndroidX via shim 'cordova-plugin-androidx'
if: matrix.cordova.android.v == '8.0.0'
working-directory: ./testApp
run: cordova plugin add cordova-plugin-androidx

# cordova-android@9 requires opt-in to AndroidX via config preference.
- name: Enable AndroidX
if: matrix.cordova.android.v == '9.0.0'
run: |
npm run cordova-preference -- ./testApp AndroidXEnabled true
- name: cordova plugin add
working-directory: ./testApp
run: cordova plugin add ${{ github.workspace }}/plugin

- name: cordova platform add android@${{ matrix.cordova.android.v }}
working-directory: ./testApp
run: cordova platform add android@${{ matrix.cordova.android.v }}

# Android SDK Build tools throws error: Build-tool 32.0.0 is missing DX
# https://stackoverflow.com/questions/68397703/installed-build-tools-revision-31-0-0-is-corrupted-remove-and-install-again-usi
- name: Patch Build Tools
if: matrix.cordova.android.v != '8.0.0'
run: |
cd $ANDROID_SDK_ROOT/build-tools/32.0.0
mv d8 dx
cd lib
mv d8.jar dx.jar
- name: cordova platform add ios@${{ matrix.cordova.ios.v }}
working-directory: ./testApp
run: cordova platform add ios@${{ matrix.cordova.ios.v }}

- name: cordova build
working-directory: ./testApp
run: cordova build --no-telemetry

non-darwin:
name: NodeJS ${{ matrix.node-version }} on ${{ matrix.os }}, cordova@${{ matrix.cordova.v }}, cordova-android@${{ matrix.cordova.android.v }} (Min SDK ${{ matrix.cordova.android.minSdk }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version:
- 10.x
- 14.x
os:
- ubuntu-latest
- windows-latest
cordova:
- v: '8.0.0'
android:
v: '7.1.4'
minSdk: 19
- v: '9.0.0'
android:
v: '8.0.0'
minSdk: 19
- v: '9.0.0'
android:
v: '9.0.0'
minSdk: 22
- v: '9.0.0'
android:
v: '10.0.0'
minSdk: 22
- v: '10.0.0'
android:
v: '10.0.0'
minSdk: 22
exclude:
# NodeJS 10 deprecated in cordova-android@10
- node-version: 10.x
cordova:
android:
v: '10.0.0'

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache npm
uses: actions/cache@v2
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: npm install and test
run: npm cit
env:
CI: true

- name: Install Java 8
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 8

- name: npm install cordova@${{ matrix.cordova.v }}
run: npm install cordova@${{ matrix.cordova.v }} -g

- name: Cache .gradle
uses: burrunan/gradle-cache-action@v1
with:
job-id: jdk8
gradle-version: wrapper

- name: Checkout clean plugin
uses: actions/checkout@v2
with:
path: plugin

- name: cordova create
run: cordova create testApp com.skwas.testApp testApp

- name: Minimum Android SDK ${{ matrix.cordova.android.minSdk }}
run: npm run cordova-preference -- ./testApp android-minSdkVersion ${{ matrix.cordova.android.minSdk }}

# cordova-android@8 requires shim to enable AndroidX.
- name: Enable AndroidX via shim 'cordova-plugin-androidx'
if: matrix.cordova.android.v == '8.0.0'
working-directory: ./testApp
run: cordova plugin add cordova-plugin-androidx

# cordova-android@9 requires opt-in to AndroidX via config preference.
- name: Enable AndroidX
if: matrix.cordova.android.v == '9.0.0'
run: |
npm run cordova-preference -- ./testApp AndroidXEnabled true
- name: cordova plugin add
working-directory: ./testApp
run: cordova plugin add ${{ github.workspace }}/plugin

- name: cordova platform add android@${{ matrix.cordova.android.v }}
working-directory: ./testApp
run: cordova platform add android@${{ matrix.cordova.android.v }}

# Android SDK Build tools throws error: Build-tool 32.0.0 is missing DX
# https://stackoverflow.com/questions/68397703/installed-build-tools-revision-31-0-0-is-corrupted-remove-and-install-again-usi
- name: Patch Build Tools (Linux)
if: (matrix.cordova.android.v == '9.0.0' || matrix.cordova.android.v == '10.0.0') && matrix.os == 'ubuntu-latest'
run: |
cd $ANDROID_SDK_ROOT/build-tools/32.0.0
mv d8 dx
mv ./lib/d8.jar ./lib/dx.jar
- name: Patch Build Tools (Windows)
if: (matrix.cordova.android.v == '9.0.0' || matrix.cordova.android.v == '10.0.0') && matrix.os == 'windows-latest'
env:
BUILD_TOOLS: build-tools\32.0.0
run: |
ren $env:ANDROID_SDK_ROOT\$env:BUILD_TOOLS\d8.bat $env:ANDROID_SDK_ROOT\$env:BUILD_TOOLS\dx.bat
ren $env:ANDROID_SDK_ROOT\$env:BUILD_TOOLS\lib\d8.jar $env:ANDROID_SDK_ROOT\$env:BUILD_TOOLS\lib\dx.jar
- name: cordova build
working-directory: ./testApp
run: cordova build --no-telemetry
35 changes: 35 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish

on:
release:
types:
- created

jobs:
publish:
name: Publish NPM release
runs-on: ubuntu-latest
environment: Production

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Install NodeJS
uses: actions/setup-node@v1
with:
node-version: 14.x

- name: npm install and test
run: npm cit
env:
CI: true

- name: prepare publish
run: echo //registry.npmjs.org/:_authToken=$\{NPM_TOKEN\} > .npmrc

- name: npm publish
run: npm publish
env:
CI: true
NPM_TOKEN: ${{ secrets.NPM_PUB_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
Thumbs.db
sample/dev*
sample/dev*
coverage
.nyc_output
Loading

0 comments on commit b279a03

Please sign in to comment.