Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
abernier committed Jul 27, 2024
1 parent 7bdd47b commit 56e6984
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 102 deletions.
6 changes: 0 additions & 6 deletions .dockerignore

This file was deleted.

8 changes: 1 addition & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ jobs:
group: ${{ github.event_name != 'pull_request' && 'group-pushmain' || github.run_id }}
cancel-in-progress: ${{ github.event_name != 'pull_request' }}

container:
image: ghcr.io/pmndrs/playwright:main
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

steps:
# Build
- uses: actions/checkout@v4
Expand All @@ -43,7 +37,7 @@ jobs:
BASE_PATH: ${{ steps.configurepages.outputs.base_path }}

# Tests (only for PRs)
- run: npm test
- run: ./docker.sh
if: github.event_name == 'pull_request'
env:
BASE_PATH: ${{ steps.configurepages.outputs.base_path }}
Expand Down
84 changes: 0 additions & 84 deletions Dockerfile

This file was deleted.

16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ Pre-requisites:
$ npm test
```
To update the snapshots: `npm test -- -- --update-snapshots`
> [!IMPORTANT]
> If you built the project with eg. `BASE_PATH=/examples` you'll need to:
>
Expand All @@ -74,13 +76,17 @@ $ npm test
For reproductible snapshots, we use docker to run the tests:
```sh
$ docker build -t pmndrs-examples --progress=plain .
$ docker run --init -it --rm --ipc=host \
-v $(pwd)/packages/examples/snapshot.test.js-snapshots/:/app/packages/examples/snapshot.test.js-snapshots/ \
pmndrs-examples sh -c "npm run build && npm test"
$ ./docker.sh
```
To update the snapshots: `npm test -- -- --update-snapshots`
To update the snapshots: `./docker.sh --update`
> [!IMPORTANT]
> If you built the project with eg. `BASE_PATH=/examples` you'll need to:
>
> ```sh
> $ BASE_PATH=/examples ./docker.sh
> ```
# Colophon
Expand Down
15 changes: 15 additions & 0 deletions docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

# Check if BASE_PATH is set and prepare the argument
BASE_PATH_ARG=""
if [ -n "$BASE_PATH" ]; then
BASE_PATH_ARG="-e BASE_PATH=$BASE_PATH"
fi

# Check for the --update flag
UPDATE_FLAG=""
if [ "$1" = "--update" ]; then
UPDATE_FLAG="-- -- --update-snapshots"
fi

docker run --rm --init -v "$(pwd)":/app -w /app $BASE_PATH_ARG node:20-bookworm /bin/bash -c "npm install && npx -y [email protected] install --with-deps chromium && npm run test $UPDATE_FLAG"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 56e6984

Please sign in to comment.