Update test matrix to use ubuntu-22.04 instead of deprecated ubuntu-2… #141
This file contains hidden or 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: Tests | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| workflow_dispatch: | |
| jobs: | |
| notify-build-start: | |
| # Secrets are not available for forks for security reasons, so pull | |
| # request checks will fail when trying to send the Slack notification. | |
| # Unfortunately, there's no way to explicitly check that a secret is | |
| # available, so we check for event_name instead: | |
| # https://github.com/actions/runner/issues/520 | |
| if: ${{ github.event_name == 'push' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Send build notifications to Slack | |
| - uses: ivelum/github-action-slack-notify-build@v1.7.2 | |
| id: slack | |
| with: | |
| channel_id: C0PT3267R | |
| status: STARTED | |
| color: '#ee9b00' | |
| env: | |
| SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
| outputs: | |
| status_message_id: ${{ steps.slack.outputs.message_id }} | |
| lint: | |
| needs: [notify-build-start] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.9 | |
| - name: get pip cache dir | |
| id: pip-cache | |
| run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
| - name: cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.pip-cache.outputs.dir }} | |
| key: pip|lint | |
| - run: pip install -r requirements-dev.txt | |
| - run: flake8 | |
| - run: isort --diff -c . | |
| # Send notification on build failure | |
| - name: Notify slack fail | |
| uses: ivelum/github-action-slack-notify-build@v1.7.2 | |
| if: failure() | |
| env: | |
| SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
| with: | |
| message_id: ${{ needs.notify-build-start.outputs.status_message_id }} | |
| channel_id: C0PT3267R | |
| status: FAILED | |
| color: '#d7263d' | |
| tests: | |
| needs: [notify-build-start, lint] | |
| runs-on: ubuntu-${{ matrix.ubuntu }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - {django: '1.8.*', python: '2.7', ubuntu: '22.04'} | |
| - {django: '1.9.*', python: '2.7', ubuntu: '22.04'} | |
| - {django: '1.10.*', python: '2.7', ubuntu: '22.04'} | |
| - {django: '1.11.*', python: '2.7', ubuntu: '22.04'} | |
| - {django: '1.11.*', python: '3.6', ubuntu: '22.04'} | |
| - {django: '1.11.*', python: '3.7', ubuntu: '22.04'} | |
| - {django: '2.0.*', python: '3.6', ubuntu: '22.04'} | |
| - {django: '2.0.*', python: '3.7', ubuntu: '22.04'} | |
| - {django: '2.1.*', python: '3.6', ubuntu: '22.04'} | |
| - {django: '2.1.*', python: '3.7', ubuntu: '22.04'} | |
| - {django: '2.2.*', python: '3.6', ubuntu: '22.04'} | |
| - {django: '2.2.*', python: '3.7', ubuntu: '22.04'} | |
| - {django: '2.2.*', python: '3.8', ubuntu: '24.04'} | |
| - {django: '2.2.*', python: '3.9', ubuntu: '24.04'} | |
| - {django: '3.0.*', python: '3.6', ubuntu: '22.04'} | |
| - {django: '3.0.*', python: '3.7', ubuntu: '22.04'} | |
| - {django: '3.0.*', python: '3.8', ubuntu: '24.04'} | |
| - {django: '3.0.*', python: '3.9', ubuntu: '24.04'} | |
| - {django: '3.1.*', python: '3.6', ubuntu: '22.04'} | |
| - {django: '3.1.*', python: '3.7', ubuntu: '22.04'} | |
| - {django: '3.1.*', python: '3.8', ubuntu: '24.04'} | |
| - {django: '3.1.*', python: '3.9', ubuntu: '24.04'} | |
| - {django: '3.2.*', python: '3.6', ubuntu: '22.04'} | |
| - {django: '3.2.*', python: '3.7', ubuntu: '22.04'} | |
| - {django: '3.2.*', python: '3.8', ubuntu: '24.04'} | |
| - {django: '3.2.*', python: '3.9', ubuntu: '24.04'} | |
| - {django: '3.2.*', python: '3.10', ubuntu: '24.04'} | |
| - {django: '4.0.*', python: '3.8', ubuntu: '24.04'} | |
| - {django: '4.0.*', python: '3.9', ubuntu: '24.04'} | |
| - {django: '4.0.*', python: '3.10', ubuntu: '24.04'} | |
| - {django: '4.1.*', python: '3.8', ubuntu: '24.04'} | |
| - {django: '4.1.*', python: '3.9', ubuntu: '24.04'} | |
| - {django: '4.1.*', python: '3.10', ubuntu: '24.04'} | |
| - {django: '4.1.*', python: '3.11', ubuntu: '24.04'} | |
| - {django: '4.2.*', python: '3.8', ubuntu: '24.04'} | |
| - {django: '4.2.*', python: '3.9', ubuntu: '24.04'} | |
| - {django: '4.2.*', python: '3.10', ubuntu: '24.04'} | |
| - {django: '4.2.*', python: '3.11', ubuntu: '24.04'} | |
| - {django: '4.2.*', python: '3.12', ubuntu: '24.04'} | |
| - {django: '5.0.*', python: '3.10', ubuntu: '24.04'} | |
| - {django: '5.0.*', python: '3.11', ubuntu: '24.04'} | |
| - {django: '5.0.*', python: '3.12', ubuntu: '24.04'} | |
| - {django: '5.1.*', python: '3.10', ubuntu: '24.04'} | |
| - {django: '5.1.*', python: '3.11', ubuntu: '24.04'} | |
| - {django: '5.1.*', python: '3.12', ubuntu: '24.04'} | |
| - {django: '5.1.*', python: '3.13', ubuntu: '24.04'} | |
| - {django: '5.2.*', python: '3.10', ubuntu: '24.04'} | |
| - {django: '5.2.*', python: '3.11', ubuntu: '24.04'} | |
| - {django: '5.2.*', python: '3.12', ubuntu: '24.04'} | |
| - {django: '5.2.*', python: '3.13', ubuntu: '24.04'} | |
| - {django: '5.2.*', python: '3.14', ubuntu: '24.04'} | |
| - {django: '6.0.*', python: '3.12', ubuntu: '24.04'} | |
| - {django: '6.0.*', python: '3.13', ubuntu: '24.04'} | |
| - {django: '6.0.*', python: '3.14', ubuntu: '24.04'} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Python 3.7+ | |
| if: ${{ matrix.python != '2.7' && matrix.python != '3.6' }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Setup Python 2.7/3.6 | |
| if: ${{ matrix.python == '2.7' || matrix.python == '3.6' }} | |
| uses: MatteoH2O1999/setup-python@v2 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| allow-build: info | |
| cache-build: true | |
| - name: update pip | |
| run: | | |
| pip install -U wheel | |
| pip install -U setuptools | |
| python -m pip install -U pip | |
| - name: get pip cache dir | |
| id: pip-cache | |
| run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
| - name: cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.pip-cache.outputs.dir }} | |
| key: pip|${{ matrix.python }}|${{ matrix.django }} | |
| - run: pip install PLY | |
| - run: pip install Django==${{ matrix.django }} | |
| - run: pip install -e . | |
| - run: python test_project/manage.py test core.tests | |
| # Send notification on build failure | |
| - name: Notify slack fail | |
| uses: ivelum/github-action-slack-notify-build@v1.7.2 | |
| if: failure() | |
| env: | |
| SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
| with: | |
| message_id: ${{ needs.notify-build-start.outputs.status_message_id }} | |
| channel_id: C0PT3267R | |
| status: FAILED | |
| color: '#d7263d' | |
| notify-build-success: | |
| if: ${{ github.event_name == 'push' }} | |
| needs: [notify-build-start, tests] | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Send notification on build success | |
| - name: Notify slack success | |
| uses: ivelum/github-action-slack-notify-build@v1.7.2 | |
| env: | |
| SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
| with: | |
| message_id: ${{ needs.notify-build-start.outputs.status_message_id }} | |
| channel_id: C0PT3267R | |
| status: SUCCESS | |
| color: '#16db65' |