[Snyk] Security upgrade web3 from 1.10.2 to 4.0.1 #33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD | |
| on: | |
| push: | |
| branches: [ main, master, develop ] | |
| pull_request: | |
| branches: [ main, master, develop ] | |
| env: | |
| NODE_ENV: test | |
| jobs: | |
| lint: | |
| name: Code Quality & Linting | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run Solidity Linter | |
| run: npm run lint:sol | |
| - name: Run ESLint | |
| run: npm run lint | |
| - name: Check Prettier formatting | |
| run: npx prettier '**/*.{json,sol,md,ts,js}' --check | |
| compile: | |
| name: Compile Contracts | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Compile Solidity contracts | |
| run: npm run compile | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: contract-artifacts | |
| path: | | |
| artifacts/ | |
| src/contracts/ | |
| retention-days: 1 | |
| test: | |
| name: Test (Node ${{ matrix.node-version }}) | |
| runs-on: ubuntu-latest | |
| needs: [compile] | |
| strategy: | |
| matrix: | |
| node-version: [18, 20] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: contract-artifacts | |
| path: ./ | |
| - name: Run tests | |
| run: npm run test | |
| - name: Generate coverage report | |
| if: matrix.node-version == '20' | |
| run: npm run coverage | |
| continue-on-error: true | |
| - name: Upload coverage reports | |
| if: matrix.node-version == '20' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: coverage/ | |
| retention-days: 7 | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| if: matrix.node-version == '20' | |
| with: | |
| file: ./coverage/lcov.info | |
| fail_ci_if_error: false | |
| build: | |
| name: Build Package | |
| runs-on: ubuntu-latest | |
| needs: [lint, compile, test] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: contract-artifacts | |
| path: ./ | |
| - name: Build TypeScript | |
| run: npm run build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: | | |
| dist/ | |
| artifacts/ | |
| retention-days: 7 | |
| security: | |
| name: Security Audit | |
| runs-on: ubuntu-latest | |
| needs: [compile] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Run npm audit | |
| run: npm audit --audit-level=high | |
| continue-on-error: true | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: contract-artifacts | |
| path: ./ | |
| - name: Run Slither Analysis | |
| uses: crytic/slither-action@v0.3.0 | |
| id: slither | |
| with: | |
| target: 'contracts/' | |
| slither-config: .slither.conf.json | |
| continue-on-error: true |