|
1 |
| ---- |
2 |
| -################################################################################ |
3 |
| -# Template - Node CI |
4 |
| -# |
5 |
| -# Description: |
6 |
| -# This contains the basic information to: install dependencies, run tests, |
7 |
| -# get coverage, and run linting on a nodejs project. This template will run |
8 |
| -# over the MxN matrix of all operating systems, and all current LTS versions |
9 |
| -# of NodeJS. |
10 |
| -# |
11 |
| -# Dependencies: |
12 |
| -# This template assumes that your project is using the `tap` module for |
13 |
| -# testing. If you're not using this module, then the step that runs your |
14 |
| -# coverage will need to be adjusted. |
15 |
| -# |
16 |
| -################################################################################ |
17 |
| -name: Node CI |
| 1 | +# This file is automatically added by @npmcli/template-oss. Do not edit. |
18 | 2 |
|
19 |
| -on: [push, pull_request] |
| 3 | +name: CI |
| 4 | + |
| 5 | +on: |
| 6 | + pull_request: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + - latest |
20 | 11 |
|
21 | 12 | jobs:
|
22 |
| - build: |
| 13 | + lint: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v2 |
| 17 | + - uses: actions/setup-node@v2 |
| 18 | + with: |
| 19 | + node-version: '16' |
| 20 | + cache: npm |
| 21 | + - run: npm i --prefer-online -g npm@latest |
| 22 | + - run: npm ci |
| 23 | + - run: npm run lint |
| 24 | + |
| 25 | + test: |
23 | 26 | strategy:
|
24 | 27 | fail-fast: false
|
25 | 28 | matrix:
|
26 |
| - node-version: [10.x, 12.x, 14.x, 16.x] |
27 |
| - os: [ubuntu-latest, windows-latest, macOS-latest] |
28 |
| - |
29 |
| - runs-on: ${{ matrix.os }} |
30 |
| - |
| 29 | + node-version: [12.13.0, 12.x, 14.15.0, 14.x, 16.13.0, 16.x] |
| 30 | + platform: |
| 31 | + - os: ubuntu-latest |
| 32 | + shell: bash |
| 33 | + - os: macos-latest |
| 34 | + shell: bash |
| 35 | + - os: windows-latest |
| 36 | + shell: bash |
| 37 | + - os: windows-latest |
| 38 | + shell: cmd |
| 39 | + - os: windows-latest |
| 40 | + shell: powershell |
| 41 | + runs-on: ${{ matrix.platform.os }} |
| 42 | + defaults: |
| 43 | + run: |
| 44 | + shell: ${{ matrix.platform.shell }} |
31 | 45 | steps:
|
32 |
| - # Checkout the repository |
33 | 46 | - uses: actions/checkout@v2
|
34 |
| - # Installs the specific version of Node.js |
35 |
| - - name: Use Node.js ${{ matrix.node-version }} |
36 |
| - uses: actions/setup-node@v1 |
| 47 | + - uses: actions/setup-node@v2 |
37 | 48 | with:
|
38 | 49 | node-version: ${{ matrix.node-version }}
|
39 |
| - |
40 |
| - - name: update npm |
41 |
| - run: npm i -g npm@latest |
42 |
| - |
43 |
| - ################################################################################ |
44 |
| - # Install Dependencies |
45 |
| - # |
46 |
| - # ASSUMPTIONS: |
47 |
| - # - The project has a package-lock.json file |
48 |
| - # |
49 |
| - # Simply run the tests for the project. |
50 |
| - ################################################################################ |
51 |
| - - name: Install dependencies |
52 |
| - run: npm ci |
53 |
| - |
54 |
| - ################################################################################ |
55 |
| - # Run Testing |
56 |
| - # |
57 |
| - # ASSUMPTIONS: |
58 |
| - # - The project has `tap` as a devDependency |
59 |
| - # - There is a script called "test" in the package.json |
60 |
| - # |
61 |
| - # Simply run the tests for the project. |
62 |
| - ################################################################################ |
63 |
| - - name: Run tests |
64 |
| - run: npm test -- --no-coverage |
65 |
| - |
66 |
| - ################################################################################ |
67 |
| - # Run coverage check |
68 |
| - # |
69 |
| - # ASSUMPTIONS: |
70 |
| - # - The project has `tap` as a devDependency |
71 |
| - # - There is a script called "coverage" in the package.json |
72 |
| - # |
73 |
| - # Coverage should only be posted once, we are choosing the latest LTS of |
74 |
| - # node, and ubuntu as the matrix point to post coverage from. We limit |
75 |
| - # to the 'push' event so that coverage ins't posted twice from the |
76 |
| - # pull-request event, and push event (line 3). |
77 |
| - ################################################################################ |
78 |
| - - name: Run coverage report |
79 |
| - if: github.event_name == 'push' && matrix.node-version == '12.x' && matrix.os == 'ubuntu-latest' |
80 |
| - run: npm test |
81 |
| - env: |
82 |
| - # The environment variable name is leveraged by `tap` |
83 |
| - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
84 |
| - |
85 |
| - ################################################################################ |
86 |
| - # Run linting |
87 |
| - # |
88 |
| - # ASSUMPTIONS: |
89 |
| - # - There is a script called "lint" in the package.json |
90 |
| - # |
91 |
| - # We run linting AFTER we run testing and coverage checks, because if a step |
92 |
| - # fails in an GitHub Action, all other steps are not run. We don't want to |
93 |
| - # fail to run tests or coverage because of linting. It should be the lowest |
94 |
| - # priority of all the steps. |
95 |
| - ################################################################################ |
96 |
| - - name: Run linter |
97 |
| - run: npm run lint |
| 50 | + cache: npm |
| 51 | + - run: npm i --prefer-online -g npm@latest |
| 52 | + - run: npm ci |
| 53 | + - run: npm test --ignore-scripts |
0 commit comments