summaryrefslogtreecommitdiff
path: root/.github/workflows/integration.yaml
blob: 8d38cd45c749375f45eb73e34fa9a49a4e35717d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: CI

on:
  push:
    paths-ignore:
      - 'docs/**'
      - '**/*.rst'
      - '**/*.md'
    branches:
      - master
      - '[0-9].[0-9]'
  pull_request:
    branches:
      - master
      - '[0-9].[0-9]'
  schedule:
    - cron: '0 1 * * *' # nightly build

permissions:
  contents: read  #  to fetch code (actions/checkout)

jobs:

   dependency-audit:
     name: Dependency audit
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v3
       - uses: pypa/gh-action-pip-audit@v1.0.0
         with:
           inputs: requirements.txt dev_requirements.txt
           ignore-vulns: |
             GHSA-w596-4wvx-j9j6  # subversion related git pull, dependency for pytest. There is no impact here.

   lint:
     name: Code linters
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v3
       - uses: actions/setup-python@v4
         with:
           python-version: 3.9
           cache: 'pip'
       - name: run code linters
         run: |
           pip install -r dev_requirements.txt
           invoke linters

   run-tests:
     runs-on: ubuntu-latest
     timeout-minutes: 30
     strategy:
       max-parallel: 15
       matrix:
         python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.7', 'pypy-3.8']
         test-type: ['standalone', 'cluster']
         connection-type: ['hiredis', 'plain']
     env:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
     name: Python ${{ matrix.python-version }} ${{matrix.test-type}}-${{matrix.connection-type}} tests
     steps:
       - uses: actions/checkout@v3
       - uses: actions/setup-python@v4
         with:
           python-version: ${{ matrix.python-version }}
           cache: 'pip'
       - name: run tests
         run: |
           pip install -U setuptools wheel
           pip install -r dev_requirements.txt
           tox -e ${{matrix.test-type}}-${{matrix.connection-type}}
       - uses: actions/upload-artifact@v2
         if: success() || failure()
         with:
           name: pytest-results-${{matrix.test-type}}
           path: '${{matrix.test-type}}*results.xml'
       - name: Upload codecov coverage
         uses: codecov/codecov-action@v3
         with:
           fail_ci_if_error: false
      #  - name: View Test Results
      #    uses: dorny/test-reporter@v1
      #    if: success() || failure()
      #    with:
      #      name: Test Results ${{matrix.python-version}} ${{matrix.test-type}}-${{matrix.connection-type}}
      #      path: '${{matrix.test-type}}*results.xml'
      #      reporter: java-junit
      #      list-suites: failed
      #      list-tests: failed
      #      max-annotations: 10

   build_and_test_package:
    name: Validate building and installing the package
    runs-on: ubuntu-latest
    strategy:
      matrix:
        extension: ['tar.gz', 'whl']
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: 3.9
      - name: Run installed unit tests
        run: |
          bash .github/workflows/install_and_test.sh ${{ matrix.extension }}

   install_package_from_commit:
    name: Install package from commit hash
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.7']
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}
          cache: 'pip'
      - name: install from pip
        run: |
          pip install --quiet git+${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git@${GITHUB_SHA}