Update full-stack-tests.yml #30
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: Full Stack Tests | |
on: [push, pull_request] | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x] | |
mongodb-version: ['4.2', '4.4', '5.0', '6.0'] | |
services: | |
mongodb: | |
image: mongo:${{ matrix.mongodb-version }} | |
env: | |
MONGO_INITDB_ROOT_USERNAME: ${{ secrets.MONGO_INITDB_ROOT_USERNAME }} | |
MONGO_INITDB_ROOT_PASSWORD: ${{ secrets.MONGO_INITDB_ROOT_PASSWORD }} | |
ports: | |
- 27017:27017 | |
options: >- | |
--health-cmd mongo | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install Backend Dependencies | |
run: | | |
cd backend | |
npm install | |
- name: Initialize Database | |
run: | | |
MONGODB_URI=${{ secrets.MONGODB_URI }} npm run initialize-db | |
- name: Build Backend | |
run: | | |
cd backend | |
npm run build | |
- name: Start Backend | |
run: | | |
cd backend | |
npm run start & | |
- name: Install Frontend Dependencies | |
run: | | |
cd frontend | |
npm install | |
- name: Run Frontend Tests | |
run: | | |
cd frontend | |
npm run test:e2e | |
timeout-minutes: 30 |