Skip to content

Commit

Permalink
Align tox and CI jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
jsfehler committed May 27, 2024
1 parent c22898a commit dca66ab
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 38 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This is a basic workflow to help you get started with Actions

name: CI-Lint

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [master]
pull_request:
branches: [master]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: 3.x

- name: install pre-commit
run: pip install pre-commit

- name: pre-commit cache
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: "pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}"
restore-keys: "pre-commit-"

- run: pre-commit run --all-files --show-diff-on-failure
4 changes: 2 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
workflow_dispatch:

jobs:
selenium:
tests_selenium_safari:
runs-on: macos-latest

strategy:
Expand Down Expand Up @@ -61,4 +61,4 @@ jobs:
run: |
gtimeout 60 bash -c 'while ! wget -O /dev/null -T 1 http://localhost:4444/readyz; do echo waiting for selenium server; sleep 1; done' || (cat selenium-standalone.log && exit 2)
tox -e tests_macos_selenium -- --cache-clear -n 1 tests || tox -e tests_macos_selenium -- -n 1 --last-failed --last-failed-no-failures none
tox -e tests_selenium_safari -- --cache-clear -n 1 tests || tox -e tests_selenium_safari -- -n 1 --last-failed --last-failed-no-failures none
35 changes: 7 additions & 28 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
tests:
runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -45,13 +45,13 @@ jobs:

- name: Run tests
run: |
tox -e tests -- -n 4 tests/test_browser.py tests/test_element_list.py tests/test_request_handler.py tests/test_xpath_concat.py
tox -e tests_splinter -- -n 4
- name: Run non-webdriver driver tests
run: |
tox -e tests -- -n 4 tests/test_flaskclient.py tests/test_zopetestbrowser.py tests/test_djangoclient.py tests/test_is_element_present_nojs.py
tox -e tests_lxml_drivers -- -n 4
selenium_remote:
tests_selenium_remote:
runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -91,9 +91,9 @@ jobs:
xvfb-run java -jar selenium-server.jar standalone > selenium-server.log 2>&1 &
timeout 60 bash -c 'while ! wget -O /dev/null -T 1 http://localhost:4444/readyz; do echo waiting for selenium server; sleep 1; done' || (cat selenium-server.log && exit 2)
echo "Selenium server is ready, running tests"
tox -e tests_selenium -- tests/test_webdriver_remote.py
tox -e tests_selenium
selenium:
tests_selenium:
runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -122,25 +122,4 @@ jobs:

- name: Run Selenium tests
run: |
tox -e tests_selenium -- -n 4 tests/test_element_is_visible.py tests/test_screenshot.py tests/test_shadow_root.py tests/test_mouse_interaction.py tests/test_async_finder.py tests/test_html_snapshot.py tests/test_iframes.py tests/test_popups.py tests/test_webdriver.py tests/test_webdriver_firefox.py tests/test_webdriver_chrome.py;
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: 3.x

- name: install pre-commit
run: pip install pre-commit

- name: pre-commit cache
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: "pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}"
restore-keys: "pre-commit-"

- run: pre-commit run --all-files --show-diff-on-failure
tox -e tests_selenium -- -n 4;
4 changes: 2 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
workflow_dispatch:

jobs:
selenium:
tests_selenium_edge:
runs-on: windows-latest

strategy:
Expand Down Expand Up @@ -44,4 +44,4 @@ jobs:

- name: Run tests for windows-only drivers
run: |
tox -e tests_windows_selenium -- -n 4 tests/test_webdriver.py tests/test_popups.py tests/test_webdriver_edge_chromium.py;
tox -e tests_selenium_edge -- -n 4;
24 changes: 18 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
[testenv:tests]
[testenv:tests_splinter]
deps = -rrequirements/test.txt
commands =
pytest --ignore-flaky -v {posargs} tests/test_browser.py tests/test_element_list.py tests/test_request_handler.py tests/test_xpath_concat.py

[testenv:tests_lxml_drivers]
extras = zope.testbrowser, django, flask
deps = -rrequirements/test.txt
commands =
pytest --ignore-flaky -v {posargs}
pytest --ignore-flaky -v {posargs} tests/test_flaskclient.py tests/test_zopetestbrowser.py tests/test_djangoclient.py tests/test_is_element_present_nojs.py

[testenv:tests_selenium]
extras = selenium
deps =
-rrequirements/test.txt
commands =
pytest --ignore-flaky -m "not macos" -v {posargs}
pytest --ignore-flaky -m "not macos" -v {posargs} tests/test_element_is_visible.py tests/test_screenshot.py tests/test_shadow_root.py tests/test_mouse_interaction.py tests/test_async_finder.py tests/test_html_snapshot.py tests/test_iframes.py tests/test_popups.py tests/test_webdriver.py tests/test_webdriver_firefox.py tests/test_webdriver_chrome.py

[testenv:tests_selenium_remote]
extras = selenium
deps =
-rrequirements/test.txt
commands =
pytest --ignore-flaky -v {posargs} tests/test_webdriver_remote.py

[testenv:tests_windows_selenium]
[testenv:tests_selenium_edge]
extras = selenium
deps =
-rrequirements\test_windows.txt
passenv =
EDGEWEBDRIVER
commands =
pytest --ignore-flaky -v {posargs}
pytest --ignore-flaky -v {posargs} tests/test_webdriver.py tests/test_popups.py tests/test_webdriver_edge_chromium.py

[testenv:tests_macos_selenium]
[testenv:tests_selenium_safari]
extras = selenium
deps =
-rrequirements/test.txt
Expand Down

0 comments on commit dca66ab

Please sign in to comment.