Skip to content

Commit c1c9f09

Browse files
authored
Merge pull request #116 from ServiceNow/instance-pool-ci
Continuous integration of instances in the pool
2 parents c6f28c6 + 054958a commit c1c9f09

File tree

3 files changed

+62
-6
lines changed

3 files changed

+62
-6
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Monitor the pool of WorkArena instances
2+
3+
on:
4+
workflow_dispatch: # allow manual trigger
5+
schedule:
6+
- cron: "0 3 * * *" # daily at 03:00 UTC (adjust as needed)
7+
8+
jobs:
9+
browsergym-workarena-fast:
10+
runs-on: ubuntu-22.04
11+
12+
defaults:
13+
run:
14+
shell: bash -l {0}
15+
16+
steps:
17+
- name: Checkout Repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.12'
24+
cache: 'pip'
25+
26+
- name: Pip install
27+
working-directory: ./dev
28+
run: pip install -r requirements.txt
29+
30+
- name: Pip list
31+
run: pip list
32+
33+
- name: Install Playwright
34+
run: playwright install chromium --with-deps
35+
36+
- name: Run instance checks
37+
run: pytest -n 5 --durations=10 --slowmo 1000 -v tests/test_snow_instance.py tests/test_task_general.py

.github/workflows/unit_tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
run: black . --check
3737

3838
browsergym-workarena-fast:
39-
runs-on: ubuntu-latest
39+
runs-on: ubuntu-22.04
4040

4141
defaults:
4242
run:
@@ -50,7 +50,7 @@ jobs:
5050
- name: Set up Python
5151
uses: actions/setup-python@v5
5252
with:
53-
python-version: '3.10'
53+
python-version: '3.12'
5454
cache: 'pip' # caching pip dependencies
5555

5656
- name: Pip install
@@ -59,9 +59,9 @@ jobs:
5959

6060
- name: Pip list
6161
run: pip list
62-
62+
6363
- name: Install Playwright
64-
run: playwright install --with-deps
64+
run: playwright install chromium --with-deps
6565

6666
- name: Run non-slow browsergym-workarena Unit Tests
6767
env:

tests/test_task_general.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@
1515
from tenacity import retry, stop_after_attempt, retry_if_exception_type
1616

1717
from browsergym.workarena import ATOMIC_TASKS
18+
from browsergym.workarena.instance import SNowInstance, fetch_instances
19+
20+
INSTANCE_POOL = fetch_instances()
21+
22+
if not INSTANCE_POOL:
23+
pytest.skip(
24+
"No ServiceNow instances available from fetch_instances().", allow_module_level=True
25+
)
26+
27+
28+
@pytest.fixture(
29+
scope="session", params=INSTANCE_POOL, ids=[entry["url"] for entry in INSTANCE_POOL]
30+
)
31+
def snow_instance_entry(request):
32+
return request.param
1833

1934

2035
@retry(
@@ -26,8 +41,12 @@
2641
@pytest.mark.parametrize("task_entrypoint", ATOMIC_TASKS)
2742
@pytest.mark.parametrize("random_seed", range(1))
2843
@pytest.mark.slow
29-
def test_cheat(task_entrypoint, random_seed: int, page: Page):
30-
task = task_entrypoint(seed=random_seed)
44+
def test_cheat(task_entrypoint, random_seed: int, page: Page, snow_instance_entry):
45+
instance = SNowInstance(
46+
snow_url=snow_instance_entry["url"],
47+
snow_credentials=("admin", snow_instance_entry["password"]),
48+
)
49+
task = task_entrypoint(seed=random_seed, instance=instance)
3150
goal, info = task.setup(page=page)
3251
chat_messages = []
3352
reward, done, message, info = task.validate(page, chat_messages)

0 commit comments

Comments
 (0)