1+ name : CLI Integration Tests
2+
3+ on :
4+ push :
5+ branches : [raven/add-test]
6+ paths :
7+ - ' src.ts/**'
8+ - ' package.json'
9+ - ' pnpm-lock.yaml'
10+ - ' .github/workflows/cli-test.yml'
11+ pull_request :
12+ branches : [raven/add-test]
13+ paths :
14+ - ' src.ts/**'
15+ - ' package.json'
16+ - ' pnpm-lock.yaml'
17+ - ' .github/workflows/cli-test.yml'
18+ workflow_dispatch :
19+
20+ jobs :
21+ test :
22+ name : Test CLI on ${{ matrix.os }} / Node ${{ matrix.node-version }} / ${{ matrix.package-manager.name }}
23+ runs-on : ${{ matrix.os }}
24+
25+ strategy :
26+ matrix :
27+ include :
28+ - os : ubuntu-latest
29+ node-version : 20.x
30+ package-manager : {name: "pnpm", manager: "pnpm", version: "9.15.4", install: "pnpm install --frozen-lockfile", build: "pnpm build", test: "pnpm test:cli"}
31+ - os : macos-latest
32+ node-version : 20.x
33+ package-manager : {name: "pnpm", manager: "pnpm", version: "9.15.4", install: "pnpm install --frozen-lockfile", build: "pnpm build", test: "pnpm test:cli"}
34+ - os : windows-latest
35+ node-version : 20.x
36+ package-manager : {name: "pnpm", manager: "pnpm", version: "9.15.4", install: "pnpm install --frozen-lockfile", build: "pnpm build", test: "pnpm test:cli"}
37+
38+ - os : ubuntu-latest
39+ node-version : 20.x
40+ package-manager : {name: "npm", manager: "npm", version: "10.x", install: "npm ci", build: "npm run build", test: "npm run test:cli"}
41+ - os : ubuntu-latest
42+ node-version : 22.x
43+ package-manager : {name: "yarn", manager: "yarn", version: "3.x", install: "yarn install --frozen-lockfile", build: "yarn build", test: "yarn test:cli"}
44+ fail-fast : false
45+
46+ steps :
47+ - name : Checkout code
48+ uses : actions/checkout@v4
49+
50+ - name : Setup pnpm
51+ if : matrix.package-manager.manager == 'pnpm'
52+ uses : pnpm/action-setup@v2
53+ with :
54+ version : ${{ matrix.package-manager.version }}
55+
56+ - name : Setup Yarn
57+ if : matrix.package-manager.manager == 'yarn'
58+ uses : actions/setup-node@v4
59+ with :
60+ node-version : ${{ matrix.node-version }}
61+
62+ - name : Install Yarn
63+ if : matrix.package-manager.manager == 'yarn'
64+ run : corepack enable && yarn set version ${{ matrix.package-manager.version }}
65+
66+ - name : Setup Node.js ${{ matrix.node-version }}
67+ uses : actions/setup-node@v4
68+ with :
69+ node-version : ${{ matrix.node-version }}
70+ cache : ${{ matrix.package-manager.manager }}
71+ cache-dependency-path : |
72+ ${{ matrix.package-manager.manager == 'pnpm' && 'pnpm-lock.yaml' || '' }}
73+ ${{ matrix.package-manager.manager == 'npm' && 'package-lock.json' || '' }}
74+ ${{ matrix.package-manager.manager == 'yarn' && 'yarn.lock' || '' }}
75+
76+ - name : Install dependencies
77+ run : ${{ matrix.package-manager.install }}
78+
79+ - name : Build project
80+ run : ${{ matrix.package-manager.build }}
81+
82+ - name : Run CLI tests
83+ run : ${{ matrix.package-manager.test }}
84+ env :
85+ ZG_RPC_ENDPOINT : https://evmrpc-testnet.0g.ai
86+ CI : true
87+
88+ - name : Upload test results
89+ if : failure()
90+ uses : actions/upload-artifact@v4
91+ with :
92+ name : test-results-${{ matrix.os }}-node-${{ matrix.node-version }}-${{ matrix.package-manager.name }}
93+ path : |
94+ **/*.log
95+ **/test-results.xml
96+ retention-days : 7
97+
98+ test-summary :
99+ name : Test Summary
100+ runs-on : ubuntu-latest
101+ needs : test
102+ if : always()
103+
104+ steps :
105+ - name : Check test results
106+ run : |
107+ if [ "${{ needs.test.result }}" == "success" ]; then
108+ echo "✅ All CLI tests passed across all environments!"
109+ exit 0
110+ else
111+ echo "❌ Some CLI tests failed. Check the logs for details."
112+ exit 1
113+ fi
114+
115+ coverage :
116+ name : Code Coverage
117+ runs-on : ubuntu-latest
118+
119+ steps :
120+ - name : Checkout code
121+ uses : actions/checkout@v4
122+
123+ - name : Setup pnpm
124+ uses : pnpm/action-setup@v2
125+ with :
126+ version : 9.15.4
127+
128+ - name : Setup Node.js
129+ uses : actions/setup-node@v4
130+ with :
131+ node-version : 20.x
132+ cache : ' pnpm'
133+
134+ - name : Install dependencies
135+ run : pnpm install --frozen-lockfile
136+
137+ - name : Build project
138+ run : pnpm build
139+
140+ - name : Run tests with coverage
141+ run : |
142+ pnpm add -D nyc
143+ npx nyc --reporter=lcov --reporter=text pnpm test:cli
144+ env :
145+ ZG_RPC_ENDPOINT : https://evmrpc-testnet.0g.ai
146+
147+ - name : Upload coverage to Codecov
148+ uses : codecov/codecov-action@v4
149+ with :
150+ file : ./coverage/lcov.info
151+ flags : cli-tests
152+ name : cli-coverage
153+ fail_ci_if_error : false
0 commit comments