Skip to content

Commit e8a007d

Browse files
committed
GHA: optimize test prereq steps
- Linux: move test and pytest prereqs right before test run. - returns build phase results faster. - allows skipping steps for jobs that don't need them. - makes dependencies more transparent. - sync prereq install step names. - use `tests/requirements.txt` more. Closes curl#15275
1 parent 75dfb7b commit e8a007d

File tree

6 files changed

+92
-74
lines changed

6 files changed

+92
-74
lines changed

.github/workflows/http3-linux.yml

+34-30
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ jobs:
157157
run: |
158158
echo 'needs-build=true' >> $GITHUB_OUTPUT
159159
160-
- name: install build prerequisites
160+
- name: install build prereqs
161161
if: steps.settings.outputs.needs-build == 'true'
162162
run: |
163163
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
@@ -330,7 +330,7 @@ jobs:
330330
apache2 apache2-dev libnghttp2-dev vsftpd
331331
echo 'CC=gcc-12' >> $GITHUB_ENV
332332
echo 'CXX=g++-12' >> $GITHUB_ENV
333-
name: 'install prereqs and impacket, pytest, crypto, apache2'
333+
name: 'install prereqs'
334334
335335
- name: cache quictls
336336
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
@@ -444,36 +444,8 @@ jobs:
444444
# $HOME/quiche/quiche/deps/boringssl/src/lib
445445
name: 'build quiche and boringssl'
446446

447-
- name: cache mod_h2
448-
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
449-
id: cache-mod_h2
450-
env:
451-
cache-name: cache-mod_h2
452-
with:
453-
path: /home/runner/mod_h2
454-
key: ${{ runner.os }}-http3-build-${{ env.cache-name }}-${{ env.mod_h2-version }}
455-
456-
- name: 'build mod_h2'
457-
if: steps.cache-mod_h2.outputs.cache-hit != 'true'
458-
run: |
459-
cd $HOME
460-
git clone --quiet --depth=1 -b v${{ env.mod_h2-version }} https://github.com/icing/mod_h2
461-
cd mod_h2
462-
autoreconf -fi
463-
./configure
464-
make
465-
466-
- name: 'install mod_h2'
467-
run: |
468-
cd $HOME/mod_h2
469-
sudo make install
470-
471447
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
472448

473-
- run: |
474-
sudo python3 -m pip install -r tests/requirements.txt -r tests/http/requirements.txt
475-
name: 'install python test prereqs'
476-
477449
- run: autoreconf -fi
478450
if: ${{ matrix.build.configure }}
479451
name: 'autoreconf'
@@ -527,6 +499,10 @@ jobs:
527499
make V=1 -C tests
528500
fi
529501
502+
- name: 'install test prereqs'
503+
run: |
504+
sudo python3 -m pip install -r tests/requirements.txt
505+
530506
- name: 'run tests'
531507
env:
532508
TFLAGS: "${{ matrix.build.tflags }}"
@@ -537,6 +513,34 @@ jobs:
537513
make V=1 test-ci
538514
fi
539515
516+
- name: 'install pytest prereqs'
517+
run: |
518+
sudo python3 -m pip install -r tests/http/requirements.txt
519+
520+
- name: cache mod_h2
521+
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
522+
id: cache-mod_h2
523+
env:
524+
cache-name: cache-mod_h2
525+
with:
526+
path: /home/runner/mod_h2
527+
key: ${{ runner.os }}-http3-build-${{ env.cache-name }}-${{ env.mod_h2-version }}
528+
529+
- name: 'build mod_h2'
530+
if: steps.cache-mod_h2.outputs.cache-hit != 'true'
531+
run: |
532+
cd $HOME
533+
git clone --quiet --depth=1 -b v${{ env.mod_h2-version }} https://github.com/icing/mod_h2
534+
cd mod_h2
535+
autoreconf -fi
536+
./configure
537+
make
538+
539+
- name: 'install mod_h2'
540+
run: |
541+
cd $HOME/mod_h2
542+
sudo make install
543+
540544
- name: 'run pytest'
541545
env:
542546
TFLAGS: "${{ matrix.build.tflags }}"

