Skip to content

[REFACTOR AND UPGRADE] Rainbowkit -> Web3Modal #988

[REFACTOR AND UPGRADE] Rainbowkit -> Web3Modal

[REFACTOR AND UPGRADE] Rainbowkit -> Web3Modal #988

Workflow file for this run

name: E2E Tests
on:
push:
branches:
- develop
pull_request:
jobs:
playwright:
timeout-minutes: 30
runs-on: ubuntu-latest
environment: dev
steps:
# Checkout the repository
- name: Checkout
uses: actions/checkout@v3
# Set up the required Node.js version
- name: Set up node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
# Create an environment file with sensitive information
- name: Create env file
working-directory: ./docker
run: echo NEXT_PUBLIC_ALCHEMY_TESTING_API_KEY=${{ secrets.NEXT_PUBLIC_ALCHEMY_TESTING_API_KEY }} >> .env.tests.local
# Set up Docker Buildx for building Docker images with cache support
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
# Cache Docker layers for the blockchain service
- name: Cache Docker layers for blockchain
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache-blockchain
key: ${{ runner.os }}-buildx-blockchain-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-blockchain-
# Build the Docker image for the blockchain service using Buildx and cache
- name: Build Docker image for blockchain
uses: docker/build-push-action@v4
with:
context: docker/blockchain
file: docker/blockchain/Dockerfile
load: true
tags: blockchain:latest
builder: ${{ steps.buildx.outputs.name }}
cache-from: type=local,src=/tmp/.buildx-cache-blockchain
cache-to: type=local,dest=/tmp/.buildx-cache-blockchain,mode=max
# Cache Docker layers for the webapp service
- name: Cache Docker layers for webapp
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache-webapp
key: ${{ runner.os }}-buildx-webapp-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-webapp-
# Build the Docker image for the webapp service using Buildx and cache
- name: Build Docker image for webapp
uses: docker/build-push-action@v4
with:
context: .
file: docker/webapp/Dockerfile
load: true
tags: webapp:latest
builder: ${{ steps.buildx.outputs.name }}
cache-from: type=local,src=/tmp/.buildx-cache-webapp
cache-to: type=local,dest=/tmp/.buildx-cache-webapp,mode=max
# Run the blockchain Docker container
- name: Run blockchain container
run: docker run -d --name blockchain -p 8545:8545 --env-file ./docker/.env.tests.local blockchain:latest
# Run the webapp Docker container
- name: Run webapp container
run: docker run -d --name webapp -p 3000:3000 -e NEXT_PUBLIC_TESTING_ENVIRONMENT=true -e NEXT_PUBLIC_LOCAL_CHAIN_ID=31337 -e NEXT_PUBLIC_LOCAL_PROVIDER_URL=http://0.0.0.0:8545 webapp:latest
# Remove existing package.json and package-lock.json, then create a new package.json
- name: remove package.json
run: |
rm package.json
rm package-lock.json
npm init -y
# Install Node.js dependencies for Playwright
- name: Install Node.js dependencies
run: npm i -D @playwright/test playwright
# Cache Playwright browsers for faster future runs
- name: Cache Playwright Browsers
id: cache-playwright
uses: actions/cache@v3
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('**/playwright.config.js') }}
restore-keys: |
${{ runner.os }}-playwright-
# Install Playwright dependencies if the cache is hit
- name: Install Playwright Dependencies
if: steps.cache-playwright.outputs.cache-hit == 'true'
run: |
npx playwright install-deps
# Install Playwright browsers and dependencies if the cache is not hit
- name: Install Playwright Browsers and Dependencies
if: steps.cache-playwright.outputs.cache-hit != 'true'
run: |
npx playwright install --with-deps
# Wait for the development server to start before running tests
- name: Wait for Development Server
uses: nev7n/wait_for_response@v1
with:
url: 'http://localhost:3000'
responseCode: 200
timeout: 300000
# Run Playwright tests
- name: Run Playwright tests
run: npx playwright test
# Upload Playwright report as an artifact
- name: Upload Playwright report
uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
# Stop and remove Docker containers after tests are completed
- name: Stop containers
if: always()
run: |
docker stop webapp
docker rm webapp
docker stop blockchain
docker rm blockchain