mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
132 lines
3.7 KiB
YAML
132 lines
3.7 KiB
YAML
name: Run tests
|
|
|
|
on: pull_request
|
|
|
|
jobs:
|
|
unit-test:
|
|
name: Run unit tests and linting
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "lts/*"
|
|
|
|
- name: Setup safe-chain
|
|
run: curl -fsSL https://github.com/AikidoSec/safe-chain/releases/latest/download/install-safe-chain.sh | sh -s -- --ci
|
|
shell: bash
|
|
|
|
- name: Install dependencies
|
|
run: npm ci --ignore-scripts
|
|
|
|
- name: Run unit tests
|
|
run: npm test
|
|
|
|
- name: Run linting
|
|
run: npm run lint
|
|
|
|
- name: Type check
|
|
run: npm run typecheck --workspace=packages/safe-chain
|
|
|
|
- name: Create package tarball
|
|
if: matrix.os == 'ubuntu-latest'
|
|
run: npm pack --workspace=packages/safe-chain
|
|
|
|
- name: Upload package tarball
|
|
uses: actions/upload-artifact@v4
|
|
if: matrix.os == 'ubuntu-latest'
|
|
with:
|
|
name: safe-chain-package
|
|
path: aikidosec-safe-chain-*.tgz
|
|
|
|
e2e-tests:
|
|
name: Run E2E tests
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
# Common production setup
|
|
- node_version: "20"
|
|
npm_version: "10.2.0"
|
|
yarn_version: "4.0.0"
|
|
pnpm_version: "9.0.0"
|
|
# Current Active LTS with latest tools
|
|
- node_version: "22"
|
|
npm_version: "latest"
|
|
yarn_version: "latest"
|
|
pnpm_version: "latest"
|
|
# Legacy support (EOL April 2025)
|
|
- node_version: "18"
|
|
npm_version: "9.0.0"
|
|
yarn_version: "3.6.0"
|
|
pnpm_version: "8.0.0"
|
|
# Mixed versions (old npm, new package managers)
|
|
- node_version: "20"
|
|
npm_version: "9.0.0"
|
|
yarn_version: "latest"
|
|
pnpm_version: "latest"
|
|
# Version pinning scenario
|
|
- node_version: "22"
|
|
npm_version: "10.2.0"
|
|
yarn_version: "4.0.0"
|
|
pnpm_version: "9.0.0"
|
|
# Backward compatibility testing
|
|
- node_version: "18"
|
|
npm_version: "latest"
|
|
yarn_version: "latest"
|
|
pnpm_version: "latest"
|
|
# Future compatibility (becomes LTS October 2025)
|
|
- node_version: "24"
|
|
npm_version: "latest"
|
|
yarn_version: "latest"
|
|
pnpm_version: "latest"
|
|
# EOL compatibility - Node 16 (EOL sept 2023)
|
|
- node_version: "16"
|
|
npm_version: "8.0.0"
|
|
yarn_version: "1.22.0"
|
|
pnpm_version: "8.0.0"
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "lts/*"
|
|
|
|
- name: Setup safe-chain
|
|
run: curl -fsSL https://github.com/AikidoSec/safe-chain/releases/latest/download/install-safe-chain.sh | sh -s -- --ci
|
|
|
|
- name: Install dependencies (root)
|
|
run: |
|
|
cp npm-shrinkwrap.json packages/safe-chain/
|
|
npm ci
|
|
|
|
- name: Run E2E tests
|
|
env:
|
|
NODE_VERSION: ${{ matrix.node_version }}
|
|
NPM_VERSION: ${{ matrix.npm_version }}
|
|
YARN_VERSION: ${{ matrix.yarn_version }}
|
|
PNPM_VERSION: ${{ matrix.pnpm_version }}
|
|
run: npm run test:e2e
|
|
|
|
- name: Clean up Docker resources
|
|
if: always()
|
|
run: |
|
|
# Clean up any remaining containers and images
|
|
docker ps -aq --filter "name=safe-chain-e2e-test" | xargs -r docker rm -f
|
|
docker images -q safe-chain-e2e-test | xargs -r docker rmi -f
|