Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Run tests using Grid #304

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,27 @@ jobs:
python -m pip install --upgrade pip
pip install tox

- name: Setup Firefox
- name: Spin up Grid
if: matrix.os == 'ubuntu-latest'
uses: browser-actions/setup-firefox@latest
with:
firefox-version: latest

- name: Setup Geckodriver
if: matrix.os == 'ubuntu-latest'
uses: browser-actions/setup-geckodriver@latest

- name: Setup Chrome
uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable

- name: Setup Chromedriver
uses: nanasess/setup-chromedriver@master
run: ./start

# - name: Setup Firefox
# if: matrix.os == 'ubuntu-latest'
# uses: browser-actions/setup-firefox@latest
# with:
# firefox-version: latest
#
# - name: Setup Geckodriver
# if: matrix.os == 'ubuntu-latest'
# uses: browser-actions/setup-geckodriver@latest
#
# - name: Setup Chrome
# uses: browser-actions/setup-chrome@latest
# with:
# chrome-version: stable
#
# - name: Setup Chromedriver
# uses: nanasess/setup-chromedriver@master

- name: Cache tox environments
uses: actions/cache@v3
Expand All @@ -70,7 +74,7 @@ jobs:

- name: Test
if: matrix.os == 'ubuntu-latest'
run: tox -e ${{ matrix.tox_env }}
run: tox -e ${{ matrix.tox_env }} -- --html={envlogdir}/report.html --self-contained-html

- name: Test (skip firefox on windows)
if: matrix.os == 'windows-latest'
Expand Down
61 changes: 61 additions & 0 deletions docker-compose.arm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# To execute this docker-compose yml file use `docker-compose -f docker-compose.intel.yml up`
# Add the `-d` flag at the end for detached execution
# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3.yml down`
version: "3"

services:

chromium:
image: seleniarm/node-chromium:latest
container_name: selenium-chromium
shm_size: 2gb
ports:
- "7901:7900"
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
networks:
- grid

firefox:
image: seleniarm/node-firefox:latest
container_name: selenium-firefox
shm_size: 2gb
ports:
- "7903:7900"
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
networks:
- grid

selenium-hub:
image: seleniarm/hub:latest
container_name: selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"
networks:
- grid

webserver:
container_name: webserver
build:
context: docker/
environment:
- PYTHONDONTWRITEBYTECODE=1
networks:
- grid
depends_on:
- firefox
- chromium

networks:
grid:
77 changes: 77 additions & 0 deletions docker-compose.intel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# To execute this docker-compose yml file use `docker-compose -f docker-compose.intel.yml up`
# Add the `-d` flag at the end for detached execution
# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3.yml down`
version: "3"

services:

chrome:
image: selenium/node-chrome:latest
container_name: selenium-chrome
shm_size: 2gb
ports:
- "5901:5900"
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
networks:
- grid

edge:
image: selenium/node-edge:latest
container_name: selenium-edge
shm_size: 2gb
ports:
- "5902:5900"
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
networks:
- grid

firefox:
image: selenium/node-firefox:latest
container_name: selenium-firefox
shm_size: 2gb
ports:
- "5903:5900"
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
networks:
- grid

selenium-hub:
image: selenium/hub:latest
container_name: selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"
networks:
- grid

webserver:
container_name: webserver
build:
context: docker/
environment:
- PYTHONDONTWRITEBYTECODE=1
networks:
- grid
depends_on:
- firefox
- chrome
- edge

networks:
grid:
14 changes: 14 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM python:3.10-slim-buster

WORKDIR /usr/src/app

ENV FLASK_APP=webserver.py
ENV FLASK_RUN_HOST=0.0.0.0
ENV FLASK_RUN_PORT=80

RUN python -m pip install --upgrade pip && \
pip install flask

COPY webserver.py .

CMD ["flask", "run"]
8 changes: 8 additions & 0 deletions docker/webserver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from flask import Flask

app = Flask(__name__)


@app.route("/")
def home():
return """<h1>Success!</h1><a href="#">Link</a><p>Ё</p>"""
Empty file added geckodriver.log
Empty file.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ black = ">=22.1.0"
flake8 = ">=4.0.1"
tox = ">=3.24.5"
pre-commit = ">=2.17.0"
pytest-localserver = ">=0.5.0"
pytest-xdist = ">=2.4.0"
pytest-mock = ">=3.6.1"

Expand Down
Loading