forked from icd/rentgen
refactor: move Docker testing to pre-commit hook
- 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 <noreply@anthropic.com>
This commit is contained in:
parent
28e6e32e25
commit
86f5c86f4f
52
README.md
52
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
|
||||
|
||||
21
tests/pre-commit
Executable file
21
tests/pre-commit
Executable file
@ -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!"
|
||||
Loading…
x
Reference in New Issue
Block a user