-
-
Notifications
You must be signed in to change notification settings - Fork 10
143 lines (114 loc) · 3.78 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
137
138
139
140
141
142
143
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Run linter
run: pnpm lint
- name: Check types
run: pnpm typecheck
- name: Validate GraphQL operations
run: pnpm validate
test:
name: Build & Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node: [20]
services:
postgres:
image: postgres@sha256:f176fef320ed02c347e9f85352620945547a9a23038f02b57cf7939a198182ae
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@sha256:af0be38eb8e43191bae9b03fe5c928803930b6f93e2dde3a7ad1165c04b1ce22
# 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 }}
NUXT_SESSION_PASSWORD: somerandompasswordNxFHaqCSPpBe6n5kRz2dru4hJ7K9bjgEtmsV8QAT3MDXcUfWGL
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Init database
run: pnpm prisma:push
# Check that no schema changes have been done without corresponding migration files have been added
- name: Detect database schema drift
run: pnpm prisma:migrate:diff $DATABASE_URL
- name: Build
run: pnpm build
- name: Start server
run: pnpm start &
- name: Run tests
run: pnpm run test --coverage
env:
TEST_URL: http://localhost:3000
- name: Build Storybook
run: |
pnpm nuxi generate
pnpm 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@0efa3230f403b7848d5d65c6ce140b617fb68380 # v11
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/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
with:
token: ${{ secrets.CODECOV_TOKEN }}