From 86f5c86f4f000243950ef1e0154a0eb1adfb744a Mon Sep 17 00:00:00 2001 From: Jacek Wielemborek Date: Sun, 26 Oct 2025 18:10:43 +0100 Subject: [PATCH] refactor: move Docker testing to pre-commit hook MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Created tests/pre-commit hook that builds and runs all tests - Removed Docker usage documentation from README - Hook runs code_quality and integration_test stages sequentially 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- README.md | 52 ------------------------------------------------ tests/pre-commit | 21 +++++++++++++++++++ 2 files changed, 21 insertions(+), 52 deletions(-) create mode 100755 tests/pre-commit diff --git a/README.md b/README.md index faa7358..e168bed 100644 --- a/README.md +++ b/README.md @@ -41,58 +41,6 @@ Firefox: https://addons.mozilla.org/en-US/firefox/addon/rentgen/ 3. Click _Load Temporary Add-on..._ button 4. Pick the zip archive from last step of build process. -## Docker Usage - -### Build and extract artifacts directly - -```bash -docker buildx build . --output artifacts -``` - -This will build the extension and extract the `.zip` file to the `artifacts/` directory. - -### Build with tests (typecheck + lint) - -```bash -docker build --target test -t rentgen-test . -``` - -### Traditional build (creates full development environment) - -```bash -docker build -t rentgen . -docker run --rm rentgen ls -lh /app/web-ext-artifacts/ -``` - -### Run commands in the container - -```bash -docker run --rm rentgen npm run build:chrome -docker run --rm rentgen npm run typecheck -``` - -### Run extension in Firefox (headless) - -```bash -docker build --target runtime -t rentgen-run . -docker run --rm -it rentgen-run -``` - -### Using docker-compose - -```bash -docker compose up rentgen_check # Build only -docker compose up rentgen_run # Run in Firefox -docker compose up rentgen_verify # Build and verify with tests -``` - -### Using npm scripts (recommended for testing) - -```bash -npm run docker:verify # Build, test, and verify extension (exits with error if verification fails) -npm run docker:clean # Clean up Docker resources -``` - ## Issue tracker If you find a problem, please send us an email: kontakt@internet-czas-dzialac.pl diff --git a/tests/pre-commit b/tests/pre-commit new file mode 100755 index 0000000..e04963a --- /dev/null +++ b/tests/pre-commit @@ -0,0 +1,21 @@ +#!/bin/bash +# Pre-commit hook for Rentgen extension +# Builds and runs verification tests before allowing commit + +set -e + +echo "Running pre-commit checks..." + +# Build all stages +echo "Building Docker images..." +docker compose build + +# Run code quality checks (typecheck + lint) +echo "Running code quality checks..." +docker compose up --abort-on-container-exit --exit-code-from rentgen_check rentgen_check + +# Run integration tests +echo "Running integration tests..." +docker compose up --abort-on-container-exit --exit-code-from rentgen_verify rentgen_verify + +echo "✓ All pre-commit checks passed!"