.github/workflows/linux.yml

+42-34
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,12 @@ jobs:
273273
sudo apt-get update -y
274274
sudo apt-get install libtool autoconf automake ninja-build pkgconf stunnel4 libpsl-dev libbrotli-dev libzstd-dev \
275275
${{ matrix.build.install_packages }}
276-
sudo python3 -m pip install impacket
277-
name: 'install prereqs and impacket'
276+
name: 'install prereqs'
277+
278+
- if: contains(matrix.build.install_steps, 'pytest')
279+
run: |
280+
sudo apt-get install apache2 apache2-dev libnghttp2-dev vsftpd
281+
name: 'install prereqs for pytest'
278282

279283
- if: startsWith(matrix.build.container, 'alpine')
280284
run: |
@@ -549,38 +553,6 @@ jobs:
549553
printenv >> $GITHUB_ENV
550554
name: 'install Intel compilers'
551555

552-
- if: contains(matrix.build.install_steps, 'pytest')
553-
run: |
554-
sudo apt-get install apache2 apache2-dev libnghttp2-dev vsftpd
555-
sudo python3 -m pip install -r tests/http/requirements.txt
556-
name: 'install pytest and apach2-dev'
557-
558-
- name: cache mod_h2
559-
if: contains(matrix.build.install_steps, 'pytest')
560-
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
561-
id: cache-mod_h2
562-
env:
563-
cache-name: cache-mod_h2
564-
with:
565-
path: /home/runner/mod_h2
566-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.mod_h2-version }}
567-
568-
- name: 'build mod_h2'
569-
if: contains(matrix.build.install_steps, 'pytest') && steps.cache-mod_h2.outputs.cache-hit != 'true'
570-
run: |
571-
cd $HOME
572-
git clone --quiet --depth=1 -b v${{ env.mod_h2-version }} https://github.com/icing/mod_h2
573-
cd mod_h2
574-
autoreconf -fi
575-
./configure
576-
make
577-
578-
- name: 'install mod_h2'
579-
if: contains(matrix.build.install_steps, 'pytest')
580-
run: |
581-
cd $HOME/mod_h2
582-
sudo make install
583-
584556
- run: autoreconf -fi
585557
if: ${{ matrix.build.configure }}
586558
name: 'autoreconf'
@@ -652,6 +624,11 @@ jobs:
652624
make V=1 -C tests
653625
fi
654626
627+
- name: 'install test prereqs'
628+
if: ${{ matrix.build.install_steps != 'skipall' && !startsWith(matrix.build.container, 'alpine') && matrix.build.container == null }}
629+
run: |
630+
sudo python3 -m pip install -r tests/requirements.txt
631+
655632
- name: 'run tests'
656633
if: ${{ matrix.build.install_steps != 'skipall' && matrix.build.install_steps != 'skiprun' }}
657634
timeout-minutes: ${{ contains(matrix.build.install_packages, 'valgrind') && 30 || 15 }}
@@ -669,6 +646,37 @@ jobs:
669646
make V=1 test-ci
670647
fi
671648
649+
- name: 'install pytest prereqs'
650+
if: contains(matrix.build.install_steps, 'pytest')
651+
run: |
652+
sudo python3 -m pip install -r tests/http/requirements.txt
653+
654+
- name: cache mod_h2
655+
if: contains(matrix.build.install_steps, 'pytest')
656+
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
657+
id: cache-mod_h2
658+
env:
659+
cache-name: cache-mod_h2
660+
with:
661+
path: /home/runner/mod_h2
662+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.mod_h2-version }}
663+
664+
- name: 'build mod_h2'
665+
if: contains(matrix.build.install_steps, 'pytest') && steps.cache-mod_h2.outputs.cache-hit != 'true'
666+
run: |
667+
cd $HOME
668+
git clone --quiet --depth=1 -b v${{ env.mod_h2-version }} https://github.com/icing/mod_h2
669+
cd mod_h2
670+
autoreconf -fi
671+
./configure
672+
make
673+
674+
- name: 'install mod_h2'
675+
if: contains(matrix.build.install_steps, 'pytest')
676+
run: |
677+
cd $HOME/mod_h2
678+
sudo make install
679+
672680
- name: 'run pytest'
673681
if: contains(matrix.build.install_steps, 'pytest')
674682
env:

