ci: run tests on pull requests and pushes to main - #3
Merged
Merged
Conversation
publish.yml only triggers on version tag pushes, so a regression is caught at publish time, not before. Add a CI workflow that runs npm test on every PR and every push to main, mirroring the shape of butterstack-connector's ci.yml.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The only workflow in this repo,
.github/workflows/publish.yml, triggers exclusively onv*.*.*tag pushes. Tests never run on a pull request or on a push to main, so a regression is only caught at publish time, which is too late.Change
Adds
.github/workflows/ci.yml:mainand on pull requests targetingmain.cli-node) onubuntu-latest,timeout-minutes: 10.actions/checkout@v7) and sets up Node from.nvmrc(actions/setup-node@v7), matching howpublish.ymlpicks its Node version.npm test, which isnode --test.No install step.
package.jsonhas nodependenciesand nodevDependencies, and there is nopackage-lock.json, sonpm ciwould fail on a missing lockfile and add nothing.No lint or build step. There is no
tsconfig.json, no.tssource, and nolint,build, ortypecheckscript inpackage.jsonto gate the PR on. The CLI is plain Node (bin/butteris a shebang script), not TypeScript.Does not touch
publish.yml,README.md,package.json, or any test/source file.Stacking note
This stacks alongside #2 (
ci/tag-version-guard-and-github-release), which adds a tag-version guard and GitHub Release creation topublish.yml. The two PRs touch different files (publish.ymlthere, a newci.ymlhere) and do not conflict.Verification
Ran locally, matching the workflow's steps exactly:
actions/checkout@v7andactions/setup-node@v7were confirmed as the current major release before use.