-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (58 loc) · 1.61 KB
/
test.yml
File metadata and controls
71 lines (58 loc) · 1.61 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
name: "👀 Test"
on:
workflow_dispatch:
pull_request:
types: ["opened", "synchronize"]
paths-ignore:
- "**.md"
push:
branches:
- "main"
- "releases/*"
paths-ignore:
- "**.md"
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
test:
name: "Test"
runs-on: ubuntu-latest
steps:
- name: "Setup node"
uses: actions/setup-node@v3
with:
node-version: 20
- name: "Checkout"
uses: actions/checkout@v4
- name: "Install dependencies"
run: npm ci
- name: "Rebuild the index.js file"
run: npm run build
- name: "Format check"
run: npm run format-check
- name: Audit npm for vulnerabilities
run: npm shrinkwrap && npm audit
- name: "Lint check"
run: npm run lint
- name: "Package"
run: npm run package
- name: "Test package"
run: npm test
- name: "Verify changes"
id: diff
run: |
if [ "$(git diff --diff-algorithm=minimal --ignore-cr-at-eol --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "::warning::Detected uncommitted changes after build."
echo "::warning::Remember to run 'npm run all' to update 'dist/index.js' and include it in the commit."
git status
git diff --diff-algorithm=minimal --ignore-cr-at-eol --ignore-space-at-eol --exit-code
else
echo "No changes detected"
fi
- name: "Upload dist if failure"
uses: actions/upload-artifact@v4
if: failure() && steps.diff.conclusion == 'failure'
with:
name: dist
path: dist/