From 35ba9910d40b81409a2ab1656f2461666139a485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Beltra=CC=81n?= Date: Mon, 3 Jun 2024 20:04:05 +0200 Subject: [PATCH] change ci --- .github/workflows/ci.yml | 8 +--- .github/workflows/playwright.yml | 67 +++++++++++++++----------------- 2 files changed, 32 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a60e2d1..ad719d72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,6 @@ name: CI -on: - push: - branches: - - main - pull_request: - branches: - - main +on: [push, pull_request] jobs: build-and-test: diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 1a60e2d1..d1ea0087 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -1,37 +1,12 @@ -name: CI +name: Playwright Tests -on: - push: - branches: - - main - pull_request: - branches: - - main +on: [push, pull_request] jobs: - build-and-test: + build: runs-on: ubuntu-latest - - services: - docker: - image: docker:19.03.12 - options: --privileged - ports: - - 5000:5000 - - 9099:9099 - - 5001:5001 - - 8081:8081 - - 5002:5002 - - 9199:9199 - - 4000:4000 - - 4400:4400 - - 4500:4500 - - 9150:9150 - - 5007:5007 - steps: - - name: Checkout code - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 @@ -44,12 +19,32 @@ jobs: restore-keys: | ${{ runner.os }}-buildx- - - name: Build and run Docker Compose - run: docker-compose -f docker-compose.yml up --abort-on-container-exit --exit-code-from test + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '18.x' - - name: Check Docker Compose Test Result + - name: Build and start services + run: docker-compose up -d --build + + - name: Wait for services to be ready run: | - EXIT_CODE=$(docker inspect test --format='{{.State.ExitCode}}') - if [ "$EXIT_CODE" -ne 0 ]; then - exit $EXIT_CODE - fi + while ! nc -z localhost 5000; do sleep 10; done + while ! nc -z localhost 4000; do sleep 10; done + + - name: Run Playwright tests + run: | + npm ci + npx playwright install --with-deps chromium + npx playwright test + + - name: Upload Playwright report + uses: actions/upload-artifact@v2 + if: ${{ !cancelled() }} + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 + + - name: Stop services + run: docker-compose down