-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (105 loc) · 3.6 KB
/
Copy pathtest.yml
File metadata and controls
122 lines (105 loc) · 3.6 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Tests
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 20
registry-url: https://npm.pkg.github.com/
scope: '@callmetechie'
- run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
- name: Vendored template drift check
run: node scripts/check-vendored-templates.js
- name: Run tests with coverage
run: npx c8 --reporter=text --reporter=lcov --lines 40 npm test
env:
NODE_ENV: test
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/
eslint-security:
name: ESLint Security
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 20
registry-url: https://npm.pkg.github.com/
scope: '@callmetechie'
- name: Install ESLint with security plugin
run: npm install --no-save eslint@8 eslint-plugin-security@1.7.1
env:
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
- name: Create security ESLint config
run: |
cat > .eslintrc.security.json << 'ESLINTEOF'
{
"plugins": ["security"],
"extends": ["plugin:security/recommended"],
"env": { "node": true, "es2022": true },
"parserOptions": { "ecmaVersion": 2022 },
"rules": {
"security/detect-eval-with-expression": "error",
"security/detect-non-literal-fs-filename": "warn",
"security/detect-non-literal-require": "warn",
"security/detect-possible-timing-attacks": "warn",
"security/detect-child-process": "warn"
}
}
ESLINTEOF
- name: Run ESLint security scan
run: npx eslint -c .eslintrc.security.json "src/**/*.js" "public/**/*.js" --no-eslintrc --format stylish
# Catches missing/renamed imports that only blow up at request time
# (ReferenceError → 500). Two router splits shipped exactly that bug.
# src/ only: public/ scripts share globals across <script> tags by design.
- name: Create no-undef ESLint config
run: |
cat > .eslintrc.noundef.json << 'ESLINTEOF'
{
"env": { "node": true, "es2022": true },
"parserOptions": { "ecmaVersion": 2022, "sourceType": "script" },
"rules": { "no-undef": "error" }
}
ESLINTEOF
- name: Run ESLint no-undef scan (src)
run: npx eslint -c .eslintrc.noundef.json "src/**/*.js" --no-eslintrc --format stylish
mutation:
name: Mutation tests (gateway)
runs-on: ubuntu-latest
needs: test
if: |
github.event_name == 'push' ||
contains(github.event.pull_request.labels.*.name, 'mutation-test')
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 20
registry-url: https://npm.pkg.github.com/
scope: '@callmetechie'
- name: Install deps
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
- name: Mutation test
run: npx stryker run || true
- uses: actions/upload-artifact@v4
if: always()
with:
name: mutation-report
path: reports/mutation/