Skip to content

Commit

Permalink
chore: fix broken CI build / test
Browse files Browse the repository at this point in the history
  • Loading branch information
silkimen committed Mar 30, 2022
1 parent ea15617 commit ed08534
Show file tree
Hide file tree
Showing 8 changed files with 147 additions and 126 deletions.
101 changes: 54 additions & 47 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,70 @@ name: Cordova HTTP Plugin CI
on: [push]

env:
nodejs: '10.x'
nodejs: "16.x"
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}

jobs:
test-www-interface:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install Node.js ${{ env.nodejs }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.nodejs }}
- name: Install node modules
run: npm ci
- name: Run WWW interface tests
run: npm run testjs
- uses: actions/checkout@v1
- name: Install Node.js ${{ env.nodejs }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.nodejs }}
- name: Install node modules
run: npm ci
- name: Run WWW interface tests
run: npm run test:js

build-ios:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- name: Install Node.js ${{ env.nodejs }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.nodejs }}
- name: Install node modules
run: npm ci
- name: Update test cert for httpbin.org
run: npm run updatecert
- name: Build test app
run: scripts/build-test-app.sh --ios --emulator
- uses: actions/checkout@v1
- name: Install Node.js ${{ env.nodejs }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.nodejs }}
- name: Install node modules
run: npm ci
- name: Update test cert for httpbin.org
run: npm run update:cert
# need to find a solution for signing iOS App so we can build for device target instead simulator
- name: Build test app
run: scripts/build-test-app.sh --ios --emulator
- name: Upload artifact to BrowserStack
if: env.BROWSERSTACK_USERNAME != ''
run: scripts/upload-browserstack.sh --ios
# need to have an App for device target
# - name: Run e2e tests
# if: env.BROWSERSTACK_USERNAME != ''
# run: scripts/test-app.sh --ios --device