.github/workflows/linux32.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ jobs:
6161
sudo dpkg --add-architecture i386
6262
sudo apt-get update -y
6363
sudo apt-get install -y --no-install-suggests --no-install-recommends libtool autoconf automake pkgconf stunnel4 ${{ matrix.build.install_packages }}
64-
sudo python3 -m pip install --break-system-packages impacket
6564
name: 'install prereqs'
6665
6766
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
@@ -88,6 +87,10 @@ jobs:
8887
- run: make V=1 -C tests
8988
name: 'make tests'
9089

90+
- name: 'install test prereqs'
91+
run: |
92+
sudo python3 -m pip install --break-system-packages -r tests/requirements.txt
93+
9194
- run: make V=1 test-ci
9295
name: 'run tests'
9396
env:

.github/workflows/macos.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,11 @@ jobs:
222222
- name: 'make tests'
223223
run: make -C bld V=1 -C tests
224224

225-
- name: 'pip3 install'
225+
- name: 'make install test prereqs'
226226
run: |
227227
python3 -m venv $HOME/venv
228228
source $HOME/venv/bin/activate
229-
python3 -m pip install impacket
229+
python3 -m pip install -r tests/requirements.txt
230230
231231
- name: 'run tests'
232232
timeout-minutes: 20
@@ -380,11 +380,11 @@ jobs:
380380
- name: 'cmake build tests'
381381
run: ninja -C bld testdeps
382382

383-
- name: 'pip3 install'
383+
- name: 'cmake install test prereqs'
384384
run: |
385385
python3 -m venv $HOME/venv
386386
source $HOME/venv/bin/activate
387-
python3 -m pip install impacket
387+
python3 -m pip install -r tests/requirements.txt
388388
389389
- name: 'cmake run tests'
390390
timeout-minutes: ${{ matrix.build.torture && 20 || 10 }}

.github/workflows/torture.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ jobs:
6161
steps:
6262
- run: |
6363
sudo apt-get install cmake ninja-build pkgconf stunnel4 ${{ matrix.build.install }}
64-
python3 -m pip install --break-system-packages impacket
6564
name: 'install prereqs'
6665
6766
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
@@ -86,6 +85,10 @@ jobs:
8685
- run: cmake --build . --verbose --target testdeps
8786
name: 'build tests'
8887

88+
- name: 'install test prereqs'
89+
run: |
90+
python3 -m pip install --break-system-packages -r tests/requirements.txt
91+
8992
- run: cmake --build . --verbose --target test-torture
9093
name: 'run tests'
9194
env:

.github/workflows/windows.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ jobs:
281281
timeout-minutes: 10
282282
run: make -C bld -j5 V=1 -C tests
283283

284-
- name: 'install test tools'
284+
- name: 'install test prereqs'
285285
if: ${{ matrix.build == 'autotools' && matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
286286
timeout-minutes: 5
287287
run: |
@@ -372,7 +372,7 @@ jobs:
372372
timeout-minutes: 10
373373
run: cmake --build bld --config '${{ matrix.type }}' --target testdeps
374374

375-
- name: 'install test tools'
375+
- name: 'install test prereqs'
376376
if: ${{ matrix.build == 'cmake' && matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
377377
timeout-minutes: 5
378378
run: |
@@ -500,7 +500,7 @@ jobs:
500500
PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
501501
cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target testdeps
502502
503-
- name: 'install test tools'
503+
- name: 'install test prereqs'
504504
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
505505
timeout-minutes: 5
506506
run: |
@@ -783,7 +783,7 @@ jobs:
783783
timeout-minutes: 10
784784
run: cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target testdeps
785785

786-
- name: 'install test tools'
786+
- name: 'install test prereqs'
787787
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
788788
timeout-minutes: 5
789789
run: |

0 commit comments

Comments
 (0)