forked from podkrepi-bg/api
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (50 loc) · 1.47 KB
/
tests.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
name: API tests
on:
workflow_dispatch:
push:
tags:
- 'v*.*.*'
branches: [master]
paths-ignore:
- '**.md'
pull_request:
branches: [master]
jobs:
run-tests:
name: Run API tests
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
- name: Copy env file
run: cp .env.example .env
- name: Run database
run: docker-compose up -d pg-db
- name: Install dependencies
run: yarn install --immutable
- name: Generate Prisma DB client
run: yarn prisma generate
- name: Migrate database
run: yarn prisma migrate deploy
- name: NX Build and lint API # https://github.com/marketplace/actions/nrwl-nx
uses: MansaGroup/nrwl-nx-action@v3
with:
targets: lint,build
projects: api
- name: Run tests
run: yarn test:ci
- name: Upload test results artifact
uses: actions/upload-artifact@v3 # upload test results
if: success() || failure() # run this step even if previous step failed
with: # upload a combined archive with unit and integration test results
name: test-results
path: test-results.xml