Skip to content

ci: add turbo and release workflow #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
6 changes: 6 additions & 0 deletions .changeset/chubby-zebras-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@tanstack-query-firebase/angular": patch
"@tanstack-query-firebase/react": patch
---

Improve various CI processes and add changeset support
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
115 changes: 115 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Release Packages

on:
workflow_dispatch:
inputs:
dry_run:
description: "Dry run (no actual release)"
required: true
default: false
type: boolean

jobs:
quality:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.15.4

- name: Install dependencies
run: pnpm install

- name: Run format check
run: pnpm format

release:
name: Release
runs-on: ubuntu-latest
needs: quality
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.15.4

- name: Install dependencies
run: pnpm install

- name: Install Firebase CLI
uses: nick-invision/retry@v3
with:
timeout_minutes: 10
retry_wait_seconds: 60
max_attempts: 3
command: npm i -g firebase-tools@14

- name: Run tests with emulator
run: pnpm test:emulator

- name: Build packages
run: pnpm turbo build

- name: Validate changesets
run: |
if [ -z "$(ls .changeset/*.md 2>/dev/null)" ]; then
echo "❌ No changesets found. Please create changesets locally with 'pnpm changeset' before releasing."
echo "Changesets should be created during development, not during release."
exit 1
else
echo "✅ Found $(ls .changeset/*.md | wc -l) changeset(s)"
echo "Changesets:"
ls .changeset/*.md
fi

- name: Create Release Pull Request or Publish
if: ${{ !inputs.dry_run }}
id: changesets
uses: changesets/action@v1
with:
publish: pnpm release
commit: "chore: version packages"
title: "chore: version packages"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Dry Run - Show Changes
if: ${{ inputs.dry_run }}
run: |
echo "🔍 This is a dry run. The following changes would be made:"
echo ""
echo "📋 Changeset contents:"
for file in .changeset/*.md; do
if [ -f "$file" ]; then
echo "--- $file ---"
cat "$file"
echo ""
fi
done

echo "📦 Version changes that would be applied:"
pnpm changeset version --dry-run

echo ""
echo "✅ Dry run completed successfully"
73 changes: 40 additions & 33 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -9,40 +9,56 @@ on:
- main

jobs:
test:
quality:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout code
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
version: 9
run_install: false # We'll do this later
node-version: "20"

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.15.4

- name: Install dependencies
run: pnpm install

- name: Run format check
run: pnpm format

test:
runs-on: ubuntu-latest
needs: quality
steps:
- name: Checkout code
uses: actions/checkout@v4

# Setup Node.js with pnpm
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
node-version: "20"
registry-url: "https://registry.npmjs.org"

# Install all dependencies at the root
- name: Install dependencies (pnpm)
run: pnpm install
- name: Check formatting
run: pnpm format:ci
- name: Start Firebase Emulator Suite
uses: invertase/firebase-emulator-action@v1.0.1
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
emulators: 'auth,firestore,functions,storage,database,dataconnect'
version: 8.15.4

- name: Verify Running Emulators
run: |
curl --silent http://localhost:4400/emulators | jq 'keys[]'
- name: Install dependencies
run: pnpm install

- name: Install Firebase CLI
uses: nick-invision/retry@v3
with:
timeout_minutes: 10
retry_wait_seconds: 60
max_attempts: 3
command: npm i -g firebase-tools@14

# Determine which packages have changed
- name: Determine changed packages
@@ -54,16 +70,7 @@ jobs:
- 'packages/react/**'
angular:
- 'packages/angular/**'

# Run tests for the React package if it has changed
- name: Run React Tests
if: steps.changes.outputs.react == 'true'
run: cd packages/react && pnpm vitest --dom
- name: Run Angular Tests
if: steps.changes.outputs.angular == 'true'
run: cd packages/angular && pnpm vitest --dom

# Run tests for the Vue package if it has changed
# - name: Run Vue Tests
# if: steps.changes.outputs.vue == 'true'
# run: pnpm --filter vue test
# Run tests with emulator for changed packages
- name: Run tests with emulator
run: pnpm test:emulator
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -13,4 +13,7 @@ functions/lib/**/*.js
functions/lib/**/*.js.map

# Firebase cache
.firebase/
.firebase/
.turbo/
.next/
.dataconnect/
51 changes: 25 additions & 26 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"name": "vscode-jest-tests.v2",
"request": "launch",
"runtimeExecutable": "yarn",
"args": [
"test",
"--watch-all=false",
"--test-name-pattern",
"${jest.testNamePattern}",
"--test-path-pattern",
"${jest.testFilePattern}"
],
"cwd": "${workspaceFolder}/packages/angular",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true
}

]
}
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"name": "vscode-jest-tests.v2",
"request": "launch",
"runtimeExecutable": "yarn",
"args": [
"test",
"--watch-all=false",
"--test-name-pattern",
"${jest.testNamePattern}",
"--test-path-pattern",
"${jest.testFilePattern}"
],
"cwd": "${workspaceFolder}/packages/angular",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true
}
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"angular.enable-strict-mode-prompt": false
}
}
Loading
Oops, something went wrong.