Open History to see the last commit
1name: PR
2
3on:
4 pull_request:
5
6 # Allows you to run this workflow manually from the Actions tab
7 workflow_dispatch:
8
9concurrency:
10 group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
11 cancel-in-progress: true
12
13permissions:
14 contents: read
15
16jobs:
17 lint:
18 name: Lint
19 runs-on: ubuntu-latest
20 steps:
21 - name: Checkout
22 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
23 with:
24 persist-credentials: false
25 - name: Setup Tools
26 uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
27 - name: Check lint
28 run: pnpm run lint:check
29 minified-db:
30 name: Minified DB public API
31 runs-on: ubuntu-latest
32 steps:
33 - name: Checkout
34 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
35 with:
36 persist-credentials: false
37 - name: Setup Tools
38 uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
39 - name: Check private-member mangle cache
40 run: pnpm run check:mangle
41 - name: Build DB packages
42 run: pnpm --filter @tanstack/db-ivm --filter @tanstack/db build
43 - name: Check minified public API
44 run: pnpm run test:minified-db
45 - name: Check DB tests against built dist
46 run: pnpm --filter @tanstack/db test:dist
47 test-db:
48 name: Test (${{ matrix.group }})
49 runs-on: ubuntu-latest
50 strategy:
51 fail-fast: false
52 matrix:
53 group: [db-1, db-2, db-replay]
54 env:
55 TEST_GROUP: ${{ matrix.group }}
56 steps:
57 - name: Checkout
58 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
59 with:
60 persist-credentials: false
61 - name: Setup Tools
62 uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
63 - name: Build dependencies
64 run: node scripts/ci-tests.mjs build "$TEST_GROUP"
65 - name: Run tests
66 run: node scripts/ci-tests.mjs test "$TEST_GROUP"
67 - name: Upload DB report
68 uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
69 with:
70 name: db-report-${{ matrix.group }}
71 path: packages/db/.vitest-reports/*.json
72 include-hidden-files: true
73 if-no-files-found: error
74 retention-days: 1
75 test-packages:
76 name: Test (${{ matrix.group }})
77 runs-on: ubuntu-latest
78 strategy:
79 fail-fast: false
80 matrix:
81 group:
82 [ivm-offline, sqlite-core, sqlite-adapters, frameworks, collections]
83 env:
84 TEST_GROUP: ${{ matrix.group }}
85 steps:
86 - name: Checkout
87 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
88 with:
89 persist-credentials: false
90 - name: Setup Tools
91 uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
92 - name: Build dependencies
93 run: node scripts/ci-tests.mjs build "$TEST_GROUP"
94 - name: Typecheck Test Sources
95 if: matrix.group == 'ivm-offline'
96 run: pnpm run typecheck:tests
97 - name: Run tests
98 run: node scripts/ci-tests.mjs test "$TEST_GROUP"
99 - name: Check dependency versions
100 if: matrix.group == 'ivm-offline'
101 run: |
102 if ! pnpm run test:sherif; then
103 echo ""
104 echo "=========================================="
105 echo "❌ Sherif found dependency version mismatches"
106 echo ""
107 echo "To fix this locally, run:"
108 echo " pnpm exec sherif --fix -i zod"
109 echo ""
110 echo "Then commit the changes to package.json files."
111 echo "=========================================="
112 exit 1
113 fi
114 test:
115 name: Test
116 if: always()
117 needs: [lint, test-db, test-packages]
118 runs-on: ubuntu-latest
119 steps:
120 - name: Require lint and every test group to succeed
121 env:
122 LINT_RESULT: ${{ needs.lint.result }}
123 DB_RESULT: ${{ needs.test-db.result }}
124 PACKAGES_RESULT: ${{ needs.test-packages.result }}
125 run: test "$LINT_RESULT" = success && test "$DB_RESULT" = success && test "$PACKAGES_RESULT" = success
126 - name: Checkout
127 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
128 with:
129 persist-credentials: false
130 - name: Setup Tools
131 uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
132 - name: Download DB reports
133 uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
134 with:
135 pattern: db-report-*
136 path: packages/db/.vitest-reports
137 merge-multiple: true
138 - name: Merge DB coverage and test reports
139 run: pnpm --dir packages/db exec vitest --mergeReports .vitest-reports
140 preview:
141 name: Preview
142 runs-on: ubuntu-latest
143 permissions:
144 contents: read
145 pull-requests: write
146 steps:
147 - name: Checkout
148 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
149 with:
150 fetch-depth: 0
151 persist-credentials: false
152 - name: Setup Tools
153 uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
154 - name: Build Packages
155 run: pnpm run build
156 - name: Publish Previews
157 run: pnpx pkg-pr-new publish --pnpm --compact './packages/*' --template './examples/*/*'
158 size:
159 name: Compressed size
160 if: github.event_name == 'pull_request'
161 runs-on: ubuntu-latest
162 permissions:
163 contents: read
164 pull-requests: write
165 steps:
166 - name: Checkout
167 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
168 with:
169 fetch-depth: 0
170 persist-credentials: false
171 - name: Setup Tools
172 uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
173 - name: Compare DB and React DB sizes
174 uses: preactjs/compressed-size-action@66325aad6443cb7cf89c4bfcd414aea2367cda94 # 2.9.1
175 with:
176 repo-token: '${{ secrets.GITHUB_TOKEN }}'
177 pattern: './packages/{db,react-db}/dist/**/*.{js,mjs}'
178 comment-key: 'db-and-react-package-size'
179 # The action installs and builds both head and base. Use commands
180 # already present on the base, including the minified build's deps.
181 install-script: bash -c "pnpm install --frozen-lockfile && pnpm --filter @tanstack/react-router-with-db... build"
182 build-script: 'build:minified'
183 build-example:
184 name: Build Example Site
185 runs-on: ubuntu-latest
186 steps:
187 - name: Checkout
188 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
189 with:
190 persist-credentials: false
191 - name: Setup Tools
192 uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
193 - name: Build Packages
194 run: pnpm run build
195 - name: Check action enforcement example
196 run: |
197 pnpm --filter @tanstack/db-example-react-action-enforcement test
198 pnpm --filter @tanstack/db-example-react-action-enforcement lint
199 pnpm --filter @tanstack/db-example-react-action-enforcement build
200 - name: Build Example Site
201 run: |
202 cd examples/react/todo
203 pnpm build
204 - name: Build Angular Todo Example
205 run: pnpm --dir examples/angular/todos build
206 build-starter:
207 name: Build Example Site
208 runs-on: ubuntu-latest
209 steps:
210 - name: Checkout
211 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
212 with:
213 persist-credentials: false
214 - name: Setup Tools
215 uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
216 - name: Build Packages
217 run: pnpm run build
218 - name: Build Starter Site
219 run: |
220 cd examples/react/projects
221 cp .env.example .env
222 pnpm build