-
-
Notifications
You must be signed in to change notification settings - Fork 10
136 lines (109 loc) · 3.17 KB
/
ci.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: yarn install
- name: Run linter
run: yarn lint
- name: Check types
run: yarn typecheck
- name: Validate GraphQL operations
run: yarn validate
test:
name: Build & Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node: [16]
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: jabref
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to port 6380 on host
- 6380:6379
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/jabref?schema=public
GITHUB_REPO_TOKEN: ${{ secrets.GITHUBS_REPO_TOKEN }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
- name: Install dependencies
run: yarn install
- name: Init database
run: yarn prisma:push
# Check that no schema changes have been done without corresponding migration files have been added
- name: Detect database schema drift
run: yarn prisma:migrate:diff $DATABASE_URL
- name: Build
run: yarn build
- name: Start server
run: yarn start &
- name: Run tests
run: yarn test --coverage
env:
TEST_URL: http://localhost:3000
- name: Build Storybook
run: |
yarn nuxi generate
yarn storybook:build
cp .output/public/_storybook/external-iframe/index.html storybook-static/iframe.html
mkdir -p storybook-static/_storybook/external-iframe
cp -r .output/public/_nuxt storybook-static
- name: Publish and test Storybook
uses: chromaui/action@v1
with:
projectToken: 'b3787adf2fa5'
# Don't wait until Chroma verified the build (for this we have the Github check)
exitOnceUploaded: true
storybookBuildDir: storybook-static
debug: true
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}