Skip to content

Write a test for t8_forest_bin_search_first_descendant_ancenstor #2092

Write a test for t8_forest_bin_search_first_descendant_ancenstor

Write a test for t8_forest_bin_search_first_descendant_ancenstor #2092

Workflow file for this run

name: "Move the Issue after workload and urgency is evaluated"
# This file is part of t8code.
# t8code is a C library to manage a collection (a forest) of multiple
# connected adaptive space-trees of general element types in parallel.
#
# Copyright (C) 2025 the developers
#
# t8code is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# t8code is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with t8code; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
on:
issues:
types: [labeled, assigned, unassigned, unlabeled, opened]
pull_request:
types: [opened, reopened, ready_for_review, review_requested, review_request_removed, closed]
jobs:
evaluate_issues:
if: ${{ github.event_name == 'issues' }}
runs-on: ubuntu-latest
outputs:
WORKLOAD_SET: ${{ steps.check_workload.outputs.WORKLOAD_SET || 'false' }}
PRIORITY_SET: ${{ steps.check_urgency.outputs.PRIORITY_SET || 'false' }}
WORKLOAD: ${{ steps.check_workload.outputs.WORKLOAD || 'false' }}
PRIORITY: ${{ steps.check_urgency.outputs.PRIORITY || 'false' }}
CREATION_DATE: ${{ steps.get_creation_date.outputs.CREATION_DATE || 'unset' }}
steps:
- name: "Extract the issues date of creation"
id: get_creation_date
run: |
echo "Extract the date of creation:"
github_date_string="${{ github.event.issue.created_at }}"
CREATION_DATE="${github_date_string:0:10}"
echo "$CREATION_DATE"
echo "CREATION_DATE=$CREATION_DATE" >> $GITHUB_OUTPUT
- name: "Check if workload is set"
id: check_workload
# Check if the issue has a workload label
if: |
contains(join(github.event.issue.labels.*.name, ','), 'workload:high') ||
contains(join(github.event.issue.labels.*.name, ','), 'workload:medium') ||
contains(join(github.event.issue.labels.*.name, ','), 'workload:low')
run: |
# Set WORKLOAD_SET to true
WORKLOAD_SET=true
echo "WORKLOAD_SET=$WORKLOAD_SET" >> $GITHUB_OUTPUT
# extract the workload value. Suppresses error messages from jq. If the label can not be found, an empty string is added.
labels=$(echo '${{ toJSON(github.event.issue.labels) }}' | jq -r '.[]?.name' 2>/dev/null || echo "")
workload=$(echo "$labels" | grep -oE 'workload:(high|medium|low)' | cut -d: -f2)
echo "WORKLOAD=$workload"
WORKLOAD=$workload
echo "WORKLOAD=$WORKLOAD" >> $GITHUB_OUTPUT
echo "WORKLOAD=$WORKLOAD"
echo "WORKLOAD_SET=$WORKLOAD_SET"
echo "${{ github.event.action }}"
- name: "Check if workload has not been set"
id: check_workload_not_set
if: |
!contains(join(github.event.issue.labels.*.name, ','), 'workload:high') &&
!contains(join(github.event.issue.labels.*.name, ','), 'workload:medium') &&
!contains(join(github.event.issue.labels.*.name, ','), 'workload:low')
run: |
# Set WORKLOAD_SET to false
WORKLOAD_SET=false
echo "WORKLOAD_SET=$WORKLOAD_SET" >> $GITHUB_OUTPUT
echo "WORKLOAD_SET=$WORKLOAD_SET"
- name: "Check if priority is set"
id: check_urgency
# Check if the issue has a priority label
if: |
contains(join(github.event.issue.labels.*.name, ','), 'priority:high') ||
contains(join(github.event.issue.labels.*.name, ','), 'priority:medium') ||
contains(join(github.event.issue.labels.*.name, ','), 'priority:low')
run: |
# Set PRIORITY_SET to true
PRIORITY_SET=true
echo "PRIORITY_SET=$PRIORITY_SET" >> $GITHUB_OUTPUT
# extract the priority value. Suppresses error messages from jq. If the label can not be found, an empty string is added.
labels=$(echo '${{ toJSON(github.event.issue.labels) }}' | jq -r '.[]?.name' 2>/dev/null || echo "")
priority=$(echo "$labels" | grep -oE 'priority:(high|medium|low)' | cut -d: -f2)
echo "PRIORITY=$priority"
PRIORITY=$priority
echo "PRIORITY=$PRIORITY" >> $GITHUB_OUTPUT
echo "PRIORITY=$PRIORITY"
echo "PRIORITY_SET=$PRIORITY_SET"
echo "${{ github.event.action }}"
- name: "Check if priority has not been set"
id: check_urgency_not_set
if: |
!contains(join(github.event.issue.labels.*.name, ','), 'priority:high') &&
!contains(join(github.event.issue.labels.*.name, ','), 'priority:medium') &&
!contains(join(github.event.issue.labels.*.name, ','), 'priority:low')
run: |
# Set PRIORITY_SET to false
PRIORITY_SET=false
echo "PRIORITY_SET=$PRIORITY_SET" >> $GITHUB_OUTPUT
echo "PRIORITY_SET=$PRIORITY_SET"
evaluate_pr:
runs-on: ubuntu-latest
# Don't run in parallel on the same PR. Otherwise multiple issues might be created for the same PR.
concurrency:
group: pr-move-card-${{ github.event.pull_request.id }}
outputs:
NUMBER_IS_SET: ${{ steps.get_pr_issue_link.outputs.NUMBER_IS_SET }}
CLEAN_ISSUE_NUMBER: ${{ steps.get_pr_issue_link.outputs.CLEAN_ISSUE_NUMBER }}
REPO_NODE_ID: ${{ steps.get_pr_issue_link.outputs.REPO_NODE_ID }}
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: "Get link between PR and Issue"
id: get_pr_issue_link
run: |
# Extract the repository node ID from the pull request event
REPO_NODE_ID=$(jq -r '.repository.node_id' < $GITHUB_EVENT_PATH)
echo "REPO_NODE_ID=$REPO_NODE_ID"
echo "REPO_NODE_ID=$REPO_NODE_ID" >> $GITHUB_OUTPUT
# Extract the issue number from the pull request body
CLEAN_ISSUE_NUMBER=$(jq -r '.pull_request.body // ""' < $GITHUB_EVENT_PATH | grep -oEi '\b([cC]lose|[cC]loses|[cC]losed|[fF]ix|[fF]ixes|[fF]ixed|[rR]esolve|[rR]esolves|[rR]esolved) #[0-9]+' | grep -oE '[0-9]+' | paste -sd ',' -)
# Set the issue number to an empty string if no issue number is found
CLEAN_ISSUE_NUMBER=${CLEAN_ISSUE_NUMBER:-""}
echo "CLEAN_ISSUE_NUMBER=$CLEAN_ISSUE_NUMBER"
# If no issue number is found, set NUMBER_IS_SET to false
if [ -z "$CLEAN_ISSUE_NUMBER" ]; then
echo "No issue number found in the pull request body."
NUMBER_IS_SET=false
echo "NUMBER_IS_SET=$NUMBER_IS_SET" >> $GITHUB_OUTPUT
echo "NUMBER_IS_SET=$NUMBER_IS_SET"
exit 0
fi
echo "CLEAN_ISSUE_NUMBER=$CLEAN_ISSUE_NUMBER" >> $GITHUB_OUTPUT
NUMBER_IS_SET=true
echo "NUMBER_IS_SET=true" >> $GITHUB_OUTPUT
# Debug output!
echo "NUMBER_IS_SET=$NUMBER_IS_SET"
echo "${{ github.event.action }}"
# Add the issue's date of creation to the project board card.
# Triggered only if the issue was newly opened or the label 'manual_trigger_date_event' has been added.
add_creation_date:
needs: [evaluate_issues]
if: ${{ github.event.action == 'opened' || ( github.event.action == 'labeled' && contains(join(github.event.issue.labels.*.name, ','), 'manual_trigger_date_event') ) }}
uses: ./.github/workflows/add_date_created.yml
with:
ISSUE_NODE_ID: ${{ github.event.issue.node_id }}
CREATION_DATE: ${{ needs.evaluate_issues.outputs.CREATION_DATE }}
secrets:
PAT: ${{ secrets.T8DDY_PROJECTS }}
# Move the issue card to ToDo if the workload and priority are set
move_card_to_ToDo:
needs: [evaluate_issues]
if: ${{ github.event.action == 'labeled' && needs.evaluate_issues.outputs.WORKLOAD_SET == 'true' && needs.evaluate_issues.outputs.PRIORITY_SET == 'true' }}
uses: ./.github/workflows/issue_event_moves_card.yml
with:
ISSUE_NODE_ID: ${{ github.event.issue.node_id }}
CURRENT_COLUMN_NAME: 'In-Box'
COLUMN_NAME: 'ToDo'
PRIORITY: ${{ needs.evaluate_issues.outputs.PRIORITY }}
WORKLOAD: ${{ needs.evaluate_issues.outputs.WORKLOAD }}
secrets:
PAT: ${{ secrets.T8DDY_PROJECTS }}
# Move the Issue card to In Progress if the workload and priority are set and the issue is assigned
move_card_to_InProgress:
needs: [evaluate_issues]
if: ${{ needs.evaluate_issues.outputs.WORKLOAD_SET == 'true' && needs.evaluate_issues.outputs.PRIORITY_SET == 'true' && github.event.action == 'assigned' }}
uses: ./.github/workflows/issue_event_moves_card.yml
with:
ISSUE_NODE_ID: ${{ github.event.issue.node_id }}
CURRENT_COLUMN_NAME: 'ToDo'
COLUMN_NAME: 'In Progress'
secrets:
PAT: ${{ secrets.T8DDY_PROJECTS }}
# Move the Issue card back to ToDo if the workload and priority are set and the issue is unassigned
move_card_back_to_ToDo:
needs: [evaluate_issues]
if: ${{ needs.evaluate_issues.outputs.WORKLOAD_SET == 'true' && needs.evaluate_issues.outputs.PRIORITY_SET == 'true' && github.event.action == 'unassigned' }}
uses: ./.github/workflows/issue_event_moves_card.yml
with:
ISSUE_NODE_ID: ${{ github.event.issue.node_id }}
CURRENT_COLUMN_NAME: 'In Progress'
COLUMN_NAME: 'ToDo'
secrets:
PAT: ${{ secrets.T8DDY_PROJECTS }}
# Move the Issue card back to In-Box if the workload and priority are unset
move_card_back_to_In-Box:
needs: [evaluate_issues]
if: ${{ github.event.action == 'unlabeled' && (needs.evaluate_issues.outputs.WORKLOAD_SET == 'false' || needs.evaluate_issues.outputs.PRIORITY_SET == 'false') }}
uses: ./.github/workflows/issue_event_moves_card.yml
with:
ISSUE_NODE_ID: ${{ github.event.issue.node_id }}
CURRENT_COLUMN_NAME: 'ToDo'
COLUMN_NAME: 'In-Box'
secrets:
PAT: ${{ secrets.T8DDY_PROJECTS }}
# For a PR event, move the card to Needs Review if the PR is opened, ready for review, or reopened
move_card_to_Needs_Review:
needs: [evaluate_pr]
if: ${{ needs.evaluate_pr.outputs.NUMBER_IS_SET == 'true' && (github.event.action == 'opened' || github.event.action == 'ready_for_review' || github.event.action == 'reopened') }}
uses: ./.github/workflows/pr_event_moves_card.yml
with:
ISSUE_NUMBER: ${{ needs.evaluate_pr.outputs.CLEAN_ISSUE_NUMBER }}
CURRENT_COLUMN_NAME: 'In Progress'
COLUMN_NAME: 'Needs Review'
REPO_NODE_ID: ${{ needs.evaluate_pr.outputs.REPO_NODE_ID }}
secrets:
PAT: ${{ secrets.T8DDY_PROJECTS }}
# For a PR event move the card to In Review if a review is requested
move_card_to_In_Review:
needs: [evaluate_pr]
if: ${{ needs.evaluate_pr.outputs.NUMBER_IS_SET == 'true' && github.event.action == 'review_requested' }}
uses: ./.github/workflows/pr_event_moves_card.yml
with:
ISSUE_NUMBER: ${{ needs.evaluate_pr.outputs.CLEAN_ISSUE_NUMBER }}
CURRENT_COLUMN_NAME: 'Needs Review'
COLUMN_NAME: 'In Review'
REPO_NODE_ID: ${{ needs.evaluate_pr.outputs.REPO_NODE_ID }}
secrets:
PAT: ${{ secrets.T8DDY_PROJECTS }}
# For a PR event move the card back to Needs Review if a review is removed
move_card_back_to_Needs_Review:
needs: [evaluate_pr]
if: ${{ needs.evaluate_pr.outputs.NUMBER_IS_SET == 'true' && github.event.action == 'review_request_removed' }}
uses: ./.github/workflows/pr_event_moves_card.yml
with:
ISSUE_NUMBER: ${{ needs.evaluate_pr.outputs.CLEAN_ISSUE_NUMBER }}
CURRENT_COLUMN_NAME: 'In Review'
COLUMN_NAME: 'Needs Review'
REPO_NODE_ID: ${{ needs.evaluate_pr.outputs.REPO_NODE_ID }}
secrets:
PAT: ${{ secrets.T8DDY_PROJECTS }}
# For a PR event move the card back to In Progress if the PR is closed and not merged
move_card_back_to_In_Progress:
needs: [evaluate_pr]
if: ${{ needs.evaluate_pr.outputs.NUMBER_IS_SET == 'true' && github.event.action == 'closed' && github.event.pull_request.merged == false }}
uses: ./.github/workflows/pr_event_moves_card.yml
with:
ISSUE_NUMBER: ${{ needs.evaluate_pr.outputs.CLEAN_ISSUE_NUMBER }}
CURRENT_COLUMN_NAME: 'Needs Review'
COLUMN_NAME: 'In Progress'
REPO_NODE_ID: ${{ needs.evaluate_pr.outputs.REPO_NODE_ID }}
secrets:
PAT: ${{ secrets.T8DDY_PROJECTS }}
# For a PR event where no issue is linked, open a new issue and add "Closes #ISSUE_NUMBER" to the PR body
open_issue_for_quick_pr:
needs: [evaluate_pr]
if: ${{ github.event_name == 'pull_request' && needs.evaluate_pr.outputs.NUMBER_IS_SET == 'false' }}
uses: ./.github/workflows/quick_pr.yml
with:
DEFAULT_PROJECT: "t8code's Issue Landing page"
secrets:
PAT: ${{ secrets.T8DDY_PROJECTS }}
# After the issue has been created by open_issue_for_quick_pr, move the card to Needs Review
move_quick_pr_issue_to_Needs_Review:
needs: [open_issue_for_quick_pr, evaluate_pr]
uses: ./.github/workflows/pr_event_moves_card.yml
if: ${{ !github.event.pull_request.draft }}
with:
ISSUE_NUMBER: ${{ needs.open_issue_for_quick_pr.outputs.ISSUE_NUMBER }}
CURRENT_COLUMN_NAME: 'IGNORE'
COLUMN_NAME: 'Needs Review'
REPO_NODE_ID: ${{ needs.evaluate_pr.outputs.REPO_NODE_ID }}
secrets:
PAT: ${{ secrets.T8DDY_PROJECTS }}
# After the issue has been created by open_issue_for_quick_pr, move the card to In Progress. The triggering PR is a draft PR,
# therefore we don't want to move the card to Needs Review.
move_quick_draft_pr_issue_to_In_Progress:
needs: [open_issue_for_quick_pr, evaluate_pr]
uses: ./.github/workflows/pr_event_moves_card.yml
if: ${{ github.event.pull_request.draft }}
with:
ISSUE_NUMBER: ${{ needs.open_issue_for_quick_pr.outputs.ISSUE_NUMBER }}
CURRENT_COLUMN_NAME: 'IGNORE'
COLUMN_NAME: 'In Progress'
REPO_NODE_ID: ${{ needs.evaluate_pr.outputs.REPO_NODE_ID }}
secrets:
PAT: ${{ secrets.T8DDY_PROJECTS }}