A check for whether the dependency jobs are all green.

Overview

alls-green

A check for whether the dependency jobs are all green.

Why?

Do you have more than one job in your GitHub Actions CI/CD workflows setup? Do you use branch protection? Are you annoyed that you have to manually update the required checks in the repository settings hoping that you don't forget something on each improvement of the test matrix structure?

Yeah.. me too! But there's a solution — you can make a single check job listing all of the other jobs in its needs list. How about that? 🤯 Now you can add only that single job to your branch protection settings and you won't have to maintain that list manually anymore.

Right..? Wrong 🙁 — apparently, in case when something fails, the check job's result is set to skipped and not failed as one would expect. This is problematic and requires extra work to get it right. Some of it is iteration over the needed jobs and checking that all their results are set to success but it's no fun to maintain this sort of thing in many different repositories. Also, it is mandatory to make the check job run always, not only when all of the needed jobs succeed.

This is why I decided to make this action to simplify the maintenance.

--@webknjaz

:wq

Usage

To use the action add a check job to your workflow file (e.g. .github/workflows/ci-cd.yml) following the example below:

---
on:
  pull_request:
  push:

jobs:
  build:
    ...

  docs:
    ...

  linters:
    ...

  package-linters:
    needs:
    - build
    ...

  tests:
    needs:
    - build
    ...

  check:
    if: always()

    needs:
    - docs
    - linters
    - package-linters
    - tests

    runs-on: Ubuntu-latest

    steps:
    - name: Decide whether the needed jobs succeeded or failed
      uses: re-actors/[email protected]/v1
      with:
        allowed-failures: docs, linters
        allowed-skips: non-voting-flaky-job
        jobs: ${{ toJSON(needs) }}
...

Options

There are three options — allowed-failures, allowed-skips and jobs. The first two are optional but jobs is mandatory. allowed-failures tells the action which jobs should not affect the outcome if they don't succeed, by default all the jobs will be "voting". Same goes for allowed-skips — it won't allow the listed jobs to affect the outcome if they are skipped but are still "voting" in case they run. jobs is an object representing the jobs that should affect the decision of whether the pipeline failed or not, it is important to pass a JSON-serialized needs context to this argument.

Important: For this to work properly, it is a must to have the job always run, otherwise GitHub will make it skipped when any of the dependencies fail. In some contexts, skipped is interpreted as success which may lead to undersired, unobvious and even dangerous (as in security breach "dangerous") side-effects.

Whose idea is this?

My inspiration came from Zuul — a project gating system that practices having one "check-gate" that depends on multiple individual checks. Later when I started implementing this practice across the projects that I maintain, I discovered that I was not the only one who got the same idea @graingert posted a similar solution on the GitHub Community Forum. At some point I noticed that GitHub's auto-merge merges Dependabot PRs that are broken despite having branch protection enabled in the aiohttp repository, it wasn't obvious why. I stumbled on the solution accidentally, it was implemented in the PyCA/cryptography repository — the credit for that goes to @reaperhulk. He listed all of the needed jobs manually in the check. With those findings I've spent some time on experimentation and composing a more generic solution — this is how this GitHub Action came to be.

License

The contents of this project is released under the BSD 3-clause license.

