-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (47 loc) · 1.86 KB
/
server_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Server Test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x" # Adjust version according to your requirements
cache: "npm"
cache-dependency-path: server/package-lock.json
- name: Cache node modules
id: cache-nodemodules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: server/node_modules # Update path to cache the node_modules directory inside the /server sub-folder
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} # Update path to hash package-lock.json inside the /server sub-folder
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Dependencies
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: |
cd server
npm ci
- name: Run tests
run: |
cd server
touch .env
echo "DB_URL=${{ secrets.DB_URL }}" >> .env
echo "DB_SERVICE_ROLE_KEY=${{ secrets.DB_SERVICE_ROLE_KEY }}" >> .env
echo "DB_DIRECT_URL=${{ secrets.DB_DIRECT_URL }}" >> .env
echo "JWT_SECRET_KEY=${{ secrets.JWT_SECRET_KEY }}" >> .env
npm test
- name: Remove .env
run: |
cd server
rm .env