Bump eslint from 9.15.0 to 9.16.0 in /backend #258
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: Run Tests # The name of the GitHub Actions workflow for running tests | |
on: | |
push: | |
branches: | |
- main # Trigger the workflow on pushes to the 'main' branch | |
pull_request: | |
branches: | |
- main # Trigger the workflow on pull requests to the 'main' branch | |
jobs: | |
test: # The name of the job that runs the tests | |
runs-on: ubuntu-latest # The job will run on the latest version of Ubuntu | |
steps: | |
- name: Checkout code # Step to checkout the code from the repository | |
uses: actions/checkout@v3 # GitHub Action that checks out your repository code | |
- name: Set up Node.js # Step to set up Node.js environment | |
uses: actions/setup-node@v3 # GitHub Action that sets up Node.js | |
with: | |
node-version: "16" # Specifies the Node.js version to use (version 16) | |
# Cache npm packages to speed up installation | |
- name: Cache npm packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install root dependencies # Step to install dependencies from the root package.json | |
run: npm install # Runs 'npm install' to install dependencies | |
- name: Install backend dependencies # Step to install backend-specific dependencies | |
run: npm install --prefix ./backend # Runs 'npm install' in the 'backend' folder | |
- name: Install frontend dependencies # Step to install frontend-specific dependencies | |
run: npm install --prefix ./frontend # Runs 'npm install' in the 'frontend' folder | |
- name: Run backend tests # Step to run tests for the backend | |
env: | |
MONGODB_URI: ${{ secrets.MONGODB_URI }} # Sets MongoDB URI from GitHub Secrets | |
JWT_SECRET: ${{ secrets.JWT_SECRET }} # Sets JWT secret from GitHub Secrets | |
run: npm test --prefix ./backend # Runs 'npm test' in the 'backend' folder | |
- name: Run frontend tests # Step to run tests for the frontend | |
run: npm test --prefix ./frontend # Runs 'npm test' in the 'frontend' folder | |
- name: Upload test results # Step to upload test results if tests fail | |
if: failure() # Only runs if previous steps failed | |
uses: actions/upload-artifact@v3 # GitHub Action to upload artifacts | |
with: | |
name: test-results # The name of the uploaded artifact | |
path: ./test-results # Path to the test results folder |