diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d9727c8..fb5623c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -78,3 +78,33 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: skip-existing: true + + docker: + needs: pypi + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - uses: actions/checkout@v4 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=semver,pattern={{version}} + type=raw,value=latest,enable=${{ !github.event.release.prerelease }} + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f6a1468 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.12-slim + +# Install git since becwright shells out to git commands +RUN apt-get update && \ + apt-get install -y --no-install-recommends git && \ + rm -rf /var/lib/apt/lists/* + +# Install becwright from PyPI +RUN pip install --no-cache-dir becwright + +# Set entrypoint to run becwright automatically +ENTRYPOINT ["becwright"] diff --git a/documentation/recipes.es.md b/documentation/recipes.es.md index cb110e2..4b188a2 100644 --- a/documentation/recipes.es.md +++ b/documentation/recipes.es.md @@ -170,6 +170,30 @@ jobs: Marcalo como check *required* en la protección de rama y las reglas ya no se pueden saltar con `git commit --no-verify`. +## CI: Docker y GitLab CI (o entornos genéricos) + +Para entornos de CI que soportan contenedores Docker (como GitLab CI o Jenkins), o para ejecutar validaciones sin instalar Python localmente, puedes usar la imagen oficial de Docker. + +Ejecuta el contenedor montando la raíz de tu repositorio como volumen: + +```sh +docker run --rm -v "$PWD:/repo" -w /repo ghcr.io/datadave-dev/becwright check --diff origin/main +``` + +### Integración con GitLab CI + +Agrega el siguiente trabajo a tu `.gitlab-ci.yml`: + +```yaml +becwright: + stage: test + image: + name: ghcr.io/datadave-dev/becwright:latest + entrypoint: [""] + script: + - becwright check --diff origin/main +``` + ## Framework pre-commit `.pre-commit-config.yaml`: diff --git a/documentation/recipes.md b/documentation/recipes.md index ae4d513..8039425 100644 --- a/documentation/recipes.md +++ b/documentation/recipes.md @@ -163,6 +163,30 @@ jobs: Make it a *required* check in branch protection and the rules can no longer be skipped with `git commit --no-verify`. +## CI: Docker & GitLab CI (or generic environments) + +For CI environments that support Docker containers (such as GitLab CI or Jenkins), or to run checks without installing Python locally, you can use the official Docker image. + +Run the container by mounting your repository root as a volume: + +```sh +docker run --rm -v "$PWD:/repo" -w /repo ghcr.io/datadave-dev/becwright check --diff origin/main +``` + +### GitLab CI Integration + +Add the following job to your `.gitlab-ci.yml`: + +```yaml +becwright: + stage: test + image: + name: ghcr.io/datadave-dev/becwright:latest + entrypoint: [""] + script: + - becwright check --diff origin/main +``` + ## pre-commit framework `.pre-commit-config.yaml`: