Skip to content

Commit ed08534

Browse files
committed
chore: fix broken CI build / test
1 parent ea15617 commit ed08534

File tree

8 files changed

+147
-126
lines changed

8 files changed

+147
-126
lines changed

.github/workflows/ci.yml

Lines changed: 54 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,63 +3,70 @@ name: Cordova HTTP Plugin CI
33
on: [push]
44

55
env:
6-
nodejs: '10.x'
6+
nodejs: "16.x"
7+
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
8+
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
79

810
jobs:
911
test-www-interface:
1012
runs-on: ubuntu-latest
1113
steps:
12-
- uses: actions/checkout@v1
13-
- name: Install Node.js ${{ env.nodejs }}
14-
uses: actions/setup-node@v1
15-
with:
16-
node-version: ${{ env.nodejs }}
17-
- name: Install node modules
18-
run: npm ci
19-
- name: Run WWW interface tests
20-
run: npm run testjs
14+
- uses: actions/checkout@v1
15+
- name: Install Node.js ${{ env.nodejs }}
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: ${{ env.nodejs }}
19+
- name: Install node modules
20+
run: npm ci
21+
- name: Run WWW interface tests
22+
run: npm run test:js
2123

2224
build-ios:
2325
runs-on: macOS-latest
2426
steps:
25-
- uses: actions/checkout@v1
26-
- name: Install Node.js ${{ env.nodejs }}
27-
uses: actions/setup-node@v1
28-
with:
29-
node-version: ${{ env.nodejs }}
30-
- name: Install node modules
31-
run: npm ci
32-
- name: Update test cert for httpbin.org
33-
run: npm run updatecert
34-
- name: Build test app
35-
run: scripts/build-test-app.sh --ios --emulator
27+
- uses: actions/checkout@v1
28+
- name: Install Node.js ${{ env.nodejs }}
29+
uses: actions/setup-node@v1
30+
with:
31+
node-version: ${{ env.nodejs }}
32+
- name: Install node modules
33+
run: npm ci
34+
- name: Update test cert for httpbin.org
35+
run: npm run update:cert
36+
# need to find a solution for signing iOS App so we can build for device target instead simulator
37+
- name: Build test app
38+
run: scripts/build-test-app.sh --ios --emulator
39+
- name: Upload artifact to BrowserStack
40+
if: env.BROWSERSTACK_USERNAME != ''
41+
run: scripts/upload-browserstack.sh --ios
42+
# need to have an App for device target
43+
# - name: Run e2e tests
44+
# if: env.BROWSERSTACK_USERNAME != ''
45+
# run: scripts/test-app.sh --ios --device
3646

3747
build-android:
3848
runs-on: ubuntu-latest
39-
env:
40-
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
41-
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
4249
steps:
43-
- uses: actions/checkout@v1
44-
- name: Install Node.js ${{ env.nodejs }}
45-
uses: actions/setup-node@v1
46-
with:
47-
node-version: ${{ env.nodejs }}
48-
- name: Install node modules
49-
run: npm ci
50-
- name: Install JDK 1.8
51-
uses: actions/setup-java@v1
52-
with:
53-
java-version: 1.8
54-
- name: Update test cert for httpbin.org
55-
run: npm run updatecert
56-
- name: Add workaround for missing DX files in build-tools 31 (https://stackoverflow.com/a/68430992)
57-
run: ln -s $ANDROID_HOME/build-tools/31.0.0/d8 $ANDROID_HOME/build-tools/31.0.0/dx && ln -s $ANDROID_HOME/build-tools/31.0.0/lib/d8.jar $ANDROID_HOME/build-tools/31.0.0/lib/dx.jar
58-
- name: Build test app
59-
run: scripts/build-test-app.sh --android --device
60-
- name: Upload artifact to BrowserStack
61-
if: env.BROWSERSTACK_USERNAME != ''
62-
run: scripts/upload-browserstack.sh --android
63-
- name: Run e2e tests
64-
if: env.BROWSERSTACK_USERNAME != ''
65-
run: scripts/test-app.sh --android --device
50+
- uses: actions/checkout@v1
51+
- name: Install Node.js ${{ env.nodejs }}
52+
uses: actions/setup-node@v1
53+
with:
54+
node-version: ${{ env.nodejs }}
55+
- name: Install node modules
56+
run: npm ci
57+
- name: Install JDK 1.8
58+
uses: actions/setup-java@v1
59+
with:
60+
java-version: 1.8
61+
- name: Update test cert for httpbin.org
62+
run: npm run update:cert
63+
- name: Add workaround for missing DX files in build-tools 32 (https://stackoverflow.com/a/68430992)
64+
run: ln -s $ANDROID_HOME/build-tools/32.0.0/d8 $ANDROID_HOME/build-tools/32.0.0/dx && ln -s $ANDROID_HOME/build-tools/32.0.0/lib/d8.jar $ANDROID_HOME/build-tools/32.0.0/lib/dx.jar
65+
- name: Build test app
66+
run: scripts/build-test-app.sh --android --device
67+
- name: Upload artifact to BrowserStack
68+
if: env.BROWSERSTACK_USERNAME != ''
69+
run: scripts/upload-browserstack.sh --android
70+
- name: Run e2e tests
71+
if: env.BROWSERSTACK_USERNAME != ''
72+
run: scripts/test-app.sh --android --device

.travis.yml

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,52 +7,52 @@ addons:
77

88
matrix:
99
include:
10-
- name: "iOS Build & Test"
11-
language: objective-c
12-
sudo: false
13-
os: osx
14-
osx_image: xcode12.5
15-
16-
before_install:
17-
- export LANG=en_US.UTF-8 &&
18-
nvm use 14
19-
20-
install:
21-
- npm install
22-
23-
script:
24-
- npm run testjs &&
25-
npm run updatecert &&
26-
scripts/build-test-app.sh --ios --emulator &&
27-
scripts/upload-saucelabs.sh --ios &&
28-
scripts/test-app.sh --ios --emulator;
29-
30-
- name: "Android Build & Test"
31-
language: android
32-
sudo : required
33-
34-
android:
35-
components:
36-
- tools
37-
- platform-tools
38-
- build-tools-28.0.3
39-
- android-28
40-
- extra-android-support
41-
- extra-android-m2repository
42-
- extra-google-m2repository
43-
44-
before_install:
45-
- export LANG=en_US.UTF-8 &&
46-
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - &&
47-
sudo apt-get install -y nodejs
48-
- yes | sdkmanager --update
49-
50-
install:
51-
- npm install
52-
53-
script:
54-
- npm run testjs &&
55-
npm run updatecert &&
56-
scripts/build-test-app.sh --android --emulator &&
57-
scripts/upload-saucelabs.sh --android &&
58-
scripts/test-app.sh --android --emulator;
10+
- name: "iOS Build & Test"
11+
language: objective-c
12+
sudo: false
13+
os: osx
14+
osx_image: xcode12.5
15+
16+
before_install:
17+
- export LANG=en_US.UTF-8 &&
18+
nvm use 14
19+
20+
install:
21+
- npm install
22+
23+
script:
24+
- npm run test:js &&
25+
npm run update:cert &&
26+
scripts/build-test-app.sh --ios --emulator &&
27+
scripts/upload-saucelabs.sh --ios &&
28+
scripts/test-app.sh --ios --emulator;
29+
30+
- name: "Android Build & Test"
31+
language: android
32+
sudo: required
33+
34+
android:
35+
components:
36+
- tools
37+
- platform-tools
38+
- build-tools-30.0.1
39+
- android-28
40+
- extra-android-support
41+
- extra-android-m2repository
42+
- extra-google-m2repository
43+
44+
before_install:
45+
- export LANG=en_US.UTF-8 &&
46+
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - &&
47+
sudo apt-get install -y nodejs
48+
- yes | sdkmanager --update
49+
50+
install:
51+
- npm install
52+
53+
script:
54+
- npm run test:js &&
55+
npm run update:cert &&
56+
scripts/build-test-app.sh --android --emulator &&
57+
scripts/upload-saucelabs.sh --android &&
58+
scripts/test-app.sh --android --emulator;

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ Downloads a file and saves it to the device. Takes a URL, parameters, headers,
418418

419419
```js
420420
cordova.plugin.http.downloadFile(
421-
"https://google.com/",
421+
"https://google.com/",
422422
{ id: '12', message: 'test' },
423423
{ Authorization: 'OAuth2: token' },
424424
'file:///somepicture.jpg',
@@ -434,7 +434,7 @@ cordova.plugin.http.downloadFile(
434434
Object.keys(response.headers).forEach(function (key) {
435435
console.log(key, response.headers[key]);
436436
});
437-
},
437+
},
438438
// error callback
439439
function(response) {
440440
console.error(response.error);
@@ -526,7 +526,7 @@ First, install current package with `npm install` to fetch dev dependencies.
526526

527527
Then, to execute Javascript tests:
528528
```shell
529-
npm run testjs
529+
npm run test:js
530530
```
531531

532532
And, to execute E2E tests:
@@ -537,8 +537,8 @@ And, to execute E2E tests:
537537
- run
538538
- updating client and server certificates, building test app, and running e2e tests
539539
```shell
540-
npm run testandroid
541-
npm run testios
540+
npm run test:android
541+
npm run test:ios
542542
```
543543

544544
## Contribute & Develop

package-lock.json

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
"version": "3.2.2",
44
"description": "Cordova / Phonegap plugin for communicating with HTTP servers using SSL pinning",
55
"scripts": {
6-
"updatecert": "node ./scripts/update-e2e-server-cert.js && node ./scripts/update-e2e-client-cert.js",
7-
"buildbrowser": "./scripts/build-test-app.sh --browser",
8-
"buildandroid": "./scripts/build-test-app.sh --android --emulator",
9-
"buildios": "./scripts/build-test-app.sh --ios --emulator",
10-
"testandroid": "npm run updatecert && npm run buildandroid && ./scripts/test-app.sh --android --emulator",
11-
"testios": "npm run updatecert && npm run buildios && ./scripts/test-app.sh --ios --emulator",
12-
"testapp": "npm run testandroid && npm run testios",
13-
"testjs": "mocha ./test/js-specs.js",
14-
"test": "npm run testjs && npm run testapp",
6+
"update:cert": "node ./scripts/update-e2e-server-cert.js && node ./scripts/update-e2e-client-cert.js",
7+
"build:browser": "./scripts/build-test-app.sh --browser",
8+
"build:android": "./scripts/build-test-app.sh --android --emulator",
9+
"build:ios": "./scripts/build-test-app.sh --ios --emulator",
10+
"test:android": "npm run update:cert && npm run build:android && ./scripts/test-app.sh --android --emulator",
11+
"test:ios": "npm run update:cert && npm run build:ios && ./scripts/test-app.sh --ios --emulator",
12+
"test:app": "npm run test:android && npm run test:ios",
13+
"test:js": "mocha ./test/js-specs.js",
14+
"test": "npm run test:js && npm run test:app",
1515
"release": "npm run test && ./scripts/release.sh"
1616
},
1717
"cordova": {
@@ -63,7 +63,7 @@
6363
"cordova": "10.0.0",
6464
"mocha": "8.2.0",
6565
"umd-tough-cookie": "2.4.3",
66-
"wd": "1.12.1",
66+
"wd": "1.14.0",
6767
"xml2js": "0.4.23"
6868
}
6969
}

test/e2e-app-template/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"license": "Apache-2.0",
1313
"dependencies": {
1414
"cordova": "10.0.0",
15-
"cordova-android": "9.0.0",
15+
"cordova-android": "10.1.1",
1616
"cordova-browser": "6.0.0",
1717
"cordova-ios": "6.2.0",
1818
"cordova-plugin-device": "2.0.3",

0 commit comments

Comments
 (0)