-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (55 loc) · 1.43 KB
/
test.yaml
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
54
55
name: build and test
run-name: Build and Test
on:
pull_request:
push:
branches:
- main
- dev
jobs:
build-and-test:
permissions:
checks: write
pull-requests: write
contents: write
name: Build and Test
runs-on: ubuntu-latest
services:
mysql:
image: mariadb:10.9.7
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: db
ports:
- 3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Checkout
uses: actions/checkout@v3
with:
node-version: 18
- name: start db & set .env
run: |
sudo service mysql start
echo "DATABASE_URL=mysql://root:root@localhost:3306/db
ODCLOUD_API_KEY=${{ secrets.ODCLOUD_API_KEY }}" > .env
- name: Install Dependencies & db setup
run: |
npm install
npm run prisma
npm run seed
- name: Run Tests
uses: ArtiomTr/jest-coverage-report-action@v2
id: coverage
with:
test-script: npm run test
output: report-markdown
- name: Add a comment to the pull request
if: ${{ github.event_name == 'pull_request' }}
uses: marocchino/sticky-pull-request-comment@v2
with:
message: ${{ steps.coverage.outputs.report }}