python-intermediate-development icon indicating copy to clipboard operation
python-intermediate-development copied to clipboard

GitHub Action Build Matrix cancels all jobs

Open guyer opened this issue 2 years ago • 1 comments

In Continuous Integration for Automated Testing, modifying the GitHub Action to implement a Build Matrix results in the first job failing and then all subsequent jobs being cancelled:

I'm new to GitHub Actions, although not to CIs, so I don't understand why the different matrix conditions depend on one another. I'd think the desired outcome is that all matrix variants run independently to conclusion.

The simple fix is to adjust the python-version build matrix to be consistent with the package versions in requirements.txt. I think, though, that it's a good demonstration to have a build matrix that runs obsolete configurations, as well newer than what the code was written for. Codes break all the time (mine do, anyway!) because external dependencies become unavailable or "upgrade" with some incompatible change. Testing for, recognizing, and addressing these situations are important skills for releasing robust software.

If I can figure out why all jobs get cancelled, I'll submit a patch that both addresses that and adds didactic about using the CI to test for configurations other than what the author used.

guyer avatar Mar 05 '22 15:03 guyer

All jobs get cancelled because of default behavior of GitHub actions:

From GitHub's documentation:

GitHub will cancel all in-progress and queued jobs in the matrix if any job in the matrix fails.

This can be changed by changing the fail-fast property:

...
    strategy:
      fail-fast: false
      matrix:
...

thomaskileyukaea avatar Jul 17 '23 10:07 thomaskileyukaea

This is useful to know, could add a note in the material or Instructor Notes.

anenadic avatar May 22 '24 10:05 anenadic