-
Notifications
You must be signed in to change notification settings - Fork 10
95 lines (77 loc) · 2.45 KB
/
node-test.yml
File metadata and controls
95 lines (77 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Node.js Unit Test
on:
workflow_call:
inputs:
os:
type: string
description: 'Operator System, such as: ubuntu-latest,macos-latest'
default: 'ubuntu-latest, macos-latest, windows-latest'
version:
type: string
description: 'Node.js Version, such as 16, 18'
default: '16, 18'
install:
type: string
description: 'Install dependencies script'
default: 'npm i --no-package-lock --no-fund'
action_ref:
type: string
description: 'Branch name for artusjs/github-actions, for test purpose'
default: master
jobs:
Setup:
runs-on: ubuntu-latest
outputs:
os: ${{ steps.handler.outputs.os }}
version: ${{ steps.handler.outputs.version }}
steps:
# Checkout action repository
- name: Checkout
uses: actions/checkout@v3
with:
repository: artusjs/github-actions
path: action_repo
ref: ${{ inputs.action_ref }}
# Setup Node.js environment
- name: Setup Node.js
uses: actions/setup-node@v3
# Install dependencies
- name: Install dependencies
run: npm i --no-package-lock --no-fund
working-directory: action_repo/scripts/test
# Normalize inputs style
- name: Convert Inputs to Matrix
id: handler
run: node action_repo/scripts/test/index.js
env:
INPUT_OS: ${{ inputs.os }}
INPUT_VERSION: ${{ inputs.version }}
Test:
needs: Setup
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(needs.setup.outputs.os) }}
version: ${{ fromJSON(needs.setup.outputs.version) }}
name: Test (${{ matrix.os }}, ${{ matrix.version }})
runs-on: ${{ matrix.os }}
concurrency:
group: ${{ github.workflow }}-#${{ github.event.pull_request.number || github.ref }}-(${{ matrix.os }}, ${{ matrix.version }})
cancel-in-progress: true
steps:
- name: Checkout Git Source
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.version }}
- name: Install Dependencies
run: ${{ inputs.install }}
- name: Run Lint
run: npm run lint
- name: Run Test
run: npm run ci
- name: Code Coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}