Skip to content

Commit f3ef82a

Browse files
chore(CI): simplify testing strategy (mysticatea#4)
1 parent d930dcc commit f3ef82a

File tree

4 files changed

+85
-65
lines changed

4 files changed

+85
-65
lines changed

.codecov.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/CI.yml

Lines changed: 78 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,112 @@
11
name: CI
22
on:
33
push:
4-
branches: [main, gha]
5-
pull_request:
64
branches: [main]
5+
pull_request:
76
schedule:
87
- cron: 0 0 * * 0
98

109
jobs:
1110
lint:
12-
name: Lint
11+
name: Lint
1312
runs-on: ubuntu-latest
1413
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v2
17-
- name: Install Node.js
18-
uses: actions/setup-node@v1
19-
with: { node-version: 14.x }
20-
- name: Install Packages
14+
- name: 🛑 Cancel Previous Runs
15+
uses: styfle/[email protected]
16+
17+
- name: ⬇️ Checkout repo
18+
uses: actions/checkout@v3
19+
20+
- name: ⎔ Setup Node
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: 18
24+
25+
- name: 📥 Install dependencies
2126
run: npm install
22-
- name: Lint
23-
run: npm run -s lint
27+
28+
- name: ▶️ Run lint script
29+
run: npm run lint
2430

2531
test:
26-
name: Test
32+
name:
33+
🧪 Test (Node@${{ matrix.node }} - ESLint@${{ matrix.eslint }} - ${{
34+
matrix.os }})
2735
strategy:
2836
matrix:
29-
eslint: [7.x]
30-
node: [14.x]
37+
eslint: [7]
38+
node: [10, 12.0.0, 12, 14.0.0, 14, 16.0.0, 16, 18.0.0, 18]
3139
os: [ubuntu-latest]
3240
include:
3341
# On other platforms
34-
- eslint: 7.x
35-
node: 14.x
36-
os: windows-latest
37-
- eslint: 7.x
38-
node: 14.x
39-
os: macos-latest
40-
# On old Node.js versions
41-
- eslint: 7.x
42-
node: 12.x
42+
- os: windows-latest
43+
eslint: 7
44+
node: 18
45+
- os: macos-latest
46+
eslint: 7
47+
node: 18
48+
# On old ESLint versions
49+
- eslint: 6
50+
node: 18
4351
os: ubuntu-latest
44-
- eslint: 7.x
45-
node: 10.x
52+
- eslint: 5
53+
node: 18
4654
os: ubuntu-latest
47-
- eslint: 6.x
48-
node: 8.x
55+
- eslint: 4
56+
node: 18
57+
os: ubuntu-latest
58+
# On old Node.js versions
59+
- eslint: 6
60+
node: 8
4961
os: ubuntu-latest
50-
- eslint: 5.x
51-
node: 6.x
62+
- eslint: 5
63+
node: 6
5264
os: ubuntu-latest
5365
# On the minimum supported ESLint/Node.js version
54-
- eslint: "4.19.1"
55-
node: "6.5.0"
66+
- eslint: 4.19.1
67+
node: 6.5.0
5668
os: ubuntu-latest
57-
5869
runs-on: ${{ matrix.os }}
5970
steps:
60-
- name: Checkout
61-
uses: actions/checkout@v2
62-
- name: Install Node.js ${{ matrix.node }}
63-
uses: actions/setup-node@v1
64-
with: { node-version: "${{ matrix.node }}" }
65-
- name: Install Packages for Node v6
71+
- name: 🛑 Cancel Previous Runs
72+
uses: styfle/[email protected]
73+
74+
- name: ⬇️ Checkout repo
75+
uses: actions/checkout@v3
76+
77+
- name: ⎔ Setup Node v${{ matrix.node }}
78+
uses: actions/setup-node@v3
79+
with:
80+
node-version: ${{ matrix.node }}
81+
82+
# - name: 📥 Install dependencies
83+
# run: npm install
84+
- name: 📥 Install Packages for Node v6
6685
run: |
6786
sudo npm i [email protected]
6887
./node_modules/.bin/npm -v
6988
./node_modules/.bin/npm uninstall vuepress
7089
./node_modules/.bin/npm install
71-
if: ${{ matrix.node == '6.x' || matrix.node == '6.5.0' }}
72-
- name: Uninstall Packages for Node v8
90+
if: ${{ matrix.node == '6.5.0' || matrix.node == '6' }}
91+
- name: 📥 Uninstall Packages for Node v8
7392
run: |
7493
npm uninstall vuepress
75-
if: ${{ matrix.node == '8.x' }}
76-
- name: Install Packages
77-
run: npm install
78-
if: ${{ matrix.node != '6.x' && matrix.node != '6.5.0' }}
79-
- name: Install ESLint ${{ matrix.eslint }} for Node v6
80-
run: ./node_modules/.bin/npm install --no-save eslint@${{ matrix.eslint }}
81-
if: ${{ matrix.node == '6.x' || matrix.node == '6.5.0' }}
82-
- name: Install ESLint ${{ matrix.eslint }}
83-
run: npm install --no-save eslint@${{ matrix.eslint }}
84-
if: ${{ matrix.node != '6.x' && matrix.node != '6.5.0' }}
85-
- name: Test
86-
run: npm run -s test:ci
87-
- name: Send Coverage
88-
run: npm run -s codecov
89-
env:
90-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
91-
if: ${{ matrix.node != '6.x' && matrix.node != '6.5.0' }}
94+
if: ${{ matrix.node == '8.O.O' || matrix.node == '8' }}
95+
- name: 📥 Install Packages
96+
run: npm install --legacy-peer-deps
97+
if: ${{ matrix.node != '6.5.0' && matrix.node != '6' }}
98+
99+
# - name: 📥 Install ESLint v${{ matrix.eslint }}
100+
# run: npm install --save-dev eslint@${{ matrix.eslint }}
101+
- name: 📥 Install ESLint v${{ matrix.eslint }} for Node v6
102+
run: ./node_modules/.bin/npm install --save-dev eslint@${{ matrix.eslint }}
103+
if: ${{ matrix.node == '6.5.0' || matrix.node == '6' }}
104+
- name: 📥 Install ESLint v${{ matrix.eslint }}
105+
run: npm install --save-dev eslint@${{ matrix.eslint }}
106+
if: ${{ matrix.node != '6.5.0' && matrix.node != '6' }}
107+
108+
- name: ▶️ Run test script
109+
run: npm run test
110+
111+
- name: ⬆️ Upload coverage report
112+
uses: codecov/codecov-action@v3

.nycrc.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include:
2+
- lib
3+
reporter:
4+
- lcov
5+
- text-summary

package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"@types/node": "^14.0.1",
2222
"@vuepress/plugin-pwa": "^1.0.1",
2323
"babel-eslint": "^10.0.1",
24-
"codecov": "^3.3.0",
2524
"cross-spawn": "^6.0.5",
2625
"eslint": "^7.0.0",
2726
"eslint4b": "^7.0.0",
@@ -44,13 +43,9 @@
4443
"docs:watch": "vuepress dev docs",
4544
"docs:deploy": "node scripts/deploy",
4645
"lint": "eslint lib scripts tests",
47-
"pretest": "npm run -s lint",
48-
"test": "nyc npm run -s test:mocha",
49-
"test:ci": "nyc npm run -s test:mocha",
50-
"test:mocha": "mocha \"tests/lib/**/*.js\" --reporter dot --timeout 8000",
51-
"watch": "npm run -s test:mocha -- --watch --growl",
46+
"test": "nyc mocha \"tests/lib/**/*.js\" --reporter dot --timeout 8000",
5247
"coverage": "nyc report --reporter lcov && opener coverage/lcov-report/index.html",
53-
"codecov": "nyc report --reporter text-lcov | codecov --pipe --disable=gcov"
48+
"watch": "npm run -s test -- --watch --growl"
5449
},
5550
"repository": {
5651
"type": "git",

0 commit comments

Comments
 (0)