Skip to content

Globally Replace WSOL with SOL #3308

Globally Replace WSOL with SOL

Globally Replace WSOL with SOL #3308

Workflow file for this run

name: Build
on:
pull_request:
push:
branches:
- development
- staging
- production
- mainnet
jobs:
check-sdn-list:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run script
run: npm i prettier && npm run checksdn
working-directory: ./
check-token-list:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
tokens:
- 'src/config/mainnet/wrappedTokens.ts'
- 'src/config/testnet/wrappedTokens.ts'
- uses: actions/setup-node@v4
if: steps.filter.outputs.tokens == 'true' || github.ref == 'refs/heads/development'
with:
node-version: 22
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- run: npm ci
if: steps.filter.outputs.tokens == 'true' || github.ref == 'refs/heads/development'
working-directory: ./
- run: npm run checkForeignAssets
if: steps.filter.outputs.tokens == 'true' || github.ref == 'refs/heads/development'
working-directory: ./
build-hosted:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- run: npm ci
working-directory: ./
- run: npm run build:hosted
working-directory: ./
build-library:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- run: npm ci
working-directory: ./
- name: Build Lib
run: npm run build:lib 2>&1 | tee build-output.txt
working-directory: ./
- name: Check bundle sizes
run: |
echo "Checking JS bundle sizes..."
SIZE_LIMIT_KB=1024 # 1MB in KB
# Create a temporary file to store large bundles
touch /tmp/large_bundles
# Find all JS files and their gzip sizes
grep "\.js.*│.*gzip:" build-output.txt | while read -r line; do
# Extract filename and size, stripping ANSI color codes
filename=$(echo "$line" | awk '{print $1}' | sed 's/\x1b\[[0-9;]*m//g')
size_kb=$(echo "$line" | grep -o 'gzip:.*kB' | grep -o '[0-9,.]*' | tr -d ',' | bc)
if (( $(echo "$size_kb > $SIZE_LIMIT_KB" | bc -l) )); then
size_mb=$(echo "scale=2; $size_kb/1024" | bc)
echo "${filename}|${size_mb}" >> /tmp/large_bundles
fi
done
if [ -s /tmp/large_bundles ]; then
# Construct the bundle list message
bundle_list=""
while IFS='|' read -r filename size; do
bundle_list="${bundle_list}• ${filename}: ${size}MB gzipped%0A"
done < /tmp/large_bundles
# Output the consolidated error message
echo "::error file=package.json,line=1,title=Large Bundles Detected::The following bundles exceed the 1MB size limit:%0A${bundle_list}%0AOptimization suggestions:%0A• Use dynamic imports and/or React.lazy for better code splitting%0A• Analyze your bundle with 'npm run analyze' to identify large dependencies%0A• Review and remove unused exports/imports"
# Uncomment the next line to fail the build if a large bundle is found
# exit 1
fi
rm -f /tmp/large_bundles
working-directory: ./