sp/sumr-main-page-content-v1 (#588) #1773
This file contains 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 - Build and Unit Test | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
push: | |
branches: | |
- main | |
- dev | |
jobs: | |
build: | |
name: Build and Unit Test | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
env: | |
CONFIG_URL: ${{ secrets.CONFIG_URL }} | |
CONFIG_URL_RAYS: ${{ secrets.CONFIG_URL_RAYS }} | |
BORROW_DB_READ_CONNECTION_STRING: ${{ secrets.NEW_BORROW_DB_READ_CONNECTION_STRING }} | |
CONTENTFUL_ACCESS_TOKEN: ${{ secrets.CONTENTFUL_ACCESS_TOKEN }} | |
CONTENTFUL_PREVIEW_ACCESS_TOKEN: ${{ secrets.CONTENTFUL_PREVIEW_ACCESS_TOKEN }} | |
CONTENTFUL_SPACE_ID: ${{ secrets.CONTENTFUL_SPACE_ID }} | |
MIXPANEL_KEY: ${{ secrets.MIXPANEL_KEY }} | |
NEXT_PUBLIC_MIXPANEL_KEY: ${{ secrets.NEXT_PUBLIC_MIXPANEL_KEY }} | |
SUBGRAPH_BASE: ${{ secrets.SUBGRAPH_BASE }} | |
SDK_API_URL: ${{ secrets.SDK_API_URL }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Set up turbo cache | |
uses: rharkor/[email protected] | |
- uses: pnpm/[email protected] | |
with: | |
version: 8.14.1 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: Setup Earn Protocol App Next.js Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/apps/earn-protocol/.next/cache | |
key: | |
${{ runner.os }}-earn-protocol-app-${{ hashFiles('pnpm-lock.yaml') }}-${{ | |
hashFiles('apps/earn-protocol/**/*.ts', 'apps/earn-protocol/**/*.tsx') }} | |
restore-keys: ${{ runner.os }}-earn-protocol-app-${{ hashFiles('pnpm-lock.yaml') }}- | |
- name: Setup Earn Protocol LP App Next.js Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/apps/earn-protocol-landing-page/.next/cache | |
key: | |
${{ runner.os }}-earn-protocol-landing-page-app-${{ hashFiles('pnpm-lock.yaml') }}-${{ | |
hashFiles('apps/earn-protocol-landing-page/**/*.ts', | |
'apps/earn-protocol-landing-page/**/*.tsx') }} | |
restore-keys: | |
${{ runner.os }}-earn-protocol-landing-page-app-${{ hashFiles('pnpm-lock.yaml') }}- | |
- name: Setup Rays Dashboard App Next.js Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/apps/rays-dashboard/.next/cache | |
key: | |
${{ runner.os }}-rays-dashboard-app-${{ hashFiles('pnpm-lock.yaml') }}-${{ | |
hashFiles('apps/rays-dashboard/**/*.ts', 'apps/rays-dashboard/**/*.tsx') }} | |
restore-keys: ${{ runner.os }}-rays-dashboard-app-${{ hashFiles('pnpm-lock.yaml') }}- | |
- name: Establish VPN connection | |
run: | | |
sudo apt update | |
sudo apt install -y openvpn openvpn-systemd-resolved | |
echo 'Configuring the VPN...' | |
echo "${{ secrets.NEW_VPN_CONFIG }}" > vpn-config.ovpn | |
echo "${{ secrets.NEW_VPN_USERNAME }}" > vpn-credentials.txt | |
echo "${{ secrets.NEW_VPN_PASSWORD }}" >> vpn-credentials.txt | |
echo 'Connecting to the VPN...' | |
sudo openvpn --config vpn-config.ovpn --auth-user-pass vpn-credentials.txt --daemon | |
sleep 10 | |
- name: Check VPN connection | |
env: | |
BORROW_DB_READ_DB: ${{ secrets.NEW_BORROW_DB_READ_DB }} | |
BORROW_DB_READ_HOST: ${{ secrets.NEW_BORROW_DB_READ_HOST }} | |
BORROW_DB_READ_USER: ${{ secrets.NEW_BORROW_DB_READ_USER }} | |
BORROW_DB_READ_PASSWORD: ${{ secrets.NEW_BORROW_DB_READ_PASSWORD }} | |
PGCONNECT_TIMEOUT: 10 | |
run: | | |
echo 'Checking the VPN connection...' | |
sudo systemctl start postgresql.service | |
PGPASSWORD=$BORROW_DB_READ_PASSWORD /usr/bin/psql -d $BORROW_DB_READ_DB -U $BORROW_DB_READ_USER -h $BORROW_DB_READ_HOST -c 'SELECT 1;' > /dev/null | |
STATUS_CODE=$? | |
if ! [[ "$STATUS_CODE" = 0 ]]; then | |
echo 'VPN connection failed' | |
exit 1 | |
fi | |
echo 'VPN connected!' | |
- name: Install dependencies | |
run: pnpm install | |
# there was build and prebuild step here, but it was removed | |
# because test/lint/format tasks are dependent on the build step | |
- name: Test | |
run: pnpm test | |
env: | |
ONE_INCH_API_KEY: ${{ secrets.ONE_INCH_API_KEY }} | |
ONE_INCH_API_VERSION: ${{ secrets.ONE_INCH_API_VERSION }} | |
ONE_INCH_API_URL: ${{ secrets.ONE_INCH_API_URL }} | |
ONE_INCH_API_SPOT_KEY: ${{ secrets.ONE_INCH_API_SPOT_KEY }} | |
ONE_INCH_API_SPOT_VERSION: ${{ secrets.ONE_INCH_API_SPOT_VERSION }} | |
ONE_INCH_API_SPOT_URL: ${{ secrets.ONE_INCH_API_SPOT_URL }} | |
ONE_INCH_ALLOWED_SWAP_PROTOCOLS: ${{ secrets.ONE_INCH_ALLOWED_SWAP_PROTOCOLS }} | |
ONE_INCH_SWAP_CHAIN_IDS: ${{ secrets.ONE_INCH_SWAP_CHAIN_IDS }} | |
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }} | |
- name: Lint | |
run: pnpm lint | |
- name: Format | |
run: pnpm format | |
- name: Coverage | |
run: pnpm coverage:total | |
- name: Upload results to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |