Skip to content

tmp

tmp #9

Workflow file for this run

name: CLI Integration Tests
on:
push:
branches: [raven/add-test]
paths:
- 'src.ts/**'
- 'package.json'
- 'pnpm-lock.yaml'
- '.github/workflows/cli-test.yml'
pull_request:
branches: [raven/add-test]
paths:
- 'src.ts/**'
- 'package.json'
- 'pnpm-lock.yaml'
- '.github/workflows/cli-test.yml'
workflow_dispatch:
jobs:
test:
name: Test CLI on ${{ matrix.os }} / Node ${{ matrix.node-version }} / ${{ matrix.package-manager.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
node-version: 20.x
package-manager: {name: "pnpm", manager: "pnpm", version: "9.15.4", install: "pnpm install --frozen-lockfile", build: "pnpm build", test: "pnpm test:cli"}
- os: macos-latest
node-version: 20.x
package-manager: {name: "pnpm", manager: "pnpm", version: "9.15.4", install: "pnpm install --frozen-lockfile", build: "pnpm build", test: "pnpm test:cli"}
- os: windows-latest
node-version: 20.x
package-manager: {name: "pnpm", manager: "pnpm", version: "9.15.4", install: "pnpm install --frozen-lockfile", build: "pnpm build", test: "pnpm test:cli"}
- os: ubuntu-latest
node-version: 20.x
package-manager: {name: "npm", manager: "npm", version: "latest", install: "npm install", build: "npm run build", test: "npm run test:cli"}
- os: ubuntu-latest
node-version: 22.x
package-manager: {name: "yarn", manager: "yarn", version: "stable", install: "yarn install", build: "yarn build", test: "yarn test:cli"}
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
if: matrix.package-manager.manager == 'pnpm'
uses: pnpm/action-setup@v2
with:
version: ${{ matrix.package-manager.version }}
- name: Setup Yarn
if: matrix.package-manager.manager == 'yarn'
run: |
# Install Yarn stable (3.x)
corepack enable
corepack prepare yarn@${{ matrix.package-manager.version }} --activate
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: ${{ matrix.package-manager.manager == 'pnpm' && 'pnpm' || null }}
cache-dependency-path: ${{ matrix.package-manager.manager == 'pnpm' && 'pnpm-lock.yaml' || null }}
- name: Install dependencies
run: ${{ matrix.package-manager.install }}
- name: Build project
run: ${{ matrix.package-manager.build }}
- name: Run CLI tests
run: ${{ matrix.package-manager.test }}
env:
ZG_RPC_ENDPOINT: https://evmrpc-testnet.0g.ai
CI: true
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}-node-${{ matrix.node-version }}-${{ matrix.package-manager.name }}
path: |
**/*.log
**/test-results.xml
retention-days: 7
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: test
if: always()
steps:
- name: Check test results
run: |
if [ "${{ needs.test.result }}" == "success" ]; then
echo "✅ All CLI tests passed across all environments!"
exit 0
else
echo "❌ Some CLI tests failed. Check the logs for details."
exit 1
fi
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 9.15.4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build project
run: pnpm build
- name: Run tests with coverage
run: |
pnpm add -D nyc
npx nyc --reporter=lcov --reporter=text pnpm test:cli
env:
ZG_RPC_ENDPOINT: https://evmrpc-testnet.0g.ai
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage/lcov.info
flags: cli-tests
name: cli-coverage
fail_ci_if_error: false