Skip to content

Commit

Permalink
Merge pull request #75 from avantifellows/feature/ci
Browse files Browse the repository at this point in the history
[36] Continuous integration with E2E Testing
  • Loading branch information
Drish-xD authored Sep 2, 2024
2 parents 7686458 + 6758dec commit b3affa1
Show file tree
Hide file tree
Showing 23 changed files with 3,001 additions and 664 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Code Checks

on:
pull_request:
push:
branches: [main]

jobs:
large-files:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check for large files
uses: ppremk/[email protected]
with:
filesizelimit: 5MB

quality-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Install dependencies
run: npm install

- name: Check ESLint
run: npm run lint:check

# TODO: Uncomment when code is formated by Prettier
# - name: Check Prettier
# run: npm run format:check
15 changes: 0 additions & 15 deletions .github/workflows/ci.yml

This file was deleted.

77 changes: 77 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Tests

on:
workflow_run:
workflows: ['Code Checks']
types:
- completed

jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

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

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

- name: Run Jest tests
uses: willcaul/jest-github-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
test-command: 'npm run test:jest'

e2e-tests-chrome:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Cypress run (Chrome)
uses: cypress-io/github-action@v6
env:
APP_ENV: ${{ secrets.TESTING_APP_ENV }}
AF_DB_URL: ${{ secrets.STAGING_AF_DB_URL }}
AF_BEARER_TOKEN: ${{ secrets.STAGING_AF_BEARER_TOKEN }}
with:
build: npm run build
start: npm run start
wait-on: 'http://localhost:3000'
browser: chrome

e2e-tests-firefox:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Cypress run (Firefox)
uses: cypress-io/github-action@v6
env:
APP_ENV: ${{ secrets.TESTING_APP_ENV }}
AF_DB_URL: ${{ secrets.STAGING_AF_DB_URL }}
AF_BEARER_TOKEN: ${{ secrets.STAGING_AF_BEARER_TOKEN }}
with:
build: npm run build
start: npm run start
wait-on: 'http://localhost:3000'
browser: firefox
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
16 changes: 0 additions & 16 deletions .pre-commit-config.yaml

This file was deleted.

9 changes: 9 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'cypress';

export default defineConfig({
e2e: {
baseUrl: 'http://localhost:3000',
supportFile: 'cypress/support/index.ts',
setupNodeEvents(on, config) {},
},
});
Loading

0 comments on commit b3affa1

Please sign in to comment.