From df1325d82920c2b9879c6ddbc9d42763c0cbdc31 Mon Sep 17 00:00:00 2001 From: Tove Rumar Date: Wed, 10 Jul 2024 13:16:59 +0200 Subject: [PATCH 1/3] Add workflow for running sanity tests on mac. Rename other workflow files accordingly --- .../workflows/crazylab-linux-experiment.yml | 0 .../workflows/crazylab-linux.yml | 0 .github/workflows/crazylab-mac.yml | 43 +++++++++++++++++++ 3 files changed, 43 insertions(+) rename ".github/workflows/crazylab-malm\303\266-experiment.yml" => .github/workflows/crazylab-linux-experiment.yml (100%) rename ".github/workflows/crazylab-malm\303\266.yml" => .github/workflows/crazylab-linux.yml (100%) create mode 100644 .github/workflows/crazylab-mac.yml diff --git "a/.github/workflows/crazylab-malm\303\266-experiment.yml" b/.github/workflows/crazylab-linux-experiment.yml similarity index 100% rename from ".github/workflows/crazylab-malm\303\266-experiment.yml" rename to .github/workflows/crazylab-linux-experiment.yml diff --git "a/.github/workflows/crazylab-malm\303\266.yml" b/.github/workflows/crazylab-linux.yml similarity index 100% rename from ".github/workflows/crazylab-malm\303\266.yml" rename to .github/workflows/crazylab-linux.yml diff --git a/.github/workflows/crazylab-mac.yml b/.github/workflows/crazylab-mac.yml new file mode 100644 index 0000000..5826c0c --- /dev/null +++ b/.github/workflows/crazylab-mac.yml @@ -0,0 +1,43 @@ +name: Crazy Stab Lab Mac 🗡️ + +# Controls when the action will run. +on: + workflow_dispatch: +jobs: + #TODO add flashing of crazyflies + checkout_sources: + runs-on: [self-hosted, macOS] + steps: + - name: Check out sources + uses: actions/checkout@v4 + + sanity_testsuite_on_mac: + needs: checkout_sources + runs-on: [self-hosted, macOS] + strategy: + matrix: + python_version: ["3.8","3.9", "3.10", "3.11"] + fail-fast: false + env: + CRAZY_SITE: crazylab-mac + PYTHON_VERSION: ${{ matrix.python_version }} + timeout-minutes: 120 + steps: + - name: Setup python environment + run: | + $(brew --prefix)/bin/python${PYTHON_VERSION} -m venv venv + source venv/bin/activate + + - name: Install pytest + run: venv/bin/pip install pytest + + - name: Install Crazyflie python library + run: venv/bin/pip install git+https://github.com/bitcraze/crazyflie-lib-python.git@master + + - name: Install requirements + run: | + venv/bin/pip install -r requirements.txt + - name: Run test suite + run: venv/bin/python -m pytest --verbose -m sanity tests/QA + + From 48cfe98dca1838a4856fe0067780b91f25fe8b91 Mon Sep 17 00:00:00 2001 From: Tove Rumar Date: Wed, 10 Jul 2024 13:18:24 +0200 Subject: [PATCH 2/3] Add sanity mark to specific tests that should be run in a sanity job. These are chosen based on being basic functionality, and some performance testing on the radio. These are all things that could be affected by changes easily and are good to run as a sanity job --- pytest.ini | 1 + tests/QA/test_log.py | 2 ++ tests/QA/test_param.py | 5 ++++- tests/QA/test_radio.py | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pytest.ini b/pytest.ini index c02d292..d52ae28 100644 --- a/pytest.ini +++ b/pytest.ini @@ -9,3 +9,4 @@ markers = requirements: other requirements that a test needs to run exclude_decks: decks that makes a test not runnable ignore: ignore a test + sanity: sanity tests diff --git a/tests/QA/test_log.py b/tests/QA/test_log.py index e0830ff..70d0f0a 100644 --- a/tests/QA/test_log.py +++ b/tests/QA/test_log.py @@ -23,6 +23,7 @@ class TestLogVariables: + @pytest.mark.sanity def test_log_async(self, test_setup: conftest.DeviceFixture): ''' Make sure we receive ~100 rows 1 second at 100Hz ''' requirement = conftest.get_requirement('logging.basic') @@ -127,6 +128,7 @@ def test_log_too_much_per_block(self, test_setup: conftest.DeviceFixture): with pytest.raises(AttributeError): test_setup.device.cf.log.add_config(config) + @pytest.mark.sanity @pytest.mark.exclude_decks('bcDWM1000','bcFlow', 'bcFlow2', 'lighthouse4') def test_log_stress(self, test_setup: conftest.DeviceFixture): ''' diff --git a/tests/QA/test_param.py b/tests/QA/test_param.py index 5431d37..fe8ff5f 100644 --- a/tests/QA/test_param.py +++ b/tests/QA/test_param.py @@ -26,6 +26,7 @@ class TestParameters: + @pytest.mark.sanity def test_param_ronly(self, test_setup: conftest.DeviceFixture): with ValidatedSyncCrazyflie(test_setup.device.link_uri) as scf: # Get a known (core) read-only parameter @@ -58,6 +59,7 @@ def test_param_extended_type(self, test_setup: conftest.DeviceFixture): assert not element.is_extended() assert not element.is_persistent() + @pytest.mark.sanity def test_param_persistent_store(self, test_setup: conftest.DeviceFixture): # Get a known persistent parameter param = "sound.effect" @@ -97,7 +99,8 @@ def store_cb(name, success): val = test_setup.device.cf.param.get_value(param) assert int(val) == value - + + @pytest.mark.sanity def test_param_persistent_clear(self, test_setup: conftest.DeviceFixture): assert test_setup.device.connect_sync() diff --git a/tests/QA/test_radio.py b/tests/QA/test_radio.py index 05c100a..809b41e 100644 --- a/tests/QA/test_radio.py +++ b/tests/QA/test_radio.py @@ -26,7 +26,7 @@ logger = logging.getLogger(__name__) - +@pytest.mark.sanity class TestRadio: def test_latency_small_packets(self, dev: conftest.BCDevice): requirement = conftest.get_requirement('radio.latencysmall') From c6f621e06b6bf43df7ca5c254b1bcbd916f62870 Mon Sep 17 00:00:00 2001 From: Tove Rumar Date: Wed, 10 Jul 2024 13:39:46 +0200 Subject: [PATCH 3/3] Schedule mac sanity job at 03 every night. Should be enough time for the linux job to finish. We dont want them overlapping bc of radio traffic in the lab --- .github/workflows/crazylab-mac.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/crazylab-mac.yml b/.github/workflows/crazylab-mac.yml index 5826c0c..09b1f5d 100644 --- a/.github/workflows/crazylab-mac.yml +++ b/.github/workflows/crazylab-mac.yml @@ -3,6 +3,8 @@ name: Crazy Stab Lab Mac 🗡️ # Controls when the action will run. on: workflow_dispatch: + schedule: + - cron: '0 3 * * *' jobs: #TODO add flashing of crazyflies checkout_sources: