This repository has been archived by the owner on May 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
88 lines (81 loc) · 2.71 KB
/
node.js.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
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Node.js CI
on:
push:
branches: [ main ]
paths-ignore:
- '**.md'
- '.gitpod.Dockerfile'
- '.gitpod.yml'
pull_request:
branches: [ main ]
paths-ignore:
- '.github/**'
- '**.md'
- '.gitpod.Dockerfile'
- '.gitpod.yml'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
env:
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres@sha256:78a275d4c891f7b3a33d3f1a78eda9f1d744954d9e20122bfdc97cdda25cddaf
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/[email protected]
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: yarn dedupe --check
- uses: nick-fields/[email protected]
with:
timeout_minutes: 2
max_attempts: 3
retry_on: error
command: yarn install --immutable
- run: yarn why prisma
- name: run jest and storybook tests
uses: nick-fields/[email protected]
with:
timeout_minutes: 4
max_attempts: 3
retry_on: error
command: yarn rw test api && yarn rw test web && yarn workspace web test-storybook:ci
- uses: actions/[email protected]
with:
name: coverage-for-${{github.sha}}-node-${{matrix.node-version}}
path: |
web/coverage/storybook/coverage-storybook.json
# order of steps is important, storybook needs to be built first as
# it goes into web/public/storybook which then gets built and put into
# web/dist
- run: yarn rw sb --build --no-open && yarn rw build
- uses: actions/[email protected]
with:
name: build-for-${{github.sha}}-node-${{matrix.node-version}}
path: |
api/dist/
web/dist/