Comments
  • Cancelled jobs result in a failure being reported

    Cancelled jobs result in a failure being reported

    https://github.com/pypa/pip/actions/runs/3210435710

    This triggers a notification if the jobs were auto-cancelled, for example due to concurrency protections.

    question wontfix 
    opened by pradyunsg 8
  • [TODO] Implement `allow-skips`

    [TODO] Implement `allow-skips`

    This has been suggested by @pradyunsg.

    Use-case: workflows that run jobs conditionally, depending on the files changed in associated PRs, for example — https://github.com/pypa/pip/blob/bbc7021/.github/workflows/ci.yml#L29-L49, using a change detection action like dorny/paths-filter.

    enhancement good first issue 
    opened by webknjaz 5
  • Deprecation warnings due to set-output

    Deprecation warnings due to set-output

    GitHub has deprecated the set-output way, so I'm getting warnings in my workflows from alls-green.

    Since they provided zero guidance how to fix it, I've written it down myself: https://hynek.me/til/set-output-deprecation-github-actions/

    tldr: echo "::set-output name=KEY::VALUE"echo "KEY=VALUE" >>$GITHUB_OUTPUT

    enhancement 
    opened by hynek 4
  • matrix job use case not covered or exemplified

    matrix job use case not covered or exemplified

    Apparently the current implementation does not count for matrix usage, thus not allowing you to ignore failure of one of matrix jobs.

    Sadly GHA unfortunate naming makes it harder to even refer to individual job run as from the human point of view each entry inside checks is a job. But from GHA workflow definition that is not exactly the same thing as matrix job-definitions get expanded into multiple job-runs with potential different names.

    How can we mark one particular matrix dimension as allowed to fail while still ensuring the the summarizing final "check" job does not fail?

    Most projects will avoid using different definitions for each job-run and use matrix for them, as that prevents repeating a huge number of tasks. Thus we do need a practical solution for allowing one matrix-entry to fail.

    documentation good first issue question 
    opened by ssbarnea 3
  • SyntaxError in normalize_needed_jobs_status.py

    SyntaxError in normalize_needed_jobs_status.py

    Hi This is how I added your action to my workflow:

    check:
        if: always()
        runs-on: [self-hosted]
        needs:
        - dev_build_int_tests
    
        steps:
        - name: Decide whether the needed jobs succeeded or failed
          uses: re-actors/a[email protected]
          with:
            jobs: ${{ toJSON(needs) }}
    

    And I got this error:

    Traceback (most recent call last):
     File "/usr/lib/python2.7/runpy.py", line 163, in _run_module_as_main
       mod_name, _Error)
     File "/usr/lib/python2.7/runpy.py", line 119, in _get_module_details
       code = loader.get_code(mod_name)
     File "/usr/lib/python2.7/pkgutil.py", line 281, in get_code
       self.code = compile(source, self.filename, 'exec')
     File "/opt/actions-runner/_work/_actions/re-actors/alls-green/v1.2.2/src/normalize_needed_jobs_status.py", line 29
       write_lines_to_streams((f'{name}={value}',), (outputs_file,))
                                               ^
    SyntaxError: invalid syntax
    Error: Process completed with exit code 1.
    

    Could you help me to fix it, please.

    opened by BuddyGlas 2
  • Include

    Include "Cancelled" in Skipped Statuses

    Jobs can be cancelled externally, either manually or automatically with an action. Cancelled jobs fall into the "failure" state of this action, and since they are not explicit failures they should be considered as "skipped" in the same way that jobs which are automatically skipped are.

    opened by tubbo 2
  • The execution status still green

    The execution status still green

    Sorry, maybe I don't understand how this action should work, but I added the check to my workflow, but I didn't get the expected result. Why is the execution status (number 1 in the screenshot) still green?

      check:
        if: always()
        runs-on: [self-hosted]
        needs:
        - dev_build_int_tests
    
        steps:
        - name: Install python3
          uses: actions/[email protected]
          with:
            python-version: '3.10'
    
        - name: Decide whether the needed jobs succeeded or failed
          uses: re-actors/a[email protected]
          with:
            jobs: ${{ toJSON(needs) }}
    

    2022-11-29_14-57

    opened by BuddyGlas 1
  • Requiring all jobs pass? (with a wildcard or some equivalent)

    Requiring all jobs pass? (with a wildcard or some equivalent)

    First of all, love the idea of this action, thanks for maintaining it.

    I was thinking about adopting this for https://github.com/di/pip-api/blob/master/.github/workflows/test.yml which has a somewhat complex (and long) matrix workflow. But based on the example in the readme and discussion in #5, it looks like I need to explicitly list all the jobs by name with needs:, and since the list of jobs is autogenerated, very long and changes frequently, I don't want to do this. Is there any workaround?

    Thanks!

    question 
    opened by di 0
