From 95dc1457df5b9d38ae4ce1fb23639cee9db38f9a Mon Sep 17 00:00:00 2001 From: Marcin Niestroj Date: Thu, 3 Oct 2024 13:31:32 +0200 Subject: [PATCH] ci: hil: prefer single-line pip invocations Install dependencies using single invocation to 'pip', so that: * Python interpreter is loaded once * dependencies resolution is calculated once This saves about 15% of execution time (9.5s -> 8s on Ryzen 5950X). Signed-off-by: Marcin Niestroj --- .github/workflows/hil_sample_esp-idf.yml | 8 ++++--- .github/workflows/hil_sample_zephyr.yml | 29 ++++++++++++++++-------- .github/workflows/hil_test_esp-idf.yml | 8 ++++--- .github/workflows/hil_test_linux.yml | 10 ++++---- .github/workflows/hil_test_zephyr.yml | 25 ++++++++++++++------ .github/workflows/tests.yml | 27 +++++++++++----------- 6 files changed, 67 insertions(+), 40 deletions(-) diff --git a/.github/workflows/hil_sample_esp-idf.yml b/.github/workflows/hil_sample_esp-idf.yml index a5588adba..1a3621470 100644 --- a/.github/workflows/hil_sample_esp-idf.yml +++ b/.github/workflows/hil_sample_esp-idf.yml @@ -87,9 +87,11 @@ jobs: uses: actions/checkout@v4 - name: Setup Python dependencies run: | - pip install pytest pytest-timeout - pip install tests/hil/scripts/pytest-hil - pip install git+https://github.com/golioth/python-golioth-tools@v0.6.3 + pip install \ + pytest \ + pytest-timeout \ + tests/hil/scripts/pytest-hil \ + git+https://github.com/golioth/python-golioth-tools@v0.6.3 - name: Power On USB Hub run: python3 /opt/golioth-scripts/usb_hub_power.py on - name: Download build diff --git a/.github/workflows/hil_sample_zephyr.yml b/.github/workflows/hil_sample_zephyr.yml index 2959b4125..2e2413518 100644 --- a/.github/workflows/hil_sample_zephyr.yml +++ b/.github/workflows/hil_sample_zephyr.yml @@ -94,11 +94,20 @@ jobs: west patch fi - pip3 install -r zephyr/scripts/requirements-base.txt - pip3 install -r zephyr/scripts/requirements-build-test.txt - pip3 install -r zephyr/scripts/requirements-run-test.txt + pip3 install \ + -r zephyr/scripts/requirements-base.txt \ + -r zephyr/scripts/requirements-build-test.txt \ + -r zephyr/scripts/requirements-run-test.txt + # Needed for TF-M - pip3 install cryptography==41.0.7 pyasn1 pyyaml cbor>=1.0.0 imgtool>=1.9.0 jinja2 click + pip3 install \ + cryptography==41.0.7 \ + pyasn1 \ + pyyaml \ + cbor>=1.0.0 \ + imgtool>=1.9.0 \ + jinja2 \ + click - name: Download binary blobs if: ${{ inputs.binary_blob }} @@ -161,12 +170,12 @@ jobs: git config --global user.name "Git User" west patch - pip3 install -r zephyr/scripts/requirements-base.txt - pip3 install -r zephyr/scripts/requirements-build-test.txt - pip3 install -r zephyr/scripts/requirements-run-test.txt - - pip3 install tests/hil/scripts/pytest-zephyr-samples - pip3 install git+https://github.com/golioth/python-golioth-tools@v0.6.3 + pip3 install \ + -r zephyr/scripts/requirements-base.txt \ + -r zephyr/scripts/requirements-build-test.txt \ + -r zephyr/scripts/requirements-run-test.txt \ + tests/hil/scripts/pytest-zephyr-samples \ + git+https://github.com/golioth/python-golioth-tools@v0.6.3 - name: Power On USB Hub run: python3 /opt/golioth-scripts/usb_hub_power.py on - name: Download build diff --git a/.github/workflows/hil_test_esp-idf.yml b/.github/workflows/hil_test_esp-idf.yml index c65c1b190..7fa6fd9f2 100644 --- a/.github/workflows/hil_test_esp-idf.yml +++ b/.github/workflows/hil_test_esp-idf.yml @@ -90,9 +90,11 @@ jobs: uses: actions/checkout@v4 - name: Setup Python dependencies run: | - pip install pytest pytest-timeout - pip install tests/hil/scripts/pytest-hil - pip install git+https://github.com/golioth/python-golioth-tools@v0.6.4 + pip install \ + pytest \ + pytest-timeout \ + tests/hil/scripts/pytest-hil \ + git+https://github.com/golioth/python-golioth-tools@v0.6.4 - name: Power On USB Hub run: python3 /opt/golioth-scripts/usb_hub_power.py on - name: Download build diff --git a/.github/workflows/hil_test_linux.yml b/.github/workflows/hil_test_linux.yml index 8db96b042..8de4315cd 100644 --- a/.github/workflows/hil_test_linux.yml +++ b/.github/workflows/hil_test_linux.yml @@ -74,10 +74,12 @@ jobs: make -j$(nproc) -C build - name: Setup Python dependencies run: | - pip install --upgrade pip - pip install gcovr pytest pytest-timeout - pip install tests/hil/scripts/pytest-hil - pip install git+https://github.com/golioth/python-golioth-tools@v0.6.4 + pip install \ + gcovr \ + pytest \ + pytest-timeout \ + tests/hil/scripts/pytest-hil \ + git+https://github.com/golioth/python-golioth-tools@v0.6.4 - name: Run test id: run_test shell: bash diff --git a/.github/workflows/hil_test_zephyr.yml b/.github/workflows/hil_test_zephyr.yml index 92947918f..88e792977 100644 --- a/.github/workflows/hil_test_zephyr.yml +++ b/.github/workflows/hil_test_zephyr.yml @@ -78,11 +78,20 @@ jobs: west update -o=--depth=1 -n - pip3 install -r zephyr/scripts/requirements-base.txt - pip3 install -r zephyr/scripts/requirements-build-test.txt - pip3 install -r zephyr/scripts/requirements-run-test.txt + pip3 install \ + -r zephyr/scripts/requirements-base.txt \ + -r zephyr/scripts/requirements-build-test.txt \ + -r zephyr/scripts/requirements-run-test.txt + # Needed for TF-M - pip3 install cryptography==41.0.7 pyasn1 pyyaml cbor>=1.0.0 imgtool>=1.9.0 jinja2 click + pip3 install \ + cryptography==41.0.7 \ + pyasn1 \ + pyyaml \ + cbor>=1.0.0 \ + imgtool>=1.9.0 \ + jinja2 \ + click - name: Download binary blobs if: ${{ inputs.binary_blob }} @@ -126,9 +135,11 @@ jobs: uses: actions/checkout@v4 - name: Setup Python dependencies run: | - pip install pytest pytest-timeout - pip install tests/hil/scripts/pytest-hil - pip install git+https://github.com/golioth/python-golioth-tools@v0.6.4 + pip install \ + pytest \ + pytest-timeout \ + tests/hil/scripts/pytest-hil \ + git+https://github.com/golioth/python-golioth-tools@v0.6.4 - name: Power On USB Hub run: python3 /opt/golioth-scripts/usb_hub_power.py on - name: Download build diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c9f2781b1..f81d63f1d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -195,13 +195,14 @@ jobs: git config --global user.name "Git User" west patch - pip install -r zephyr/scripts/requirements-base.txt - pip install -r zephyr/scripts/requirements-build-test.txt - pip install -r zephyr/scripts/requirements-run-test.txt - - pip install pytest pytest-timeout - pip install modules/lib/golioth-firmware-sdk/tests/hil/scripts/pytest-hil - pip install git+https://github.com/golioth/python-golioth-tools@v0.6.4 + pip install \ + -r zephyr/scripts/requirements-base.txt \ + -r zephyr/scripts/requirements-build-test.txt \ + -r zephyr/scripts/requirements-run-test.txt \ + pytest \ + pytest-timeout \ + modules/lib/golioth-firmware-sdk/tests/hil/scripts/pytest-hil \ + git+https://github.com/golioth/python-golioth-tools@v0.6.4 - name: Build test env: @@ -369,12 +370,12 @@ jobs: git config --global user.name "Git User" west patch - pip3 install -r zephyr/scripts/requirements-base.txt - pip3 install -r zephyr/scripts/requirements-build-test.txt - pip3 install -r zephyr/scripts/requirements-run-test.txt - - pip3 install modules/lib/golioth-firmware-sdk/tests/hil/scripts/pytest-zephyr-samples - pip3 install git+https://github.com/golioth/python-golioth-tools@v0.6.3 + pip3 install \ + -r zephyr/scripts/requirements-base.txt \ + -r zephyr/scripts/requirements-build-test.txt \ + -r zephyr/scripts/requirements-run-test.txt \ + modules/lib/golioth-firmware-sdk/tests/hil/scripts/pytest-zephyr-samples \ + git+https://github.com/golioth/python-golioth-tools@v0.6.3 - name: Run tests run: |