Skip to content

Commit 7460737

Browse files
authored
ci: use github actions (#852)
* dropped travis ci * dropped appveyor * updated coverage to include e2e tests * updated test scripts
1 parent 37338bf commit 7460737

File tree

8 files changed

+99
-59
lines changed

8 files changed

+99
-59
lines changed

.github/workflows/ci.yml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: Node CI
19+
20+
on: [push, pull_request]
21+
22+
jobs:
23+
darwin:
24+
name: NodeJS ${{ matrix.node-version }} on ${{ matrix.os }}
25+
runs-on: ${{ matrix.os }}
26+
strategy:
27+
matrix:
28+
node-version: [10.x, 12.x]
29+
os: [macos-latest]
30+
31+
steps:
32+
- uses: actions/checkout@v2
33+
34+
- name: Use Node.js ${{ matrix.node-version }}
35+
uses: actions/setup-node@v1
36+
with:
37+
node-version: ${{ matrix.node-version }}
38+
39+
- name: Environment Information
40+
run: |
41+
node --version
42+
npm --version
43+
44+
- name: npm install and test
45+
run: |
46+
npm i -g ios-deploy
47+
npm cit
48+
env:
49+
CI: true
50+
51+
- uses: codecov/codecov-action@v1
52+
with:
53+
fail_ci_if_error: true
54+
55+
non-darwin:
56+
name: NodeJS ${{ matrix.node-version }} on ${{ matrix.os }}
57+
runs-on: ${{ matrix.os }}
58+
strategy:
59+
matrix:
60+
node-version: [10.x, 12.x]
61+
os: [ubuntu-latest, windows-latest]
62+
63+
steps:
64+
- uses: actions/checkout@v2
65+
66+
- name: Use Node.js ${{ matrix.node-version }}
67+
uses: actions/setup-node@v1
68+
with:
69+
node-version: ${{ matrix.node-version }}
70+
71+
- name: Environment Information
72+
run: |
73+
node --version
74+
npm --version
75+
76+
- name: npm install and test
77+
run: |
78+
npm ci
79+
npm run lint
80+
npm run unit-tests
81+
env:
82+
CI: true
83+
84+
- uses: codecov/codecov-action@v1
85+
with:
86+
fail_ci_if_error: true

.ratignore

-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ NSData+Base64.m
88
Contents.json
99
jasmine.json
1010
fixtures
11-
appveyor.yml
1211
i386

.travis.yml

-30
This file was deleted.

appveyor.yml

-16
This file was deleted.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
"cordova:platform"
1919
],
2020
"scripts": {
21-
"test": "npm run unit-tests && npm run test:component && npm run objc-tests && npm run e2e-tests",
21+
"pretest": "npm run lint",
22+
"test": "npm run coverage && npm run objc-tests",
2223
"test:component": "jasmine --config=tests/spec/component.json",
23-
"posttest": "npm run lint",
24-
"cover": "nyc jasmine --config=tests/spec/coverage.json",
24+
"coverage": "nyc jasmine --config=tests/spec/coverage.json",
2525
"e2e-tests": "jasmine tests/spec/create.spec.js",
2626
"objc-tests": "npm run objc-tests-lib && npm run objc-tests-framework",
2727
"objc-tests-lib": "npm run xcodebuild -- -scheme CordovaLibTests",

tests/spec/component/versions.spec.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,31 @@ if (process.platform === 'darwin') {
2929
() => fail('expected promise rejection'),
3030
error => expect(error.message).toContain('is not valid tool name')
3131
);
32-
});
32+
}, 10000);
3333

3434
it('should find xcodebuild version.', () => {
3535
return versions.get_tool_version('xcodebuild').then((version) => {
3636
expect(version).not.toBe(undefined);
3737
});
38-
});
38+
}, 10000);
3939

4040
it('should find ios-sim version.', () => {
4141
return versions.get_tool_version('ios-sim').then((version) => {
4242
expect(version).not.toBe(undefined);
4343
});
44-
});
44+
}, 10000);
4545

4646
it('should find ios-deploy version.', () => {
4747
return versions.get_tool_version('ios-deploy').then((version) => {
4848
expect(version).not.toBe(undefined);
4949
});
50-
});
50+
}, 10000);
5151

5252
it('should find pod version.', () => {
5353
return versions.get_tool_version('pod').then((version) => {
5454
expect(version).not.toBe(undefined);
5555
});
56-
});
56+
}, 10000);
5757
});
5858
});
5959
}

tests/spec/coverage.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"spec_dir": "tests/spec",
33
"spec_files": [
44
"unit/**/*[sS]pec.js",
5-
"component/**/*[sS]pec.js"
5+
"component/**/*[sS]pec.js",
6+
"create.spec.js"
67
],
78
"stopSpecOnExpectationFailure": false,
89
"random": false

tests/spec/unit/prepare.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
const fs = require('fs-extra');
2222

2323
const EventEmitter = require('events');
24-
const os = require('os');
2524
const path = require('path');
2625
const plist = require('plist');
2726
const xcode = require('xcode');
@@ -30,10 +29,11 @@ const prepare = rewire('../../../bin/templates/scripts/cordova/lib/prepare');
3029
const projectFile = require('../../../bin/templates/scripts/cordova/lib/projectFile');
3130
const FileUpdater = require('cordova-common').FileUpdater;
3231

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

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

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

5252
afterEach(() => {
53-
fs.removeSync(iosPlatform);
53+
fs.removeSync(tmpDir);
5454
});
5555

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

0 commit comments

Comments
 (0)