Skip to content

Commit

Permalink
new approach to building docker container for e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Barukimang committed Jan 23, 2024
1 parent 2cdabb6 commit ce22213
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/e2e-tests-v3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: E2E Tests Workflow

on:
pull_request:
types:
- labeled

jobs:
e2e-tests:
if: ${{ github.event.label.name == 'e2e-tests-3' }}
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# - name: Login to Docker Registry
# uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Run Docker Container
run: |
docker build -t aragonapp-e2e -f Dockerfile .
docker run -d -p 3000:3000 --name aragonapp myapp-e2e
env:
VITE_REACT_APP_DEPLOY_VERSION: ${{ github.sha }}
VITE_REACT_APP_DEPLOY_ENVIRONMENT: ${{ needs.setup-env-vars.outputs.environment }}
VITE_REACT_APP_ANALYTICS_KEY: ${{ secrets.VITE_REACT_APP_ANALYTICS_KEY }}
VITE_IPFS_API_KEY: ${{ secrets.VITE_IPFS_API_KEY }}
VITE_ETHERSCAN_API_KEY: ${{ secrets.VITE_ETHERSCAN_API_KEY }}
VITE_POLYGONSCAN_API_KEY: ${{secrets.VITE_POLYGONSCAN_API_KEY}}
VITE_INFURA_GOERLI_PROJECT_ID: ${{ secrets.VITE_INFURA_GOERLI_PROJECT_ID }}
VITE_INFURA_MAINNET_PROJECT_ID: ${{ secrets.VITE_INFURA_MAINNET_PROJECT_ID }}
VITE_INFURA_API_KEY: ${{ secrets.VITE_INFURA_API_KEY }}
VITE_WALLET_CONNECT_PROJECT_ID: ${{ secrets.VITE_WALLET_CONNECT_PROJECT_ID }}
VITE_ALCHEMY_KEY_POLYGON_MUMBAI: ${{ secrets.VITE_ALCHEMY_KEY_POLYGON_MUMBAI }}
VITE_ALCHEMY_KEY_POLYGON_MAINNET: ${{ secrets.VITE_ALCHEMY_KEY_POLYGON_MUMBAI }}
VITE_ALCHEMY_KEY_MAINNET: ${{ secrets.VITE_ALCHEMY_KEY_MAINNET }}
VITE_ALCHEMY_KEY_GOERLI: ${{ secrets.VITE_ALCHEMY_KEY_GOERLI }}
VITE_COVALENT_API_KEY: ${{secrets.VITE_COVALENT_API_KEY}}
NODE_OPTIONS: '--max-old-space-size=6656'
PRIVATE_KEY: '81ce9e0a6df4f2dbf667830614bfa162d5aa4ef4992362911dc8d14ea53a31e1'

- name: Execute E2E Tests
run: |
docker exec aragonapp npx synpress run --configFile synpress.config.js --record --key 0c4de406-82ab-48c2-94b1-6267578d2f33
env:
NODE_OPTIONS: '--max-old-space-size=6656'
PRIVATE_KEY: '81ce9e0a6df4f2dbf667830614bfa162d5aa4ef4992362911dc8d14ea53a31e1'

- name: Cleanup
if: always()
run: |
docker stop aragonapp
docker rm aragonapp
33 changes: 33 additions & 0 deletions Dockerfile.e2e.tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Use an official Node runtime as the base image
FROM node:18

# Set the working directory in the container
WORKDIR /usr/src/app

# Copy package.json and package-lock.json (or yarn.lock)
# COPY package*.json ./
# Alternatively, for Yarn, use:
COPY package.json yarn.lock ./

# Install app dependencies
# RUN npm install
# For Yarn, use:
RUN yarn install

# Bundle app source inside the Docker image
COPY . .

# Build the app (if necessary)
# RUN npm run build
# For Yarn, use:
RUN yarn build

# Your app binds to port 3000 so you'll use the EXPOSE instruction to have it mapped by the docker daemon
EXPOSE 3000

# Define the command to run your app using CMD which defines your runtime
# CMD ["npm", "start"]
# For Yarn, use:
CMD ["yarn", "start"]

# The E2E tests can be run by overriding the CMD when starting the container

0 comments on commit ce22213

Please sign in to comment.