Merge pull request #42 from Codespice1/D-Antonelli/feature/#33-BUG-Si… #72
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: Main workflow | |
on: | |
[push] | |
jobs: | |
# Job for installing dependencies and linting code | |
Lint: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- 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: Cypress run | |
uses: cypress-io/github-action@v6 | |
env: | |
NEXTAUTH_URL: ${{secrets.NEXTAUTH_URL}} | |
STRIPE_KEY: ${{ secrets.STRIPE_KEY }} | |
NEXTAUTH_SECRET: ${{secrets.NEXTAUTH_SECRET}} | |
AUTH_GITHUB_ID: ${{secrets.AUTH_GITHUB_ID}} | |
AUTH_GITHUB_SECRET: ${{secrets.AUTH_GITHUB_SECRET}} | |
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 | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
run: npx playwright test | |
- name: Upload Playwright Report | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
# Job for running unit tests and uploading coverage report | |
Unit-Tests: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- 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 unit tests | |
run: npm run test | |
- name: Upload coverage to Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |