From 5d15060f05ba32db28df1bd573a2582f5ffc014a Mon Sep 17 00:00:00 2001 From: Arthur Bit-Monnot Date: Thu, 11 Jul 2024 11:29:11 +0200 Subject: [PATCH 1/2] test(up): Add UP tests specific to aries in the repository. --- justfile | 4 +-- .../unified/plugin/up_aries_tests/__init__.py | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 planning/unified/plugin/up_aries_tests/__init__.py diff --git a/justfile b/justfile index 74964eae..41f9c7c6 100644 --- a/justfile +++ b/justfile @@ -6,11 +6,11 @@ ci: ci-up-solve ci-up-val # Run planning tests for UP integration ci-up-solve: - python3 planning/unified/deps/unified-planning/up_test_cases/report.py aries + python3 planning/unified/deps/unified-planning/up_test_cases/report.py aries -e up_aries_tests # Run validation tests for UP integration ci-up-val: - python3 planning/unified/deps/unified-planning/up_test_cases/report.py aries-val + python3 planning/unified/deps/unified-planning/up_test_cases/report.py aries-val -e up_aries_tests # Solve a UP test case up-solve problem: diff --git a/planning/unified/plugin/up_aries_tests/__init__.py b/planning/unified/plugin/up_aries_tests/__init__.py new file mode 100644 index 00000000..3f1611bb --- /dev/null +++ b/planning/unified/plugin/up_aries_tests/__init__.py @@ -0,0 +1,26 @@ +from unified_planning.shortcuts import * +from unified_planning.test import TestCase +import unified_planning.model.scheduling as sched + + +def get_test_cases(): + """Creates on test case for each function starting with `test_` in the file""" + res = {} + gens = [(name.removeprefix('test_'), fn) for name, fn in globals().items() + if callable(fn) and fn.__module__ == __name__ and name.startswith('test_')] + + for (name, generator) in gens: + print(name) + res[name] = generator() + + return res + + +def test_sched_bool_param(): + problem = sched.SchedulingProblem() + + a = problem.add_activity('a', 10) + + a.add_parameter('p', BoolType()) + + return TestCase(problem=problem, solvable=True) From 694b8f788eaaef72dcaad6656558871e8a04f6ce Mon Sep 17 00:00:00 2001 From: Arthur Bit-Monnot Date: Thu, 11 Jul 2024 14:10:39 +0200 Subject: [PATCH 2/2] ci: use just rules for CI --- .github/workflows/aries.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/aries.yml b/.github/workflows/aries.yml index 49fb758d..2f87e59d 100644 --- a/.github/workflows/aries.yml +++ b/.github/workflows/aries.yml @@ -88,14 +88,12 @@ jobs: run: git submodule update --init # get our own copy of unified-planing repos - name: Install python dependencies run: python3 -m pip install -r planning/unified/requirements.txt "numpy<2" - - name: Validator tests - run: | - source planning/unified/dev.env - python3 planning/unified/deps/unified-planning/up_test_cases/report.py aries-val + - name: Install just + run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to . - name: Solver tests - run: | - source planning/unified/dev.env - python3 planning/unified/deps/unified-planning/up_test_cases/report.py aries + run: ./just ci-up-solve + - name: Validator tests + run: ./just ci-up-val tests: # Meta-job that only requires all test-jobs to pass