improve ufuzz duty cycle on GitHub Actions (#4043)

This commit is contained in:
Alex Lam S.L
2020-08-07 11:42:36 +01:00
committed by GitHub
parent 84d5dffd9f
commit a546cb881d

View File

@@ -5,7 +5,7 @@ on:
- cron: "*/5 * * * *" - cron: "*/5 * * * *"
env: env:
CAUSE: ${{ github.event_name }} CAUSE: ${{ github.event_name }}
DATA_URL: https://api.github.com/repos/${{ github.repository }}/actions/workflows/ufuzz.yml/runs?status=queued DATA_URL: https://api.github.com/repos/${{ github.repository }}/actions/workflows/ufuzz.yml/runs?status=
jobs: jobs:
ufuzz: ufuzz:
strategy: strategy:
@@ -19,9 +19,14 @@ jobs:
- name: Perform fuzzing - name: Perform fuzzing
shell: bash shell: bash
run: | run: |
if [[ $CAUSE == "schedule" ]] && (( `curl -s $DATA_URL | tr -d '\040\011\012\015' | awk -F"queued" '{print NF-1}'` > 3 )); then if [[ $CAUSE != "schedule" ]]; then
PERIOD=1800000
elif (( `curl -s ${DATA_URL}queued | tr -d '\040\011\012\015' | awk -F"queued" '{print NF-1}'` > 3 )); then
echo "too many jobs in queue - exiting..." echo "too many jobs in queue - exiting..."
exit exit
else
RUNNING=`curl -s ${DATA_URL}in_progress | tr -d '\040\011\012\015' | awk -F"in_progress" '{print NF-1}'`
PERIOD=$(( 3600000 * 10 / (RUNNING > 5 ? RUNNING : 5) ))
fi fi
git clone --branch v1.5.4 --depth 1 https://github.com/jasongin/nvs.git ~/.nvs git clone --branch v1.5.4 --depth 1 https://github.com/jasongin/nvs.git ~/.nvs
while ! timeout 60 bash -c '. ~/.nvs/nvs.sh add 8 && nvs use 8'; do while ! timeout 60 bash -c '. ~/.nvs/nvs.sh add 8 && nvs use 8'; do
@@ -39,4 +44,4 @@ jobs:
npm config set update-notifier false npm config set update-notifier false
npm --version npm --version
while !(npm install); do echo "'npm install' failed - retrying..."; done while !(npm install); do echo "'npm install' failed - retrying..."; done
node test/ufuzz/job 3600000 node test/ufuzz/job $PERIOD