-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (66 loc) · 2.59 KB
/
Copy pathci.yml
File metadata and controls
79 lines (66 loc) · 2.59 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_call:
permissions:
contents: read
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Scan for secrets
env:
# Bump together; checksum from
# https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_checksums.txt
GITLEAKS_VERSION: 8.30.1
GITLEAKS_SHA256: 551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb
run: |
set -euo pipefail
curl -sSfL "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" -o /tmp/gitleaks.tgz
echo "${GITLEAKS_SHA256} /tmp/gitleaks.tgz" | sha256sum -c -
tar xz -C /tmp -f /tmp/gitleaks.tgz
/tmp/gitleaks detect --source . --verbose --redact
- uses: actions/setup-node@v6
with:
node-version: 22
cache: 'npm'
- name: Check for large files
run: |
LARGE=$(find . -not -path './.git/*' -not -path './node_modules/*' -type f -size +5M)
if [ -n "$LARGE" ]; then
echo "::error::Large files detected (>5 MB):"
echo "$LARGE"
exit 1
fi
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Audit high-severity vulnerabilities
run: npm audit --audit-level=high
# Reads package-lock.json directly — no extra dependency to install, so
# the license gate itself adds nothing to the supply chain. Currently the
# tree is dev-only (nothing from node_modules ships to Pages), but the
# gate is here so it has teeth the moment you add real dependencies.
- name: Check licenses
run: npm run license:check
# `eslint --cache` writes to .eslintcache at cwd; persist it across
# runs so warm CI lints incrementally instead of rescanning the tree.
- name: Restore ESLint cache
uses: actions/cache@v6
with:
path: .eslintcache
key: eslint-${{ runner.os }}-${{ hashFiles('eslint.config.js', 'package-lock.json') }}-${{ hashFiles('src/**/*.js', 'functions/**/*.js', 'tests/**/*.js') }}
restore-keys: |
eslint-${{ runner.os }}-${{ hashFiles('eslint.config.js', 'package-lock.json') }}-
eslint-${{ runner.os }}-
- name: Lint
run: npm run lint
- name: Test
run: npm test
- name: Build contract
run: npm run build