GHA execution throttling #3739

This commit is contained in:
rusefillc 2022-01-04 11:51:06 -05:00
parent 462d0742d5
commit 0c22c9ffb3
2 changed files with 38 additions and 0 deletions

View File

@ -108,6 +108,7 @@ jobs:
- build-target: mre_f4_recovery
folder: microrusefi
ini-file: rusefi_mre_f4.ini
skip-rate: 90
- build-target: mre_f4_hardware_QC_special_build
folder: microrusefi
@ -117,6 +118,7 @@ jobs:
folder: microrusefi
ini-file: rusefi_mre_f7.ini
console-settings: firmware/config/boards/nucleo_f767/rusefi_console_properties.xml
skip-rate: 90
- build-target: prometheus_405
folder: prometheus
@ -125,6 +127,7 @@ jobs:
- build-target: prometheus_469
folder: prometheus
ini-file: rusefi_prometheus_469.ini
skip-rate: 50
- build-target: proteus_f4
folder: proteus
@ -133,6 +136,7 @@ jobs:
- build-target: proteus_f4_hardware_QC_special_build
folder: proteus
ini-file: rusefi_proteus_f4.ini
skip-rate: 90
- build-target: proteus_f7
folder: proteus
@ -149,17 +153,20 @@ jobs:
- build-target: proteus_legacy
folder: proteus
ini-file: rusefi_proteus_f7.ini
skip-rate: 50
- build-target: stm32f767_nucleo
folder: nucleo_f767
ini-file: no
console-settings: firmware/config/boards/nucleo_f767/rusefi_console_properties.xml
skip-config: yes
skip-rate: 50
- build-target: stm32h743_nucleo
folder: nucleo_h743
ini-file: no
skip-config: yes
skip-rate: 50
- build-target: subaru_eg33_f7
folder: subaru_eg33
@ -168,17 +175,25 @@ jobs:
- build-target: atlas
folder: atlas
ini-file: rusefi_atlas.ini
skip-rate: 90
steps:
- id: throttle
name: Execution throttle early exit
run: bash misc/actions/execution-throttle.sh ${{ matrix.skip-rate }}
- uses: actions/checkout@v1
if: steps.throttle.conclusion == 'success'
with:
submodules: recursive
- uses: actions/setup-java@v1
if: steps.throttle.conclusion == 'success'
with:
java-version: '8'
- name: Install multilib, mingw, sshpass and mtools
if: steps.throttle.conclusion == 'success'
run: |
sudo apt-get update
sudo apt-get install gcc-multilib g++-multilib g++-mingw-w64 gcc-mingw-w64 sshpass mtools

View File

@ -0,0 +1,23 @@
#!/bin/bash
#
# we use this script to reduce github actions load by executing some tasks less frequent than always
# param: THRESHOLD, rate of SKIPPING task, from 0 to 100. No skipping if zero, always skipping if 100.
#
THRESHOLD=$1
if [ -z $THRESHOLD ] ; then
echo "Throttle threshold not specified, allowing always"
exit 0
fi
RANDOM100=$(($RANDOM % 100))
msg="Random ${RANDOM100} while threshold $THRESHOLD:"
if (( ${RANDOM100} > $THRESHOLD )); then
echo "$msg Allowing"
exit 0
else
echo "$msg Not this time, maybe next time"
exit -1
fi