Skip to content

Commit

Permalink
Merge pull request #682 from StanfordVL/split-tests
Browse files Browse the repository at this point in the history
Run tests faster (and make them easier to re-run) by splitting them up
  • Loading branch information
cgokmen authored Apr 10, 2024
2 parents bccbbd7 + 293d3fa commit aa0c759
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 6 deletions.
46 changes: 42 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,25 @@ concurrency:
cancel-in-progress: true

jobs:
test:
run_test:
name: Run Tests
runs-on: [self-hosted, linux, gpu, dataset-enabled]

strategy:
matrix:
test_file:
- test_dump_load_states
- test_envs
- test_object_removal
- test_object_states
- test_primitives
- test_robot_states
- test_robot_teleoperation
- test_sensors
- test_symbolic_primitives
- test_systems
- test_transition_rules

defaults:
run:
shell: micromamba run -n omnigibson /bin/bash -leo pipefail {0}
Expand All @@ -40,14 +55,37 @@ jobs:

- name: Run tests
working-directory: omnigibson-src
run: pytest --junitxml=results.xml
run: pytest tests/${{ matrix.test_file }}.py --junitxml=${{ matrix.test_file }}.xml && cp ${{ matrix.test_file }}.xml ${GITHUB_WORKSPACE}/

- name: Deploy artifact
uses: actions/upload-artifact@v3
with:
name: ${{ github.run_id }}-tests-${{ matrix.test_file }}
path: ${{ matrix.test_file }}.xml

- name: Test Report
upload_report:
name: Compile Report
runs-on: [self-hosted, linux]
defaults:
run:
shell: micromamba run -n omnigibson /bin/bash -leo pipefail {0}
needs: [run_test]
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
submodules: true
path: omnigibson-src
- name: Pull reports
uses: actions/download-artifact@v3
with:
path: omnigibson-src
- name: Test Report0
uses: dorny/test-reporter@v1
with:
name: Test Results
working-directory: omnigibson-src
path: results.xml
path: ${{ github.run_id }}-tests-*/test_*.xml
reporter: java-junit
fail-on-error: 'true'
fail-on-empty: 'true'
Expand Down
3 changes: 2 additions & 1 deletion tests/test_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ def test_rs_int_full_load():
}

# Make sure sim is stopped
og.sim.stop()
if og.sim:
og.sim.stop()

# Make sure GPU dynamics are enabled (GPU dynamics needed for cloth)
gm.ENABLE_OBJECT_STATES = True
Expand Down
4 changes: 4 additions & 0 deletions tests/test_primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
from omnigibson.objects.dataset_object import DatasetObject


# Make sure that Omniverse is launched before setting up the tests.
og.launch()


def setup_environment(load_object_categories):
cfg = {
"scene": {
Expand Down
3 changes: 2 additions & 1 deletion tests/test_symbolic_primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@


def start_env():
og.sim.stop()
if og.sim:
og.sim.stop()
config = {
"env": {"initial_pos_z_offset": 0.1},
"render": {"viewer_width": 1280, "viewer_height": 720},
Expand Down

0 comments on commit aa0c759

Please sign in to comment.