Skip to content

Commit

Permalink
Test nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
duckception committed Aug 16, 2023
1 parent 8c6a4a0 commit b886b8d
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/disabled/e2e_headless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

- name: Run anvil
run: |
docker-compose -f docker-compose.ci.yml --profile foundry up --build --detach
docker-compose -f docker-compose.ci.yml --profile foundry --profile foundry-metamask-test-dapp up --build --detach
env:
ANVIL_FORK_URL: ${{ secrets.ANVIL_FORK_URL }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_cypress-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- name: Run anvil
run: |
docker-compose -f docker-compose.ci.yml --profile foundry up --build --detach
docker-compose -f docker-compose.ci.yml --profile foundry --profile foundry-metamask-test-dapp up --build --detach
env:
ANVIL_FORK_URL: ${{ secrets.ANVIL_FORK_URL }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- name: Run anvil
run: |
docker-compose -f docker-compose.ci.yml --profile foundry up --build --detach
docker-compose -f docker-compose.ci.yml --profile foundry --profile foundry-metamask-test-dapp up --build --detach
env:
ANVIL_FORK_URL: ${{ secrets.ANVIL_FORK_URL }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Run e2e tests (${{ matrix.resolution }} res)
run: |
docker-compose -f docker-compose.ci.yml --env-file ${{ matrix.resolution }}-res.env --profile synpress --profile foundry up --build --exit-code-from synpress
docker-compose -f docker-compose.ci.yml --env-file ${{ matrix.resolution }}-res.env --profile synpress --profile foundry --profile foundry-metamask-test-dapp up --build --exit-code-from synpress
env:
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_headful.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- name: Run anvil
run: |
docker-compose -f docker-compose.ci.yml --profile foundry up --build --detach
docker-compose -f docker-compose.ci.yml --profile foundry --profile foundry-metamask-test-dapp up --build --detach
env:
ANVIL_FORK_URL: ${{ secrets.ANVIL_FORK_URL }}

Expand Down
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ FROM --platform=linux/amd64 synthetixio/docker-e2e:18.16-ubuntu as base
RUN mkdir /app
WORKDIR /app

RUN apt update && apt install -y nginx

COPY nginx.conf /etc/nginx/sites-available/default

COPY package.json ./
COPY pnpm-lock.yaml ./

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,12 @@ Docker is awesome for CI. Give it a try.
2. `cd synpress`
3. (optional) Fill env vars inside `.env` file
4. (with foundry; preferred)
`docker-compose --profile synpress --profile foundry up --build --exit-code-from synpress`
`docker-compose --profile synpress --profile foundry --profile foundry-metamask-test-dapp up --build --exit-code-from synpress`
or `./start-tests.sh`
- (without foundry)
`docker-compose up --profile synpress --build --exit-code-from synpress`
5. (with foundry and ngrok)
`docker-compose --profile synpress --profile foundry --profile ngrok up --build --exit-code-from synpress`
`docker-compose --profile synpress --profile foundry --profile foundry-metamask-test-dapp --profile ngrok up --build --exit-code-from synpress`

All examples of setup are present in this repository. Just take a look around.

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
- ./docker/videos:/app/tests/e2e/videos
- ./docker/screenshots:/app/tests/e2e/screenshots
command: >
bash -c 'echo -n "======> local noVNC URL: http://localhost:8080/vnc.html?autoconnect=true " && pnpm wait-on http://display:8080 && echo -n "======> remote noVNC URL: " && curl -s ngrok:4040/api/tunnels | jq -r .tunnels[0].public_url && pnpm test:e2e:ci:anvil'
bash -c 'echo -n "======> local noVNC URL: http://localhost:8080/vnc.html?autoconnect=true " && pnpm wait-on http://display:8080 && echo -n "======> remote noVNC URL: " && curl -s ngrok:4040/api/tunnels | jq -r .tunnels[0].public_url && nginx && pnpm test:e2e:ci:anvil'
networks:
- x11

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
- ./docker/videos:/app/tests/e2e/videos
- ./docker/screenshots:/app/tests/e2e/screenshots
command: >
bash -c 'echo -n "======> local noVNC URL: http://localhost:8080/vnc.html?autoconnect=true " && pnpm wait-on http://display:8080 && echo -n "======> remote noVNC URL: " && curl -s ngrok:4040/api/tunnels | jq -r .tunnels[0].public_url && pnpm test:e2e:anvil'
bash -c 'echo -n "======> local noVNC URL: http://localhost:8080/vnc.html?autoconnect=true " && pnpm wait-on http://display:8080 && echo -n "======> remote noVNC URL: " && curl -s ngrok:4040/api/tunnels | jq -r .tunnels[0].public_url && nginx && pnpm test:e2e:anvil'
networks:
- x11

Expand Down
25 changes: 25 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
server {
listen 8545;
server_name localhost;

location / {
proxy_pass http://foundry:8545;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

server {
listen 8546;
server_name localhost;

location / {
proxy_pass http://foundry-metamask-test-dapp:8546;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
4 changes: 2 additions & 2 deletions start-tests-ci.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
docker-compose -f docker-compose.ci.yml --profile synpress --profile foundry up --build --exit-code-from synpress
docker-compose -f docker-compose.ci.yml --profile synpress --profile foundry --profile foundry-metamask-test-dapp up --build --exit-code-from synpress
# warning: it's not safe to use ngrok if you have secrets set as environmental variables
# (someone could connect to your CI and steal your vars)
# docker-compose -f docker-compose.ci.yml --profile synpress --profile foundry --profile ngrok up --build --exit-code-from synpress
# docker-compose -f docker-compose.ci.yml --profile synpress --profile foundry --profile foundry-metamask-test-dapp --profile ngrok up --build --exit-code-from synpress
2 changes: 1 addition & 1 deletion start-tests.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
docker-compose --profile synpress --profile foundry up --build --exit-code-from synpress
docker-compose --profile synpress --profile foundry --profile foundry-metamask-test-dapp up --build --exit-code-from synpress

0 comments on commit b886b8d

Please sign in to comment.