-
Notifications
You must be signed in to change notification settings - Fork 1
151 lines (126 loc) · 4.51 KB
/
PRs.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
144
145
146
147
148
149
150
151
name: Pull request checks
on:
push:
branches:
- main
paths-ignore:
- '.github/workflows/**'
- '!.github/workflows/PRs.yml'
- '*.md'
- 'docs/**'
- 'renovate.json'
pull_request:
paths-ignore:
- '.github/workflows/**'
- '!.github/workflows/PRs.yml'
- '*.md'
- 'docs/**'
- 'renovate.json'
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
test-api:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
matrix:
shard: [1, 2, 3]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4
with:
node-version-file: .node-version
cache: pnpm
- name: Install
run: pnpm install
- name: Build
run: npm run build
- name: Run API tests
run: npm run test -- --shard ${{ matrix.shard }}/${{ strategy.job-total }} --coverage
- name: Upload coverage
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/coverage-final.json
lint:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4
with:
node-version-file: .node-version
cache: pnpm
- name: Install
run: pnpm install && pnpm --dir frontend install
- name: Check formatting
run: npm run pretty
- name: Check backend linting
run: npm run lint:backend
- name: Check consumer linting
run: npm run lint:consumer
- name: Check do linting
run: npm run lint:do
- name: Check frontend linting
run: npm run lint:frontend
- name: Check frontend types
continue-on-error: true
working-directory: frontend
run: npm run types-check
- name: Setup Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5
with:
go-version: stable
- name: Install sqlite3def
run: go install github.com/sqldef/sqldef/cmd/sqlite3def@v0.16.13
- name: Check DB schema
run: |
DB_ID=$(yq --output-format json wrangler.toml | jq --raw-output --exit-status '.d1_databases | first | .database_id')
npm run database:migrate -- --local
sqlite3def --enable-drop-table --config sqldef.yml --dry-run \
".wrangler/state/v3/d1/${DB_ID:?}/db.sqlite" < schema.sql | head -n 1 | grep -E '^-- Nothing is modified --$'
test-ui:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4
with:
node-version-file: .node-version
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Run App in the background
run: npm run ci-dev-test-ui &
- name: Store Playwright version
run: |
PLAYWRIGHT_VERSION=$(pnpm ls @playwright/test --json | jq --exit-status --raw-output 'first | .devDependencies["@playwright/test"].version')
echo "Playwright version: ${PLAYWRIGHT_VERSION}"
echo "PLAYWRIGHT_VERSION=${PLAYWRIGHT_VERSION}" >> $GITHUB_ENV
- name: Cache Playwright
id: cache-playwright-browsers
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3
with:
path: /home/runner/.cache/ms-playwright
key: playwright-browsers-${{ runner.os }}-${{ runner.arch }}-${{ env.PLAYWRIGHT_VERSION }}
- name: Download Playwright browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30