-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (87 loc) · 3.23 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Test
on:
pull_request:
branches:
- master
permissions:
checks: write
pull-requests: write
contents: write
jobs:
test:
name: Test
concurrency: ci-${{ github.ref }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
# optional (defaults to `postgres`)
POSTGRES_DB: postgres_db
# required
POSTGRES_PASSWORD: postgres_password
# optional (defaults to `5432`)
POSTGRES_PORT: 5432
# optional (defaults to `postgres`)
POSTGRES_USER: postgres_user
ports:
# maps tcp port 5432 on service container to the host
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
BLOB_READ_WRITE_TOKEN: 'vercel_blob_rw_0511953119b0c1167283c7453a088727' # Fake vercel token
DATABASE_URL: 'postgresql://postgres_user:postgres_password@localhost:5432/postgres_db'
DATABASE_URL_NON_POOLING: 'postgresql://postgres_user:postgres_password@localhost:5432/postgres_db'
DATABASE_URL_WITHOUT_SCHEMA: 'postgresql://postgres_user:postgres_password@localhost:5432'
REDIS_URL: 'redis://localhost'
SECRET: '7ZB68E3HZ9HWGe8FzUvNWZcoYD9uuwkp25Y66S6RkszKadFMJCj9ShXL7TBcieG9yoRAsdTKzJcEgQUYbd6dtjXgmZMQhVNKypNeq6yKKLVht7gUtXypaoxgoRjQDHLceCWmJhM6GbwYiyLHmVYA8L9zuJUhYW2atZiv4Fxoc4YqzaCCrSZxzPBT9rFDSCtHsXXDEShMvULSStZvwt26tesWtxEMx5Q43a3s6eHrPJUPgVX3aAZsmYRu3bzCHvRp'
PRIVATE: |
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIB63sfXk5HebxHMAoWavbxtK84sjVucZCNm+5Y3au6mb
-----END PRIVATE KEY-----
PUBLIC: |
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEA/nqSs2DZmox+sRNR9d9XdaO3C2yJABIO5gdJlBcswNI=
-----END PUBLIC KEY-----
steps:
- uses: actions/checkout@v3
- name: Setup Redis server
uses: supercharge/[email protected]
- name: Setup Node - ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Run prisma migrations & generate prisma client
run: npx prisma migrate dev
- name: Lint code
run: npm run lint
- name: Run tests
run: npm run test -- --coverage
- name: Comment coverage report on pull request
if: ${{ github.event_name == 'pull_request' }}
uses: ArtiomTr/jest-coverage-report-action@v2
- name: Generate coverage badge
if: ${{ github.ref == 'refs/heads/master' }}
uses: jaywcjlove/coverage-badges-cli@main
with:
source: coverage/coverage-summary.json
output: coverage/badge.svg
- name: Publish coverage report to GitHub Pages
if: ${{ github.ref == 'refs/heads/master' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: coverage