Skip to content

Commit fb345a9

Browse files
authored
ci: update workflow (#83)
* ci: update workflow * ci: fix browser run * ci: add name to test job
1 parent a69b3c8 commit fb345a9

File tree

1 file changed

+89
-40
lines changed

1 file changed

+89
-40
lines changed

.github/workflows/ci.yml

Lines changed: 89 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,81 +8,130 @@ on:
88
paths-ignore:
99
- docs/**
1010
- '*.md'
11+
1112
jobs:
12-
browsers:
13+
dependency-review:
14+
name: Dependency Review
15+
if: github.event_name == 'pull_request'
1316
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
1419
steps:
15-
- uses: actions/checkout@v3
16-
- uses: actions/setup-node@v3
17-
- name: Install Dependencies
18-
run: npm install
19-
- name: Test
20-
run: npm run test:browser
20+
- name: Check out repo
21+
uses: actions/checkout@v3
22+
with:
23+
persist-credentials: false
24+
25+
- name: Dependency review
26+
uses: actions/dependency-review-action@v2
2127

2228
lint:
29+
name: Lint Code
2330
runs-on: ubuntu-latest
31+
permissions:
32+
contents: read
2433
steps:
25-
- uses: actions/checkout@v3
26-
- uses: actions/setup-node@v3
34+
- name: Check out repo
35+
uses: actions/checkout@v3
36+
with:
37+
persist-credentials: false
38+
39+
- name: Setup Node
40+
uses: actions/setup-node@v3
2741
with:
28-
node-version: 18
29-
- name: Install Dependencies
30-
run: npm install --ignore-scripts
31-
- name: Lint
42+
node-version: lts/*
43+
44+
- name: Install dependencies
45+
run: npm i --ignore-scripts
46+
47+
- name: Lint code
3248
run: npm run lint
3349

50+
browsers:
51+
name: Test Browsers
52+
runs-on: ubuntu-latest
53+
permissions:
54+
contents: read
55+
steps:
56+
- name: Check out repo
57+
uses: actions/checkout@v3
58+
with:
59+
persist-credentials: false
60+
61+
- name: Setup Node
62+
uses: actions/setup-node@v3
63+
with:
64+
node-version: lts/*
65+
66+
- name: Install dependencies
67+
run: npm i
68+
69+
- name: Run tests
70+
run: npm run test:browser
71+
3472
test:
73+
name: Test
3574
runs-on: ubuntu-latest
75+
permissions:
76+
contents: read
3677
strategy:
3778
matrix:
38-
node-version:
39-
- 6
40-
- 8
41-
- 10
42-
- 11
43-
- 12
44-
- 13
45-
- 14
46-
- 15
47-
- 16
48-
- 18
79+
node-version: [6, 8, 10, 11, 12, 13, 14, 15, 16, 18]
4980
steps:
50-
- uses: actions/checkout@v3
51-
- name: Use Node.js ${{ matrix.node-version }}
81+
- name: Check out repo
82+
uses: actions/checkout@v3
83+
with:
84+
persist-credentials: false
85+
86+
- name: Setup Node ${{ matrix.node-version }}
5287
uses: actions/setup-node@v3
5388
with:
5489
node-version: ${{ matrix.node-version }}
90+
5591
- name: Upgrade npm
5692
if: ${{ success() && matrix.node-version == '6' }}
5793
run: npm i npm@6.13.4 -g
58-
- name: Install Dependencies
59-
run: npm install --ignore-scripts
60-
- name: Test
94+
95+
- name: Install dependencies
96+
run: npm i --ignore-scripts
97+
98+
- name: Run tests
6199
run: npm run test:unit
62100

63101
typescript:
102+
name: Test TypeScript
64103
runs-on: ubuntu-latest
104+
permissions:
105+
contents: read
65106
steps:
66-
- uses: actions/checkout@v3
67-
- uses: actions/setup-node@v3
107+
- name: Check out repo
108+
uses: actions/checkout@v3
109+
with:
110+
persist-credentials: false
111+
112+
- name: Setup Node
113+
uses: actions/setup-node@v3
68114
with:
69-
node-version: 18
70-
- name: Install Dependencies
71-
run: npm install --ignore-scripts
115+
node-version: lts/*
116+
117+
- name: Install dependencies
118+
run: npm i --ignore-scripts
119+
72120
- name: tsd
73121
run: npm run test:typescript
74122

75123
automerge:
76-
needs:
77-
- lint
78-
- browsers
79-
- test
80-
- typescript
81-
runs-on: ubuntu-latest
124+
name: Automerge Dependabot PRs
125+
if: >
126+
github.event_name == 'pull_request' &&
127+
github.event.pull_request.user.login == 'dependabot[bot]'
128+
needs: [browsers, lint, test, typescript]
82129
permissions:
83130
pull-requests: write
84131
contents: write
132+
runs-on: ubuntu-latest
85133
steps:
86134
- uses: fastify/github-action-merge-dependabot@v3
87135
with:
88136
github-token: ${{ secrets.GITHUB_TOKEN }}
137+
target: major

0 commit comments

Comments
 (0)