Add GitHub Actions workflow for automated testing (#26) #47
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.
Validation Workflow: Reliable Testing for
bootstrapper-script-generator
This pull request introduces an automated GitHub Actions workflow to validate the
bootstrapper-script-generator
CLI tool, ensuring that thebin
command consistently produces valid results with each pull request. The workflow simulates a real-world use case by generating and testing bootstrap scripts based on the project's own structure.Benefits
make-bootstrapper-script
command produces functional and consistent output with every update.test-output
) with the source (test-source
) to verify correctness.How It Works
Environment Setup:
pnpm
to install dependencies.pnpm build
command.Input Example:
test-source
, excluding unnecessary files (node_modules
,.git
, etc.).Installing the CLI:
npm pack
: Packages the project as a.tgz
file, simulating a published version of the CLI.npm install -g
: Installs the packaged.tgz
globally to test thebin
command (make-bootstrapper-script
).Script Generation and Execution:
make-bootstrapper-script
command, targeting thetest-source
directory.test-output
directory.Validation:
test-source
andtest-output
usingdiff
, checking for inconsistencies in structure and content.Debugging:
Key Features
npm install -g
), the workflow validates the usability of the published package.Testing Details
Input and Output Comparison:
rsync
to preparetest-source
as the input directory.diff
to validate the generatedtest-output
.File Normalization:
Debugging Differences:
This setup supports a process where a version bump is the last change merged before the updated version is published to npm. This final step adds an additional layer of validation to ensure that the npm package, including any version updates, functions correctly. By testing the package’s functionality in the CI/CD pipeline, it confirms the integrity of the package and verifies that it works as intended before being made publicly available.
Closes #26