Skip to content

Commit

Permalink
split tests into separate frontend and backend files
Browse files Browse the repository at this point in the history
  • Loading branch information
rtjord committed Nov 3, 2024
1 parent 39610ca commit f10ea48
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 55 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/linter.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/test_backend
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build and Test Frontend and Backend

on:
pull_request:
branches:
- main
- dev

permissions:
contents: read
actions: read
repository-projects: read
issues: read
pull-requests: read

jobs:
build-test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

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

- name: Cache Node.js modules
uses: actions/cache@v3
with:
path: backend/node_modules
key: ${{ runner.os }}-backend-node-${{ hashFiles('backend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-backend-node-

- name: Install dependencies
working-directory: backend
run: npm install

- name: Lint Backend
working-directory: backend
run: npm run lint

- name: Run Backend Tests
working-directory: backend
run: npm run test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LOG_FILE: test.log
LOG_LEVEL: 2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Test Frontend and Backend
name: Build and Test Frontend

on:
pull_request:
Expand All @@ -9,9 +9,6 @@ on:
permissions:
contents: read
actions: read
repository-projects: read
issues: read
pull-requests: read

jobs:
build-test:
Expand All @@ -26,18 +23,22 @@ jobs:
with:
node-version: '18.x'

- name: Cache Node.js modules (Frontend)
- name: Cache Node.js modules
uses: actions/cache@v3
with:
path: frontend/node_modules
key: ${{ runner.os }}-frontend-node-${{ hashFiles('frontend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-frontend-node-
- name: Install dependencies (Frontend)
- name: Install dependencies
working-directory: frontend
run: npm install

- name: Lint
working-directory: frontend
run: npm run lint

- name: Cache Next.js build
uses: actions/cache@v4
with:
Expand All @@ -48,26 +49,6 @@ jobs:
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('frontend/package-lock.json') }}-
- name: Build the Frontend
working-directory: frontend # Change to the frontend directory
- name: Build
working-directory: frontend
run: npm run build

- name: Cache Node.js modules (Backend)
uses: actions/cache@v3
with:
path: backend/node_modules
key: ${{ runner.os }}-backend-node-${{ hashFiles('backend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-backend-node-
- name: Install dependencies (Backend)
working-directory: backend # Change to the backend directory
run: npm install

- name: Run Backend Tests
working-directory: backend # Change to the backend directory
run: npm run test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LOG_FILE: test.log
LOG_LEVEL: 2

0 comments on commit f10ea48

Please sign in to comment.