Skip to content

Commit b807700

Browse files
authored
ci: add turbo and release workflow (#184)
* ci: add turbo and intial run at release workflows * ci: fix tests running from root with turbo * fix: revert use client decorator in package * chore: bump pnpm version * chore: format * chore: update format script references * chore: update format in test workflow yaml * chore: improve test commands * chore: add changeset for release workflow improvements * chore: fix format and build CI * chore(ci): fix format CI * chore(ci): add firebase emulator install step * chore: fix CONTRIBUTING.md script reference * fix: update CONTRIBUTING and scripts according to review * fix: remove useless release_type from workflow
1 parent 32f06b8 commit b807700

File tree

99 files changed

+2075
-6498
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+2075
-6498
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/chubby-zebras-enjoy.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@tanstack-query-firebase/angular": patch
3+
"@tanstack-query-firebase/react": patch
4+
---
5+
6+
Improve various CI processes and add changeset support

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "restricted",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.github/workflows/release.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Release Packages
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dry_run:
7+
description: "Dry run (no actual release)"
8+
required: true
9+
default: false
10+
type: boolean
11+
12+
jobs:
13+
quality:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: "20"
23+
24+
- name: Setup pnpm
25+
uses: pnpm/action-setup@v2
26+
with:
27+
version: 8.15.4
28+
29+
- name: Install dependencies
30+
run: pnpm install
31+
32+
- name: Run format check
33+
run: pnpm format
34+
35+
release:
36+
name: Release
37+
runs-on: ubuntu-latest
38+
needs: quality
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0
44+
45+
- name: Setup Node.js
46+
uses: actions/setup-node@v4
47+
with:
48+
node-version: "20"
49+
registry-url: "https://registry.npmjs.org"
50+
51+
- name: Setup pnpm
52+
uses: pnpm/action-setup@v2
53+
with:
54+
version: 8.15.4
55+
56+
- name: Install dependencies
57+
run: pnpm install
58+
59+
- name: Install Firebase CLI
60+
uses: nick-invision/retry@v3
61+
with:
62+
timeout_minutes: 10
63+
retry_wait_seconds: 60
64+
max_attempts: 3
65+
command: npm i -g firebase-tools@14
66+
67+
- name: Run tests with emulator
68+
run: pnpm test:emulator
69+
70+
- name: Build packages
71+
run: pnpm turbo build
72+
73+
- name: Validate changesets
74+
run: |
75+
if [ -z "$(ls .changeset/*.md 2>/dev/null)" ]; then
76+
echo "❌ No changesets found. Please create changesets locally with 'pnpm changeset' before releasing."
77+
echo "Changesets should be created during development, not during release."
78+
exit 1
79+
else
80+
echo "✅ Found $(ls .changeset/*.md | wc -l) changeset(s)"
81+
echo "Changesets:"
82+
ls .changeset/*.md
83+
fi
84+
85+
- name: Create Release Pull Request or Publish
86+
if: ${{ !inputs.dry_run }}
87+
id: changesets
88+
uses: changesets/action@v1
89+
with:
90+
publish: pnpm release
91+
commit: "chore: version packages"
92+
title: "chore: version packages"
93+
env:
94+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
96+
97+
- name: Dry Run - Show Changes
98+
if: ${{ inputs.dry_run }}
99+
run: |
100+
echo "🔍 This is a dry run. The following changes would be made:"
101+
echo ""
102+
echo "📋 Changeset contents:"
103+
for file in .changeset/*.md; do
104+
if [ -f "$file" ]; then
105+
echo "--- $file ---"
106+
cat "$file"
107+
echo ""
108+
fi
109+
done
110+
111+
echo "📦 Version changes that would be applied:"
112+
pnpm changeset version --dry-run
113+
114+
echo ""
115+
echo "✅ Dry run completed successfully"

.github/workflows/tests.yaml

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,56 @@ on:
99
- main
1010

1111
jobs:
12-
test:
12+
quality:
1313
runs-on: ubuntu-latest
1414
steps:
15-
# Checkout the repository
16-
- name: Checkout code
15+
- name: Checkout
1716
uses: actions/checkout@v4
1817

19-
- name: Install pnpm
20-
uses: pnpm/action-setup@v4
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
2120
with:
22-
version: 9
23-
run_install: false # We'll do this later
21+
node-version: "20"
22+
23+
- name: Setup pnpm
24+
uses: pnpm/action-setup@v2
25+
with:
26+
version: 8.15.4
27+
28+
- name: Install dependencies
29+
run: pnpm install
30+
31+
- name: Run format check
32+
run: pnpm format
33+
34+
test:
35+
runs-on: ubuntu-latest
36+
needs: quality
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v4
2440

25-
# Setup Node.js with pnpm
2641
- name: Setup Node.js
2742
uses: actions/setup-node@v4
2843
with:
29-
node-version: 20
30-
cache: 'pnpm'
44+
node-version: "20"
45+
registry-url: "https://registry.npmjs.org"
3146

32-
# Install all dependencies at the root
33-
- name: Install dependencies (pnpm)
34-
run: pnpm install
35-
- name: Check formatting
36-
run: pnpm format:ci
37-
- name: Start Firebase Emulator Suite
38-
uses: invertase/[email protected]
47+
- name: Setup pnpm
48+
uses: pnpm/action-setup@v2
3949
with:
40-
emulators: 'auth,firestore,functions,storage,database,dataconnect'
50+
version: 8.15.4
4151

42-
- name: Verify Running Emulators
43-
run: |
44-
curl --silent http://localhost:4400/emulators | jq 'keys[]'
52+
- name: Install dependencies
53+
run: pnpm install
4554

55+
- name: Install Firebase CLI
56+
uses: nick-invision/retry@v3
57+
with:
58+
timeout_minutes: 10
59+
retry_wait_seconds: 60
60+
max_attempts: 3
61+
command: npm i -g firebase-tools@14
4662

4763
# Determine which packages have changed
4864
- name: Determine changed packages
@@ -54,16 +70,7 @@ jobs:
5470
- 'packages/react/**'
5571
angular:
5672
- 'packages/angular/**'
57-
58-
# Run tests for the React package if it has changed
59-
- name: Run React Tests
60-
if: steps.changes.outputs.react == 'true'
61-
run: cd packages/react && pnpm vitest --dom
62-
- name: Run Angular Tests
63-
if: steps.changes.outputs.angular == 'true'
64-
run: cd packages/angular && pnpm vitest --dom
6573
66-
# Run tests for the Vue package if it has changed
67-
# - name: Run Vue Tests
68-
# if: steps.changes.outputs.vue == 'true'
69-
# run: pnpm --filter vue test
74+
# Run tests with emulator for changed packages
75+
- name: Run tests with emulator
76+
run: pnpm test:emulator

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@ functions/lib/**/*.js
1313
functions/lib/**/*.js.map
1414

1515
# Firebase cache
16-
.firebase/
16+
.firebase/
17+
.turbo/
18+
.next/
19+
.dataconnect/

.vscode/launch.json

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
{
2-
// Use IntelliSense to learn about possible attributes.
3-
// Hover to view descriptions of existing attributes.
4-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5-
"version": "0.2.0",
6-
"configurations": [
7-
{
8-
"type": "node",
9-
"name": "vscode-jest-tests.v2",
10-
"request": "launch",
11-
"runtimeExecutable": "yarn",
12-
"args": [
13-
"test",
14-
"--watch-all=false",
15-
"--test-name-pattern",
16-
"${jest.testNamePattern}",
17-
"--test-path-pattern",
18-
"${jest.testFilePattern}"
19-
],
20-
"cwd": "${workspaceFolder}/packages/angular",
21-
"console": "integratedTerminal",
22-
"internalConsoleOptions": "neverOpen",
23-
"disableOptimisticBPs": true
24-
}
25-
26-
]
27-
}
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"name": "vscode-jest-tests.v2",
10+
"request": "launch",
11+
"runtimeExecutable": "yarn",
12+
"args": [
13+
"test",
14+
"--watch-all=false",
15+
"--test-name-pattern",
16+
"${jest.testNamePattern}",
17+
"--test-path-pattern",
18+
"${jest.testFilePattern}"
19+
],
20+
"cwd": "${workspaceFolder}/packages/angular",
21+
"console": "integratedTerminal",
22+
"internalConsoleOptions": "neverOpen",
23+
"disableOptimisticBPs": true
24+
}
25+
]
26+
}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
22
"angular.enable-strict-mode-prompt": false
3-
}
3+
}

0 commit comments

Comments
 (0)