Skip to content

Commit

Permalink
ci: hil: prefer single-line pip invocations
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mniestroj committed Oct 5, 2024
1 parent d4fe2a7 commit 95dc145
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 40 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/hil_sample_esp-idf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
pip install \
pytest \
pytest-timeout \
tests/hil/scripts/pytest-hil \
git+https://github.com/golioth/[email protected]
- name: Power On USB Hub
run: python3 /opt/golioth-scripts/usb_hub_power.py on
- name: Download build
Expand Down
29 changes: 19 additions & 10 deletions .github/workflows/hil_sample_zephyr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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/[email protected]
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/[email protected]
- name: Power On USB Hub
run: python3 /opt/golioth-scripts/usb_hub_power.py on
- name: Download build
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/hil_test_esp-idf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
pip install \
pytest \
pytest-timeout \
tests/hil/scripts/pytest-hil \
git+https://github.com/golioth/[email protected]
- name: Power On USB Hub
run: python3 /opt/golioth-scripts/usb_hub_power.py on
- name: Download build
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/hil_test_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
pip install \
gcovr \
pytest \
pytest-timeout \
tests/hil/scripts/pytest-hil \
git+https://github.com/golioth/[email protected]
- name: Run test
id: run_test
shell: bash
Expand Down
25 changes: 18 additions & 7 deletions .github/workflows/hil_test_zephyr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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/[email protected]
pip install \
pytest \
pytest-timeout \
tests/hil/scripts/pytest-hil \
git+https://github.com/golioth/[email protected]
- name: Power On USB Hub
run: python3 /opt/golioth-scripts/usb_hub_power.py on
- name: Download build
Expand Down
27 changes: 14 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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/[email protected]
- name: Build test
env:
Expand Down Expand Up @@ -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/[email protected]
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/[email protected]
- name: Run tests
run: |
Expand Down

0 comments on commit 95dc145

Please sign in to comment.