aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ufuzz.yml13
-rw-r--r--test/ufuzz/actions.js12
2 files changed, 16 insertions, 9 deletions
diff --git a/.github/workflows/ufuzz.yml b/.github/workflows/ufuzz.yml
index 86f3c2b8..df12aa48 100644
--- a/.github/workflows/ufuzz.yml
+++ b/.github/workflows/ufuzz.yml
@@ -3,10 +3,13 @@ on:
pull_request:
schedule:
- cron: '*/15 * * * *'
+ workflow_dispatch:
+ workflow_run:
+ branches: [ master ]
+ types: [ completed ]
+ workflows: [ 'Build testing', CI ]
env:
BASE_URL: https://api.github.com/repos/${{ github.repository }}
- CAUSE: ${{ github.event_name }}
- RUN_NUM: ${{ github.run_number }}
TOKEN: ${{ github.token }}
jobs:
ufuzz:
@@ -34,8 +37,8 @@ jobs:
shell: bash
run: |
. ./test/release/install.sh
- if [[ $CAUSE == "schedule" ]]; then
- node test/ufuzz/job $BASE_URL $TOKEN $RUN_NUM
- else
+ if [[ $GITHUB_EVENT_NAME == "pull_request" ]]; then
node test/ufuzz/job 5000
+ else
+ node test/ufuzz/job $BASE_URL $TOKEN $GITHUB_RUN_NUMBER
fi
diff --git a/test/ufuzz/actions.js b/test/ufuzz/actions.js
index ac494940..cdcaf6d9 100644
--- a/test/ufuzz/actions.js
+++ b/test/ufuzz/actions.js
@@ -1,7 +1,7 @@
var get = require("https").get;
var parse = require("url").parse;
-var base, token, run_number, eldest = true;
+var base, token, run_number;
exports.init = function(url, auth, num) {
base = url;
token = auth;
@@ -19,14 +19,14 @@ exports.should_stop = function(callback) {
do {
workflow = runs.pop();
if (!workflow) return;
- if (workflow.event == "schedule" && workflow.run_number == run_number) found = true;
+ if (is_cron(workflow) && workflow.run_number == run_number) found = true;
} while (!found && workflow.status == "completed");
read(workflow.jobs_url, function(reply) {
if (!reply || !Array.isArray(reply.jobs)) return;
if (!reply.jobs.every(function(job) {
if (job.status == "completed") return true;
remaining--;
- return found || workflow.event != "schedule";
+ return found || !is_cron(workflow);
})) return;
if (remaining >= 0) {
next();
@@ -38,6 +38,10 @@ exports.should_stop = function(callback) {
});
};
+function is_cron(workflow) {
+ return /^(schedule|workflow_dispatch|workflow_run)$/.test(workflow.event);
+}
+
function read(url, callback) {
var done = function(reply) {
done = function() {};
@@ -56,7 +60,7 @@ function read(url, callback) {
}).on("end", function() {
var reply;
try {
- reply = JSON.parse(chunks.join(""))
+ reply = JSON.parse(chunks.join(""));
} catch (e) {}
done(reply);
}).on("error", function() {