Created
September 21, 2022 17:25
-
-
Save sarina/b50a047aa174be72611865e6860b2f3b to your computer and use it in GitHub Desktop.
would this work?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Matrix experiment" | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
define-excludes: | |
runs-on: "ubuntu-latest" | |
# Define any Django version you'd like to exclude from failing | |
# tests in the D_EXCLUDE (can be expanded later to Python) | |
# (not too sure what to do if there's more than 1) | |
run: | | |
echo 'D_EXCLUDE="4.0"' >> $GITHUB_ENV | |
tests: | |
name: "py ${{ matrix.python-version }}; dj ${{ matrix.django-version}}" | |
runs-on: "ubuntu-latest" | |
needs: define-excludes | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: | |
- "3.7" | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
django-version: | |
- "3.2" | |
- "4.0" | |
# We expect Django 4.0 to fail, so don't stop if it does. | |
continue-on-error: ${{ matrix.django-version == $D_EXCLUDE }} | |
steps: | |
- name: "Fake tests" | |
run: | | |
echo "Python: ${{ matrix.python-version }}" | |
echo "Django: ${{ matrix.django-version }}" | |
# Django 4.0 doesn't pass yet... | |
if [[ "${{ matrix.django-version }}" == $D_EXCLUDE ]]; then exit 17; fi | |
echo "Success" | |
- name: "Process failure" | |
if: ${{ failure() && matrix.django-version != $D_EXCLUDE }} | |
run: | | |
echo 'FAILED=1' >> $GITHUB_ENV | |
success: | |
needs: tests | |
name: "Test Success?" | |
steps: | |
- run: | | |
if $FAILED; exit 17; fi | |
echo "Success" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment