-
-
Notifications
You must be signed in to change notification settings - Fork 22
154 lines (124 loc) · 4.48 KB
/
ci.yml
File metadata and controls
154 lines (124 loc) · 4.48 KB
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
144
145
146
147
148
149
150
151
152
153
154
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24.15.0
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]
services:
postgres:
image: postgres@sha256:78481659c47e862334611ccdaf7c369c986b3046da9857112f3b309114a65fb4
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:25dbb04fc4d6d190eda327dab551631500b0f9ac8f9808e8e63b7fda1ddff196
# 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
SHADOW_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/jabref_shadow
SESSION_PASSWORD: somerandompasswordNxFHaqCSPpBe6n5kRz2dru4hJ7K9bjgEtmsV8QAT3MDXcUfWGL
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24.15.0
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Init database
run: pnpm prisma:push
env:
NUXT_DATABASE_URL: ${{ env.DATABASE_URL }}
# Check that no schema changes have been done without corresponding migration files have been added
- name: Create shadow database for schema drift detection
run: PGPASSWORD=postgres psql -h localhost -U postgres -c "CREATE DATABASE jabref_shadow;"
- name: Detect database schema drift
run: pnpm prisma:migrate:diff
env:
NUXT_DATABASE_URL: ${{ env.DATABASE_URL }}
NUXT_SHADOW_DATABASE_URL: ${{ env.SHADOW_DATABASE_URL }}
- name: Build
run: pnpm build
env:
NUXT_SESSION_PASSWORD: ${{ env.SESSION_PASSWORD }} # Needed for prerending
- name: Start server
run: pnpm start &
env:
NUXT_GITHUB_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUXT_SESSION_PASSWORD: ${{ env.SESSION_PASSWORD }}
NUXT_DATABASE_URL: ${{ env.DATABASE_URL }}
- name: Run tests
run: pnpm run test --coverage
env:
TEST_URL: http://localhost:3000
NUXT_DATABASE_URL: ${{ env.DATABASE_URL }} # To seed the database
# The tests need these tokens to run, but their actual value should not matter
NUXT_GITHUB_REPO_TOKEN: 'SIGNAL_TO_RUN_TEST'
- name: Build Storybook
if: always()
run: pnpm storybook:build
- name: Publish and test Storybook
if: always()
uses: chromaui/action@eea1606238fd97a70b5af723d103953d1f40967b # v15.3.1
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@75cd11691c0faa626561e295848008c8a7dddffe # v5.5.4
with:
token: ${{ secrets.CODECOV_TOKEN }}