build-android:
runs-on: ubuntu-latest
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
steps:
- uses: actions/checkout@v1
- name: Install Node.js ${{ env.nodejs }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.nodejs }}
- name: Install node modules
run: npm ci
- name: Install JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Update test cert for httpbin.org
run: npm run updatecert
- name: Add workaround for missing DX files in build-tools 31 (https://stackoverflow.com/a/68430992)
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
- name: Build test app
run: scripts/build-test-app.sh --android --device
- name: Upload artifact to BrowserStack
if: env.BROWSERSTACK_USERNAME != ''
run: scripts/upload-browserstack.sh --android
- name: Run e2e tests
if: env.BROWSERSTACK_USERNAME != ''
run: scripts/test-app.sh --android --device
- uses: actions/checkout@v1
- name: Install Node.js ${{ env.nodejs }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.nodejs }}
- name: Install node modules
run: npm ci
- name: Install JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Update test cert for httpbin.org
run: npm run update:cert
- name: Add workaround for missing DX files in build-tools 32 (https://stackoverflow.com/a/68430992)
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
- name: Build test app
run: scripts/build-test-app.sh --android --device
- name: Upload artifact to BrowserStack
if: env.BROWSERSTACK_USERNAME != ''
run: scripts/upload-browserstack.sh --android
- name: Run e2e tests
if: env.BROWSERSTACK_USERNAME != ''
run: scripts/test-app.sh --android --device
98 changes: 49 additions & 49 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,52 @@ addons:

matrix:
include:
- name: "iOS Build & Test"
language: objective-c
sudo: false
os: osx
osx_image: xcode12.5

before_install:
- export LANG=en_US.UTF-8 &&
nvm use 14

install:
- npm install

script:
- npm run testjs &&
npm run updatecert &&
scripts/build-test-app.sh --ios --emulator &&
scripts/upload-saucelabs.sh --ios &&
scripts/test-app.sh --ios --emulator;

- name: "Android Build & Test"
language: android
sudo : required

android:
components:
- tools
- platform-tools
- build-tools-28.0.3
- android-28
- extra-android-support
- extra-android-m2repository
- extra-google-m2repository

before_install:
- export LANG=en_US.UTF-8 &&
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - &&
sudo apt-get install -y nodejs
- yes | sdkmanager --update

install:
- npm install

script:
- npm run testjs &&
npm run updatecert &&
scripts/build-test-app.sh --android --emulator &&
scripts/upload-saucelabs.sh --android &&
scripts/test-app.sh --android --emulator;
- name: "iOS Build & Test"
language: objective-c
sudo: false
os: osx
osx_image: xcode12.5

before_install:
- export LANG=en_US.UTF-8 &&
nvm use 14

install:
- npm install

script:
- npm run test:js &&
npm run update:cert &&
scripts/build-test-app.sh --ios --emulator &&
scripts/upload-saucelabs.sh --ios &&
scripts/test-app.sh --ios --emulator;

- name: "Android Build & Test"
language: android
sudo: required

android:
components:
- tools
- platform-tools
- build-tools-30.0.1
- android-28
- extra-android-support
- extra-android-m2repository
- extra-google-m2repository

before_install:
- export LANG=en_US.UTF-8 &&
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - &&
sudo apt-get install -y nodejs
- yes | sdkmanager --update

install:
- npm install

script:
- npm run test:js &&
npm run update:cert &&
scripts/build-test-app.sh --android --emulator &&
scripts/upload-saucelabs.sh --android &&
scripts/test-app.sh --android --emulator;
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ Downloads a file and saves it to the device. Takes a URL, parameters, headers,

```js
cordova.plugin.http.downloadFile(
"https://google.com/",
"https://google.com/",
{ id: '12', message: 'test' },
{ Authorization: 'OAuth2: token' },
'file:///somepicture.jpg',
Expand All @@ -434,7 +434,7 @@ cordova.plugin.http.downloadFile(
Object.keys(response.headers).forEach(function (key) {
console.log(key, response.headers[key]);
});
},
},
// error callback
function(response) {
console.error(response.error);
Expand Down Expand Up @@ -526,7 +526,7 @@ First, install current package with `npm install` to fetch dev dependencies.

Then, to execute Javascript tests:
```shell
npm run testjs
npm run test:js
```

And, to execute E2E tests:
Expand All @@ -537,8 +537,8 @@ And, to execute E2E tests:
- run
- updating client and server certificates, building test app, and running e2e tests
```shell
npm run testandroid
npm run testios
npm run test:android
npm run test:ios
```

## Contribute & Develop
Expand Down
15 changes: 8 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"version": "3.2.2",
"description": "Cordova / Phonegap plugin for communicating with HTTP servers using SSL pinning",
"scripts": {
"updatecert": "node ./scripts/update-e2e-server-cert.js && node ./scripts/update-e2e-client-cert.js",
"buildbrowser": "./scripts/build-test-app.sh --browser",
"buildandroid": "./scripts/build-test-app.sh --android --emulator",
"buildios": "./scripts/build-test-app.sh --ios --emulator",
"testandroid": "npm run updatecert && npm run buildandroid && ./scripts/test-app.sh --android --emulator",
"testios": "npm run updatecert && npm run buildios && ./scripts/test-app.sh --ios --emulator",
"testapp": "npm run testandroid && npm run testios",
"testjs": "mocha ./test/js-specs.js",
"test": "npm run testjs && npm run testapp",
"update:cert": "node ./scripts/update-e2e-server-cert.js && node ./scripts/update-e2e-client-cert.js",
"build:browser": "./scripts/build-test-app.sh --browser",
"build:android": "./scripts/build-test-app.sh --android --emulator",
"build:ios": "./scripts/build-test-app.sh --ios --emulator",
"test:android": "npm run update:cert && npm run build:android && ./scripts/test-app.sh --android --emulator",
"test:ios": "npm run update:cert && npm run build:ios && ./scripts/test-app.sh --ios --emulator",
"test:app": "npm run test:android && npm run test:ios",
"test:js": "mocha ./test/js-specs.js",
"test": "npm run test:js && npm run test:app",
"release": "npm run test && ./scripts/release.sh"
},
"cordova": {
Expand Down Expand Up @@ -63,7 +63,7 @@
"cordova": "10.0.0",
"mocha": "8.2.0",
"umd-tough-cookie": "2.4.3",
"wd": "1.12.1",
"wd": "1.14.0",
"xml2js": "0.4.23"
}
}
2 changes: 1 addition & 1 deletion test/e2e-app-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"license": "Apache-2.0",
"dependencies": {
"cordova": "10.0.0",
"cordova-android": "9.0.0",
"cordova-android": "10.1.1",
"cordova-browser": "6.0.0",
"cordova-ios": "6.2.0",
"cordova-plugin-device": "2.0.3",
Expand Down
Loading

0 comments on commit ed08534

Please sign in to comment.