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