-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (106 loc) · 3.22 KB
/
ci.yml
File metadata and controls
113 lines (106 loc) · 3.22 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 1
lint:
name: Lint & Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npx eslint .
- run: npx prettier --check .
typecheck:
name: Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npx tsc --noEmit
test:
name: Test (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
node-version: [18, 20, 22]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- run: npm test
cli-smoke:
name: CLI Smoke Test
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Run CLI help
run: node bin/pack-config-diff --help
- name: Compare JS fixtures
run: |
rc=0
node bin/pack-config-diff --left=fixtures/webpack.dev.js --right=fixtures/webpack.prod.js --format=summary > /tmp/smoke-js.txt 2>&1 || rc=$?
cat /tmp/smoke-js.txt
if [ "$rc" -gt 1 ]; then echo "::error::CLI crashed (exit code $rc)"; exit 1; fi
if [ ! -s /tmp/smoke-js.txt ]; then echo "::error::CLI produced no output"; exit 1; fi
- name: Compare YAML fixtures
run: |
rc=0
node bin/pack-config-diff --left=fixtures/webpack-development-client.yaml --right=fixtures/webpack-production-client.yaml --format=json > /tmp/smoke-yaml.txt 2>&1 || rc=$?
cat /tmp/smoke-yaml.txt
if [ "$rc" -gt 1 ]; then echo "::error::CLI crashed (exit code $rc)"; exit 1; fi
if [ ! -s /tmp/smoke-yaml.txt ]; then echo "::error::CLI produced no output"; exit 1; fi
- name: Compare with markdown output
run: |
rc=0
node bin/pack-config-diff --left=fixtures/webpack.dev.js --right=fixtures/webpack.prod.js --format=markdown > /tmp/smoke-md.txt 2>&1 || rc=$?
cat /tmp/smoke-md.txt
if [ "$rc" -gt 1 ]; then echo "::error::CLI crashed (exit code $rc)"; exit 1; fi
if [ ! -s /tmp/smoke-md.txt ]; then echo "::error::CLI produced no output"; exit 1; fi