Skip to content

ci: run tests with hono resolution matrix #1086

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

Closed

Conversation

BarryThePenguin
Copy link
Contributor

@BarryThePenguin BarryThePenguin commented Mar 29, 2025

Run CI against multiple versions of hono using matrix strategy

@codecov-commenter
Copy link

codecov-commenter commented Mar 29, 2025

Codecov Report

Attention: Patch coverage is 16.66667% with 5 lines in your changes missing coverage. Please review.

Project coverage is 79.28%. Comparing base (b70735c) to head (83bec6d).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/firebase-auth/src/index.ts 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1086      +/-   ##
==========================================
- Coverage   79.48%   79.28%   -0.21%     
==========================================
  Files          77       77              
  Lines        2276     2278       +2     
  Branches      574      574              
==========================================
- Hits         1809     1806       -3     
- Misses        391      396       +5     
  Partials       76       76              
Flag Coverage Δ
ajv-validator 0.74% <0.00%> (-0.01%) ⬇️
auth-js 2.98% <0.00%> (-0.01%) ⬇️
casbin 1.44% <0.00%> (-0.01%) ⬇️
class-validator 0.83% <0.00%> (-0.01%) ⬇️
clerk-auth 0.92% <0.00%> (-0.07%) ⬇️
cloudflare-access 2.72% <0.00%> (-0.01%) ⬇️
conform-validator 1.09% <0.00%> (-0.01%) ⬇️
effect-validator 0.39% <0.00%> (-0.01%) ⬇️
esbuild-transpiler 0.96% <0.00%> (-0.01%) ⬇️
event-emitter 2.50% <0.00%> (-0.18%) ⬇️
graphql-server 4.12% <0.00%> (-0.30%) ⬇️
hello 0.17% <0.00%> (-0.01%) ⬇️
medley-router 0.43% <0.00%> (-0.01%) ⬇️
node-ws 2.28% <0.00%> (-0.17%) ⬇️
oauth-providers 26.29% <0.00%> (-0.03%) ⬇️
oidc-auth 9.96% <0.00%> (-0.01%) ⬇️
otel 0.87% <0.00%> (-0.01%) ⬇️
prometheus 1.58% <0.00%> (-0.12%) ⬇️
react-renderer 1.36% <0.00%> (-0.01%) ⬇️
sentry 0.74% <0.00%> (-0.01%) ⬇️
standard-validator 1.40% <0.00%> (-0.01%) ⬇️
swagger-editor 0.61% <0.00%> (-0.01%) ⬇️
swagger-ui 1.66% <0.00%> (-0.01%) ⬇️
trpc-server 0.52% <16.66%> (-0.01%) ⬇️
tsyringe 0.26% <0.00%> (-0.01%) ⬇️
valibot-validator 0.48% <0.00%> (-0.04%) ⬇️
zod-openapi 5.17% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@BarryThePenguin BarryThePenguin force-pushed the ci/matrix-hono-resolution branch from e0339bc to a16eb15 Compare March 29, 2025 10:02
Copy link

changeset-bot bot commented Mar 29, 2025

⚠️ No Changeset found

Latest commit: e2b4f73

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@BarryThePenguin BarryThePenguin force-pushed the ci/matrix-hono-resolution branch 4 times, most recently from 102a3ab to 57075a8 Compare March 29, 2025 10:47
Copy link
Contributor Author

@BarryThePenguin BarryThePenguin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the all of the CI failures earlier @yusukebe , I had meant to create this PR in my own fork first 😅

If you think this PR will be useful, and a good direction to take, I can update the remaining workflows.

Due to existing issue with different workspaces using different versions of hono, I'm happy to focus on the workspaces that work, and fix the failing types or tests in future PRs

Comment on lines +15 to +18
strategy:
matrix:
hono-version: [hono@^3.0.0]
# hono-version: ['hono@^3.0.0', 'hono@^4.0.0']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure how useful this might be.. but I noticed different workspaces reference different versions of hono, so I thought it might be helpful to run CI against them

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
- run: yarn add ${{ matrix.hono-version }} --mode=update-lockfile
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Start by adding the current hono version, but do not install, just update the lock file

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
- run: yarn add ${{ matrix.hono-version }} --mode=update-lockfile
- run: yarn workspaces focus hono-middleware @hono/arktype-validator
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yarn workspaces focus will install the dependencies of the focused workspaces, including the selected version of hono

- run: yarn workspaces focus hono-middleware @hono/zod-openapi
- run: yarn workspace @hono/zod-openapi build
- run: yarn workspaces foreach --topological --recursive --from @hono/zod-openapi run build
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recessively build the dependencies of the current workspace

This is specifically for @hono/zod-openapi as it has a dependency on @hono/zod-validator which needs building first

@@ -68,6 +68,7 @@
"@typescript-eslint/parser": "^8.7.0",
"@vitest/coverage-istanbul": "^3.0.8",
"eslint": "^9.17.0",
"hono": "*",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting a single version in the root is enough to satisfy the peer dependencies of each workspace. It also ensures that there's only a single version installed at any one time.

@@ -44,7 +44,6 @@
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.4",
"ajv": ">=8.12.0",
"hono": "^4.4.12",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove any reference to hono in dev dependencies as the single reference in the root package.json is enough to satisfy the peer dependency

@@ -52,7 +51,7 @@
},
"dependencies": {
"@asteasolutions/zod-to-openapi": "^7.1.0",
"@hono/zod-validator": "npm:0.4.2"
"@hono/zod-validator": "workspace:^"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that CI builds dependencies of a workspace, the workspace: protocol can be used to reference @hono/zod-validator directly instead of from npm

@BarryThePenguin BarryThePenguin force-pushed the ci/matrix-hono-resolution branch from 5e4ea45 to e2b4f73 Compare March 29, 2025 12:41
@BarryThePenguin BarryThePenguin mentioned this pull request Mar 30, 2025
@BarryThePenguin BarryThePenguin force-pushed the ci/matrix-hono-resolution branch from e2b4f73 to 83bec6d Compare March 30, 2025 08:41
@yusukebe
Copy link
Member

@BarryThePenguin

In my opinion, this PR is unfortunately unnecessary because middleware basically only needs to support 4.x. There is no need to support older major versions, though we do not have a clearly documented support policy. I think what we need to do is to use 4.x in projects that use 3.x.

@BarryThePenguin
Copy link
Contributor Author

Ah.. you're right. We even discussed it in the original issue #990 (comment) 😅

I'll focus on 4.x 👍🏻

@BarryThePenguin BarryThePenguin deleted the ci/matrix-hono-resolution branch March 30, 2025 09:42
@yusukebe
Copy link
Member

@BarryThePenguin

Thank you so much for understanding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants