Skip to content

Update mypy from 1.0.0 to 1.6.0 #311

Update mypy from 1.0.0 to 1.6.0

Update mypy from 1.0.0 to 1.6.0 #311

Workflow file for this run

name: Build and Test
on:
push:
pull_request:
branches:
- master
types: [closed]
jobs:
matrix-builder:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
inverted_matrix: ${{ steps.set-matrix.outputs.inverted_matrix }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
architecture: x64
- id: set-matrix
env:
PY_VERSIONS: "[\"3.7\", \"3.8\", \"3.9\", \"3.10\", \"3.11\", \"pypy-3.8-v7.3.11\", \"pypy-3.9-v7.3.11\"]"
OS_NAMES: "[\"ubuntu-20.04\"]" #, windows-latest, macOS-latest]
CELERY_VERSIONS: "[\">=3.1.0,<4.0.0\", \">=4.0.0,<5.0.0\", \">=5.0.0,<6.0.0\"]"
run: |
python -m pip install --upgrade pip
MATRIX=$(python .github/workflows/resolve_versions.py matrix -c "$PY_VERSIONS" -o "$OS_NAMES" -n "celery" -s "$CELERY_VERSIONS")
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
INV_MATRIX=$(python .github/workflows/resolve_versions.py matrix -c "$PY_VERSIONS" -o "$OS_NAMES" -n "celery" -s "$CELERY_VERSIONS" --invert)
echo "inverted_matrix=$INV_MATRIX" >> $GITHUB_OUTPUT
unsupported:
name: Skipping on Python ${{ matrix.python-version }} and ${{ matrix.os }} with celery${{ matrix.celery }}
needs: matrix-builder
strategy:
matrix: ${{ fromJSON(needs.matrix-builder.outputs.inverted_matrix) }}
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Prepare badges
id: badges
run: |
CELERY_MAJOR=$(echo "${{ matrix.celery }}" | sed -r 's/^([^.]+).*$/\1/; s/^[^0-9]*([0-9]+).*$/\1/')
echo "celery=${CELERY_MAJOR}" >> $GITHUB_OUTPUT
echo "source_name=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
echo "source_branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
echo "source_tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
[[ "${{ matrix.python-version }}" == pypy* ]] \
&& echo "python=$(echo "${{ matrix.python-version }}" | cut -d '-' -f1-2)" >> $GITHUB_OUTPUT \
|| echo "python=${{ matrix.python-version }}" >> $GITHUB_OUTPUT
[[ "${{ matrix.os }}" == ubuntu* ]] && echo "platform=linux" >> $GITHUB_OUTPUT || echo "Not on linux"
[[ "${{ matrix.os }}" == windows* ]] && echo "platform=windows" >> $GITHUB_OUTPUT || echo "Not on window"
[[ "${{ matrix.os }}" == macOS* ]] && echo "platform=apple" >> $GITHUB_OUTPUT || echo "Not on macOS"
- name: Badge Creation (master) (unsupported)
uses: RubbaBoy/[email protected]
if: github.event.pull_request.merged == true && steps.badges.outcome == 'success'
with:
NAME: m_${{ steps.badges.outputs.platform }}_${{ steps.badges.outputs.python }}_celery${{ steps.badges.outputs.celery }}
ICON: 'https://simpleicons.vercel.app/${{ steps.badges.outputs.platform }}/ffffff'
LABEL: "celery-pubsub (in master)"
STATUS: "Unsupported"
COLOR: yellow
GITHUB_TOKEN: ${{ secrets.BADGES_TOKEN }}
- name: Badge Creation (tag) (unsupported)
uses: RubbaBoy/[email protected]
if: github.event_name == 'push' && github.ref_type == 'tag' && steps.badges.outcome == 'success'
with:
NAME: ${{ steps.badges.outputs.source_tag }}_${{ steps.badges.outputs.platform }}_${{ steps.badges.outputs.python }}_celery${{ steps.badges.outputs.celery }}
ICON: 'https://simpleicons.vercel.app/${{ steps.badges.outputs.platform }}/ffffff'
LABEL: "celery-pubsub ${{ steps.badges.outputs.source_tag }}"
STATUS: "Unsupported"
COLOR: yellow
GITHUB_TOKEN: ${{ secrets.BADGES_TOKEN }}
build:
name: Test on Python ${{ matrix.python-version }} and ${{ matrix.os }} with celery${{ matrix.celery }}
needs: matrix-builder
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{ fromJSON(needs.matrix-builder.outputs.matrix) }}
fail-fast: false
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Show system
run: |
python --version
uname -a
lsb_release -a
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_test.txt
pip install "celery${{ matrix.celery }}"
pip install pytest-github-actions-annotate-failures
- name: Check with mypy
if: ${{ !startsWith(matrix.python-version, 'pypy') && matrix.python-version >= '3.7' }}
run: mypy
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude .github
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude .github
- name: Test with pytest
run: |
coverage run -m pytest -v -s tests
coverage report
- name: Code Climate Coverage Action
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageCommand: coverage xml
debug: true
- name: Prepare badges
id: badges
run: |
CELERY_MAJOR=$(echo "${{ matrix.celery }}" | sed -r 's/^([^.]+).*$/\1/; s/^[^0-9]*([0-9]+).*$/\1/')
echo "celery=${CELERY_MAJOR}" >> $GITHUB_OUTPUT
echo "source_name=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
echo "source_branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
echo "source_tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
[[ "${{ matrix.python-version }}" == pypy* ]] \
&& echo "python=$(echo "${{ matrix.python-version }}" | cut -d '-' -f1-2)" >> $GITHUB_OUTPUT \
|| echo "python=${{ matrix.python-version }}" >> $GITHUB_OUTPUT
[[ "${{ matrix.os }}" == ubuntu* ]] && echo "platform=linux" >> $GITHUB_OUTPUT || echo "Not on linux"
[[ "${{ matrix.os }}" == windows* ]] && echo "platform=windows" >> $GITHUB_OUTPUT || echo "Not on window"
[[ "${{ matrix.os }}" == macOS* ]] && echo "platform=apple" >> $GITHUB_OUTPUT || echo "Not on macOS"
- name: Badge Creation (master) (success)
uses: RubbaBoy/[email protected]
if: github.event.pull_request.merged == true && steps.badges.outcome == 'success'
with:
NAME: m_${{ steps.badges.outputs.platform }}_${{ steps.badges.outputs.python }}_celery${{ steps.badges.outputs.celery }}
ICON: 'https://simpleicons.vercel.app/${{ steps.badges.outputs.platform }}/ffffff'
LABEL: "celery-pubsub (in master)"
STATUS: "Supported"
COLOR: green
GITHUB_TOKEN: ${{ secrets.BADGES_TOKEN }}
- name: Badge Creation (master) (failure)
uses: RubbaBoy/[email protected]
if: github.event.pull_request.merged == true && steps.badges.outcome != 'success'
with:
NAME: m_${{ steps.badges.outputs.platform }}_${{ steps.badges.outputs.python }}_celery${{ steps.badges.outputs.celery }}
ICON: 'https://simpleicons.vercel.app/${{ steps.badges.outputs.platform }}/ffffff'
LABEL: "celery-pubsub (in master)"
STATUS: "Failed"
COLOR: red
GITHUB_TOKEN: ${{ secrets.BADGES_TOKEN }}
- name: Badge Creation (tag) (success)
uses: RubbaBoy/[email protected]
if: github.event_name == 'push' && github.ref_type == 'tag' && steps.badges.outcome == 'success'
with:
NAME: ${{ steps.badges.outputs.source_tag }}_${{ steps.badges.outputs.platform }}_${{ steps.badges.outputs.python }}_celery${{ steps.badges.outputs.celery }}
ICON: 'https://simpleicons.vercel.app/${{ steps.badges.outputs.platform }}/ffffff'
LABEL: "celery-pubsub ${{ steps.badges.outputs.source_tag }}"
STATUS: "Supported"
COLOR: green
GITHUB_TOKEN: ${{ secrets.BADGES_TOKEN }}
- name: Badge Creation (tag) (failure)
uses: RubbaBoy/[email protected]
if: github.event_name == 'push' && github.ref_type == 'tag' && steps.badges.outcome != 'success'
with:
NAME: ${{ steps.badges.outputs.source_tag }}_${{ steps.badges.outputs.platform }}_${{ steps.badges.outputs.python }}_celery${{ steps.badges.outputs.celery }}
ICON: 'https://simpleicons.vercel.app/${{ steps.badges.outputs.platform }}/ffffff'
LABEL: "celery-pubsub ${{ steps.badges.outputs.source_tag }}"
STATUS: "Failed"
COLOR: red
GITHUB_TOKEN: ${{ secrets.BADGES_TOKEN }}