nephila/djangocms-redirect

View on GitHub
.github/workflows/test.yml

Summary

Maintainability
Test Coverage
name: Tox tests

on: [push, pull_request]

jobs:
  test:
    if: "!contains(github.event.head_commit.message, '[skip ci]')"
    runs-on: ubuntu-latest
    continue-on-error: ${{ matrix.continue-on-error }}
    strategy:
      matrix:
        python-version: ["3.11", "3.10", "3.9"]
        django: [42, 41, 32]
        cms: [311, 39]
        continue-on-error: [false]
        exclude:
          - django: 41
            cms: 39
          - django: 42
            cms: 39
          - django: 32
            cms: 311
          - django: 42
            cms: 311
    steps:
    - uses: actions/checkout@v3
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}
    - name: Cache pip
      uses: actions/cache@v3
      with:
        path: ~/.cache/pip
        key: ${{ runner.os }}-pip-${{ matrix.toxenv }}
        restore-keys: |
          ${{ runner.os }}-pip-${{ matrix.toxenv }}
    - name: Cache tox
      uses: actions/cache@v3
      with:
        path: .tox
        key: ${{ runner.os }}-tox-${{ format('{{py{0}-django{1}-cms{2}}}', matrix.python-version, matrix.django, matrix.cms) }}-${{ hashFiles('setup.cfg') }}
        restore-keys: |
          ${{ runner.os }}-tox-${{ format('{{py{0}-django{1}-cms{2}}}', matrix.python-version, matrix.django, matrix.cms) }}-
    - name: Install dependencies
      run: |
        sudo apt-get install gettext memcached
        python -m pip install --upgrade pip tox>4
    - name: Test with tox
      env:
        TOX_ENV: ${{ format('py-django{1}-cms{2}', matrix.python-version, matrix.django, matrix.cms) }}
        COMMAND: coverage run
        COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        COVERALLS_SERVICE_NAME: github
      run: |
        tox -e$TOX_ENV
        .tox/$TOX_ENV/bin/coverage xml
        .tox/$TOX_ENV/bin/coveralls
    - uses: codecov/codecov-action@v3
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        flags: unittests
        file: ./coverage.xml
        fail_ci_if_error: false
    services:
      redis:
        image: redis
        ports:
          - 6379:6379
      memcached:
        image: memcached:latest
        ports:
        - 11211:11211