Merge pull request #5 from adrianrbp/4-frontend-company-service-avail… #23
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: test | |
on: push | |
jobs: | |
backend: | |
name: 'Rails API Tests' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.3.4' | |
- name: Install dependencies | |
run: | | |
cd backend | |
bundle install | |
- name: Run Rails tests | |
run: | | |
cd backend | |
bin/rails test | |
frontend: | |
name: 'Vue Frontend Tests' | |
runs-on: ubuntu-latest | |
needs: backend # Ensure frontend tests run after backend tests | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '21' | |
- name: Install dependencies | |
run: | | |
cd frontend | |
yarn install | |
- name: Run Jest tests | |
run: | | |
cd frontend | |
yarn test:unit --ci --reporters=default --reporters=jest-junit | |
- name: Upload Jest Test Report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: jest-test-report | |
path: frontend/junit.xml | |
# - name: Display Jest Test Results | |
# uses: dorny/test-reporter@v1 | |
# if: always() # Run this step even if previous steps fail | |
# with: | |
# name: Jest Tests | |
# path: frontend/junit.xml | |
# reporter: jest-junit | |
# - name: Start Rails server | |
# run: | | |
# cd backend | |
# bin/rails server -e test & # Run the server in the background | |
# - name: Wait for Rails server to be ready | |
# run: | | |
# until curl -s http://localhost:3000 > /dev/null; do | |
# echo "Waiting for Rails server..." | |
# sleep 2 | |
# done | |
end-to-end: | |
name: 'End to End Tests' | |
runs-on: ubuntu-latest | |
container: | |
image: mcr.microsoft.com/playwright:v1.45.1-jammy | |
needs: [backend, frontend] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
- name: Install dependencies | |
run: | | |
cd frontend | |
yarn install | |
# - name: Install Playwright Browsers | |
# run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
run: | | |
cd frontend | |
yarn test:e2e | |
- name: Upload Playwright HTML Test Report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: playwright-report | |
path: frontend/playwright-report | |
- name: Upload Playwright Test Report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: playwright-report | |
path: frontend/playwright-tests.xml | |
# - name: Display Playwright Test Results | |
# uses: dorny/test-reporter@v1 | |
# if: always() # Run this step even if previous steps fail | |
# with: | |
# name: Playwright Tests | |
# path: frontend/playwright-tests.xml | |
# reporter: java-junit | |