Skip to content

Jitosol

Jitosol #1448

Workflow file for this run

name: Node.js Build and Test
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
lint-and-verify-cli:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Copy .env.example to .env
run: cp .env.example .env
- name: Install dependencies
run: npm ci
- name: Verify tsc config
run: npm run test:tsc
- name: Verify there are no linting and formatting errors
run: npm run lint
- name: Build
run: npm run build
- name: Create new adapter with new CLI
run: |
npm run new-adapter -- -y -t "Smart Adapter Builder"
npm run build
npm run new-adapter -- -y -t "VotingEscrowAdapter (like curve and stargate voting escrow)"
npm run build
npm run new-adapter -- -y -t UniswapV2PoolForkAdapter
npm run build
npm run new-adapter -- -y -t "WriteOnlyDeFiAdapter (supports only create transaction params, no getPositions features)"
npm run build
generate-protocol-matrix:
runs-on: ubuntu-latest
outputs:
protocol-matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Copy .env.example to .env
run: cp .env.example .env
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- id: set-matrix
run: |
MATRIX=$(npm run -s support | jq -r 'keys | @json')
echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT"
env:
DEFI_ADAPTERS_LOG_LEVEL: silent # Suppress logs during execution
integration-tests:
needs: generate-protocol-matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
protocol: ${{ fromJson(needs.generate-protocol-matrix.outputs.protocol-matrix) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- run: echo ${{ fromJson(needs.generate-protocol-matrix.outputs.protocol-matrix) }}
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run tests
run: npm run test:integration --protocolid=${{ matrix.protocol }}
env:
DEFI_ADAPTERS_PROVIDER_ETHEREUM: ${{ secrets.ETHEREUM_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_OPTIMISM: ${{ secrets.OPTIMISM_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_BSC: ${{ secrets.BSC_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_POLYGON: ${{ secrets.POLYGON_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_FANTOM: ${{ secrets.FANTOM_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_BASE: ${{ secrets.BASE_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_ARBITRUM: ${{ secrets.ARBITRUM_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_AVALANCHE: ${{ secrets.AVALANCHE_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_LINEA: ${{ secrets.LINEA_PROVIDER_URL }}
DEFI_ADAPTERS_LOG_LEVEL: warn
run-unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run tests
run: npm run test:cov
env:
DEFI_ADAPTERS_PROVIDER_ETHEREUM: ${{ secrets.ETHEREUM_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_OPTIMISM: ${{ secrets.OPTIMISM_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_BSC: ${{ secrets.BSC_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_POLYGON: ${{ secrets.POLYGON_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_FANTOM: ${{ secrets.FANTOM_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_BASE: ${{ secrets.BASE_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_ARBITRUM: ${{ secrets.ARBITRUM_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_AVALANCHE: ${{ secrets.AVALANCHE_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_LINEA: ${{ secrets.LINEA_PROVIDER_URL }}
DEFI_ADAPTERS_LOG_LEVEL: warn
- name: Run sonarcloud-scan
uses: sonarsource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
detect-errors-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run tests
run: npm run test:detect-errors -w packages/adapters-library
env:
DEFI_ADAPTERS_PROVIDER_ETHEREUM: ${{ secrets.ETHEREUM_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_OPTIMISM: ${{ secrets.OPTIMISM_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_BSC: ${{ secrets.BSC_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_POLYGON: ${{ secrets.POLYGON_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_FANTOM: ${{ secrets.FANTOM_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_BASE: ${{ secrets.BASE_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_ARBITRUM: ${{ secrets.ARBITRUM_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_AVALANCHE: ${{ secrets.AVALANCHE_PROVIDER_URL }}
DEFI_ADAPTERS_PROVIDER_LINEA: ${{ secrets.LINEA_PROVIDER_URL }}
DEFI_ADAPTERS_LOG_LEVEL: warn