Skip to content

Commit

Permalink
updates main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
D-Antonelli committed Aug 19, 2024
1 parent 9cd991e commit a18da38
Showing 1 changed file with 79 additions and 11 deletions.
90 changes: 79 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,60 @@ on:
[push]

jobs:
build_and_test:
# Job for installing dependencies and linting code
Lint:
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Cache Node.js modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci

- name: Code linting
run: npm run lint

# Job for building and running tests
End-to-end-Tests:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Cache Node.js modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci

- name: Build the project
run: npm run build

- name: Cypress run
uses: cypress-io/github-action@v6
env:
Expand All @@ -23,31 +69,53 @@ jobs:
GOOGLE_CLIENT_ID: ${{secrets.GOOGLE_CLIENT_ID}}
GOOGLE_CLIENT_SECRET: ${{secrets.GOOGLE_CLIENT_SECRET}}
with:
build: npm run build
start: npm start
spec: |
cypress/e2e/*.cy.ts
build: npm run build
start: npm start
spec: |
cypress/e2e/*.cy.ts
- name: Install Playwright Browsers
run: npx playwright install --with-deps

- name: Run Playwright tests
run: npx playwright test

- uses: actions/upload-artifact@v4
- name: Upload Playwright Report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 30

- name: Code linting
run: npm run lint
# Job for running unit tests and uploading coverage report
Unit-Tests:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Cache Node.js modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci

- name: Run tests and collect coverage
- name: Run unit tests
run: npm run test

- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}

0 comments on commit a18da38

Please sign in to comment.