python-intermediate-development
python-intermediate-development copied to clipboard
GitHub Action Build Matrix cancels all jobs
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:
- Following the current instructions produces a
venv
andrequirements.txt
for Python 3.9 -
build (ubuntu-latest, 3.7) fails with
ERROR: No matching distribution found for numpy==1.22.2
- All subsequent jobs are cancelled:
The job was canceled because "ubuntu-latest_3_7" failed.
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.
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:
...
This is useful to know, could add a note in the material or Instructor Notes.