Skip to content

Commit

Permalink
testing new docker-compose and workflow settings for service
Browse files Browse the repository at this point in the history
  • Loading branch information
aasimsyed committed Apr 23, 2024
1 parent f1a4ffb commit 780480d
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 29 deletions.
57 changes: 34 additions & 23 deletions .github/workflows/pr_ci_frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,65 @@ on:
- main
types: [opened, reopened, synchronize]

env:
NODE_VERSION: '14'

jobs:
frontend:
name: Run PR Frontend Check
runs-on: ubuntu-latest
environment: dev

services:
app: # This is the service for the web server needed for Playwright tests
image: docker-compose.yml
env:
FRONTEND_PORT: ${{ secrets.FRONTEND_PORT }}
BACKEND_PORT: ${{ secrets.BACKEND_PORT }}
DATABASE_PORT: ${{ secrets.DATABASE_PORT }}
DATABASE_HOST: ${{ secrets.DATABASE_HOST }}
DATABASE_NAME: ${{ secrets.DATABASE_NAME }}
DATABASE_USER: ${{ secrets.DATABASE_USER }}
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
DJANGO_ALLOWED_HOSTS: ${{ secrets.DJANGO_ALLOWED_HOSTS }}
DEBUG: ${{ secrets.DEBUG }}
SECRET_KEY: ${{ secrets.SECRET_KEY }}
ports:
- ${{ secrets.FRONTEND_PORT }}:${{ secrets.FRONTEND_PORT }}
options: --env-file .env.dev up --build

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node environment
uses: actions/setup-node@v4

- name: Install Yarn
uses: borales/actions-yarn@v5
with:
cmd: install
dir: "frontend"
node-version: ${{ env.NODE_VERSION }}

- name: Install Prettier
run: yarn add prettier
- name: Install Yarn and dependencies
working-directory: ./frontend
run: yarn install

- name: Run Prettier - Formatting check
working-directory: ./frontend
run: |
yarn prettier . --check --config ../.prettierrc --ignore-path ../.prettierignore
run: yarn prettier . --check --config ../.prettierrc --ignore-path ../.prettierignore

- name: Run Type Check
if: always()
uses: borales/actions-yarn@v4
with:
cmd: nuxi typecheck
dir: "frontend"
working-directory: ./frontend
run: yarn nuxi typecheck

- name: Run eslint - Linting
if: always()
uses: borales/actions-yarn@v4
with:
cmd: eslint . --ext .js,.vue
dir: "frontend"
working-directory: ./frontend
run: yarn eslint . --ext .js,.vue

- name: Install Playwright Browsers
working-directory: ./frontend
run: |
yarn playwright install --with-deps
run: yarn playwright install --with-deps

- name: Run Playwright tests
working-directory: ./frontend
run: |
yarn playwright test
run: yarn playwright test

- name: Upload Playwright report
if: always()
Expand Down
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ services:
- SECRET_KEY=${SECRET_KEY}
depends_on:
- db
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:${BACKEND_PORT}/health/ || exit 1"]
interval: 10s
timeout: 5s
retries: 5

frontend:
env_file:
Expand All @@ -37,6 +42,11 @@ services:
ports:
- "${FRONTEND_PORT}:${FRONTEND_PORT}"
- "24678:24678"
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:${FRONTEND_PORT}/ || exit 1"]
interval: 10s
timeout: 5s
retries: 5

db:
env_file:
Expand All @@ -49,3 +59,8 @@ services:
- POSTGRES_PASSWORD=${DATABASE_PASSWORD}
ports:
- "${DATABASE_PORT}:${DATABASE_PORT}"
healthcheck:
test: ["CMD", "pg_isready", "-U", "${DATABASE_USER}"]
interval: 10s
timeout: 5s
retries: 5
6 changes: 0 additions & 6 deletions frontend/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,4 @@ export default defineConfig({
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
webServer: {
command: "docker compose --env-file ../.env.dev up --build",
port: 3000,
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
},
});

0 comments on commit 780480d

Please sign in to comment.