Skip to content

Commit

Permalink
ci: use github actions (#852)
Browse files Browse the repository at this point in the history
* dropped travis ci
* dropped appveyor
* updated coverage to include e2e tests
* updated test scripts
  • Loading branch information
erisu authored May 27, 2020
1 parent 37338bf commit 7460737
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 59 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

name: Node CI

on: [push, pull_request]

jobs:
darwin:
name: NodeJS ${{ matrix.node-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [10.x, 12.x]
os: [macos-latest]

steps:
- uses: actions/checkout@v2

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

- name: Environment Information
run: |
node --version
npm --version
- name: npm install and test
run: |
npm i -g ios-deploy
npm cit
env:
CI: true

- uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true

non-darwin:
name: NodeJS ${{ matrix.node-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [10.x, 12.x]
os: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v2

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

- name: Environment Information
run: |
node --version
npm --version
- name: npm install and test
run: |
npm ci
npm run lint
npm run unit-tests
env:
CI: true

- uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true
1 change: 0 additions & 1 deletion .ratignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ NSData+Base64.m
Contents.json
jasmine.json
fixtures
appveyor.yml
i386
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

16 changes: 0 additions & 16 deletions appveyor.yml

This file was deleted.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"cordova:platform"
],
"scripts": {
"test": "npm run unit-tests && npm run test:component && npm run objc-tests && npm run e2e-tests",
"pretest": "npm run lint",
"test": "npm run coverage && npm run objc-tests",
"test:component": "jasmine --config=tests/spec/component.json",
"posttest": "npm run lint",
"cover": "nyc jasmine --config=tests/spec/coverage.json",
"coverage": "nyc jasmine --config=tests/spec/coverage.json",
"e2e-tests": "jasmine tests/spec/create.spec.js",
"objc-tests": "npm run objc-tests-lib && npm run objc-tests-framework",
"objc-tests-lib": "npm run xcodebuild -- -scheme CordovaLibTests",
Expand Down
10 changes: 5 additions & 5 deletions tests/spec/component/versions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,31 @@ if (process.platform === 'darwin') {
() => fail('expected promise rejection'),
error => expect(error.message).toContain('is not valid tool name')
);
});
}, 10000);

it('should find xcodebuild version.', () => {
return versions.get_tool_version('xcodebuild').then((version) => {
expect(version).not.toBe(undefined);
});
});
}, 10000);

it('should find ios-sim version.', () => {
return versions.get_tool_version('ios-sim').then((version) => {
expect(version).not.toBe(undefined);
});
});
}, 10000);

it('should find ios-deploy version.', () => {
return versions.get_tool_version('ios-deploy').then((version) => {
expect(version).not.toBe(undefined);
});
});
}, 10000);

it('should find pod version.', () => {
return versions.get_tool_version('pod').then((version) => {
expect(version).not.toBe(undefined);
});
});
}, 10000);
});
});
}
3 changes: 2 additions & 1 deletion tests/spec/coverage.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"spec_dir": "tests/spec",
"spec_files": [
"unit/**/*[sS]pec.js",
"component/**/*[sS]pec.js"
"component/**/*[sS]pec.js",
"create.spec.js"
],
"stopSpecOnExpectationFailure": false,
"random": false
Expand Down
6 changes: 3 additions & 3 deletions tests/spec/unit/prepare.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
const fs = require('fs-extra');

const EventEmitter = require('events');
const os = require('os');
const path = require('path');
const plist = require('plist');
const xcode = require('xcode');
Expand All @@ -30,10 +29,11 @@ const prepare = rewire('../../../bin/templates/scripts/cordova/lib/prepare');
const projectFile = require('../../../bin/templates/scripts/cordova/lib/projectFile');
const FileUpdater = require('cordova-common').FileUpdater;

const tmpDir = path.join(__dirname, '../../../tmp');
const FIXTURES = path.join(__dirname, 'fixtures');

const iosProjectFixture = path.join(FIXTURES, 'ios-config-xml');
const iosProject = path.join(os.tmpdir(), 'prepare');
const iosProject = path.join(tmpDir, 'prepare');
const iosPlatform = path.join(iosProject, 'platforms/ios');

const ConfigParser = require('cordova-common').ConfigParser;
Expand All @@ -50,7 +50,7 @@ describe('prepare', () => {
});

afterEach(() => {
fs.removeSync(iosPlatform);
fs.removeSync(tmpDir);
});

describe('launch storyboard feature (CB-9762)', () => {
Expand Down

0 comments on commit 7460737

Please sign in to comment.