Releases(v1.2.2)
  • v1.2.2(Oct 14, 2022)

    What's Changed

    Only the internals of the action have been updated to produce job step outputs through environment files^1. No UX changes were made. Additionally, the README has been improved to show how to allow individual matrix-defined jobs to fail and the outputs the action produces have been documented.

    Full Diff: https://github.com/re-actors/alls-green/compare/v1.2.1...v1.2.2

    Source code(tar.gz)
    Source code(zip)
  • v1.2.1(Sep 29, 2022)

    Bugfixes

    This release started processing trailing commas causing empty elements in allowed-failures and allowed-skips`.

    Full Diff: https://github.com/re-actors/alls-green/compare/v1.2.0...v1.2.1

    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Sep 24, 2022)

    What's New

    This release implements posting check details as a summary on the workflow overview page.

    Full Diff: https://github.com/re-actors/alls-green/compare/v1.1.0...v1.2.0

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Dec 14, 2021)

  • v1.0.2(Dec 14, 2021)

    This is a patch release that includes bits of refactoring of the inline Python code block into its own module file and clarifications in the input descriptions.

    Source code(tar.gz)
    Source code(zip)
Owner
Re:actors
It's a home for GitHub Actions created by @webknjaz which react to the repository events. Research purposes, currently.
Re:actors
Code for our CVPR 2022 Paper "GEN-VLKT: Simplify Association and Enhance Interaction Understanding for HOI Detection"

GEN-VLKT Code for our CVPR 2022 paper "GEN-VLKT: Simplify Association and Enhance Interaction Understanding for HOI Detection". Contributed by Yue Lia

Yue Liao 47 Dec 04, 2022
CLIP: Connecting Text and Image (Learning Transferable Visual Models From Natural Language Supervision)

CLIP (Contrastive Language–Image Pre-training) Experiments (Evaluation) Model Dataset Acc (%) ViT-B/32 (Paper) CIFAR100 65.1 ViT-B/32 (Our) CIFAR100 6

Myeongjun Kim 52 Jan 07, 2023
Lacmus is a cross-platform application that helps to find people who are lost in the forest using computer vision and neural networks.

lacmus The program for searching through photos from the air of lost people in the forest using Retina Net neural nwtwork. The project is being develo

Lacmus Foundation 168 Dec 27, 2022
MogFace: Towards a Deeper Appreciation on Face Detection

MogFace: Towards a Deeper Appreciation on Face Detection Introduction In this repo, we propose a promising face detector, termed as MogFace. Our MogFa

48 Dec 20, 2022
Solver for Large-Scale Rank-One Semidefinite Relaxations

STRIDE: spectrahedral proximal gradient descent along vertices A Solver for Large-Scale Rank-One Semidefinite Relaxations About STRIDE is designed for

48 Dec 20, 2022
TimeSHAP explains Recurrent Neural Network predictions.

TimeSHAP TimeSHAP is a model-agnostic, recurrent explainer that builds upon KernelSHAP and extends it to the sequential domain. TimeSHAP computes even

Feedzai 90 Dec 18, 2022
Official PyTorch Implementation of Learning Self-Similarity in Space and Time as Generalized Motion for Video Action Recognition, ICCV 2021

Official PyTorch Implementation of Learning Self-Similarity in Space and Time as Generalized Motion for Video Action Recognition, ICCV 2021

26 Dec 07, 2022
PyTorch implementation of paper "IBRNet: Learning Multi-View Image-Based Rendering", CVPR 2021.

IBRNet: Learning Multi-View Image-Based Rendering PyTorch implementation of paper "IBRNet: Learning Multi-View Image-Based Rendering", CVPR 2021. IBRN

Google Interns 371 Jan 03, 2023
OMNIVORE is a single vision model for many different visual modalities

Omnivore: A Single Model for Many Visual Modalities [paper][website] OMNIVORE is a single vision model for many different visual modalities. It learns

Meta Research 451 Dec 27, 2022
Online Pseudo Label Generation by Hierarchical Cluster Dynamics for Adaptive Person Re-identification

Online Pseudo Label Generation by Hierarchical Cluster Dynamics for Adaptive Person Re-identification

TANG, shixiang 6 Nov 25, 2022
ICON: Implicit Clothed humans Obtained from Normals

ICON: Implicit Clothed humans Obtained from Normals arXiv, December 2021. Yuliang Xiu · Jinlong Yang · Dimitrios Tzionas · Michael J. Black Table of C

Yuliang Xiu 1.1k Dec 30, 2022
SGPT: Multi-billion parameter models for semantic search

SGPT: Multi-billion parameter models for semantic search This repository contains code, results and pre-trained models for the paper SGPT: Multi-billi

Niklas Muennighoff 182 Dec 29, 2022
Identify the emotion of multiple speakers in an Audio Segment

MevonAI - Speech Emotion Recognition Identify the emotion of multiple speakers in a Audio Segment Report Bug · Request Feature Try the Demo Here Table

Suyash More 110 Dec 03, 2022
DeepFaceEditing: Deep Face Generation and Editing with Disentangled Geometry and Appearance Control

DeepFaceEditing: Deep Face Generation and Editing with Disentangled Geometry and Appearance Control One version of our system is implemented using the

260 Nov 28, 2022
Differentiable Surface Triangulation

Differentiable Surface Triangulation This is our implementation of the paper Differentiable Surface Triangulation that enables optimization for any pe

61 Dec 07, 2022
ByteTrack: Multi-Object Tracking by Associating Every Detection Box

ByteTrack ByteTrack is a simple, fast and strong multi-object tracker. ByteTrack: Multi-Object Tracking by Associating Every Detection Box Yifu Zhang,

Yifu Zhang 2.9k Jan 04, 2023
Sound Event Detection with FilterAugment

Sound Event Detection with FilterAugment Official implementation of Heavily Augmented Sound Event Detection utilizing Weak Predictions (DCASE2021 Chal

43 Aug 28, 2022
Atif Hassan 103 Dec 14, 2022
A library for differentiable nonlinear optimization.

Theseus A library for differentiable nonlinear optimization built on PyTorch to support constructing various problems in robotics and vision as end-to

Meta Research 1.1k Dec 30, 2022
Using contrastive learning and OpenAI's CLIP to find good embeddings for images with lossy transformations

The official code for the paper "Inverse Problems Leveraging Pre-trained Contrastive Representations" (to appear in NeurIPS 2021).

Sriram Ravula 26 Dec 10, 2022