summaryrefslogtreecommitdiff
path: root/.github/workflows/testing.yml
blob: c715b09c897f09410fd1b1fb7f712152b40f2ff2 (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
name: Kazoo Awesome Testing

on:
  push:
    branches:
      - master
      - release/*
  pull_request:
    branches:
      - master
      - release/*

jobs:
  validate:
    name: Code Validation

    runs-on: ubuntu-latest

    steps:
      - name: Handle the code
        uses: actions/checkout@v3

      - name: "Set up Python 3.10"
        uses: actions/setup-python@v4
        with:
          python-version: "3.10"

      - name: Handle pip cache
        uses: actions/cache@v3
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-

      - name: Install required dependencies
        run: |
          python3 -m pip install --upgrade pip
          pip install tox

      - name: Code check
        run: tox -e ${TOX_VENV}
        env:
          TOX_VENV: black,pep8,mypy

  test:
    needs: [validate]

    name: >
      Test Python ${{ matrix.python-version }},
      ZK ${{ matrix.zk-version }}

    runs-on: ubuntu-latest

    strategy:
      fail-fast: false
      matrix:
        python-version: ["3.7", "3.8", "3.9", "3.10", "pypy-3.7"]
        zk-version: ["3.4.14", "3.5.10", "3.6.3", "3.7.1"]
        include:
          - python-version: "3.7"
            tox-env: py37
          - python-version: "3.8"
            tox-env: py38
          - python-version: "3.9"
            tox-env: py39
          - python-version: "3.10"
            tox-env: py310
          - python-version: "pypy-3.7"
            tox-env: pypy3
    steps:
      - name: Handle the code
        uses: actions/checkout@v3

      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}

      - name: Handle pip cache
        uses: actions/cache@v3
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-

      - name: Handle ZK installation cache
        uses: actions/cache@v3
        with:
          path: zookeeper
          key: ${{ runner.os }}-zookeeper
          restore-keys: |
            ${{ runner.os }}-zookeeper

      - name: Install required dependencies
        run: |
          sudo apt-get -y install libevent-dev krb5-kdc krb5-admin-server libkrb5-dev
          python3 -m pip install --upgrade pip
          pip install tox

      - name: Test with tox
        run: tox -e ${TOX_VENV}
        env:
          TOX_VENV: ${{ format('{0}-{1}', matrix.tox-env, 'gevent-eventlet-sasl') }}
          ZOOKEEPER_VERSION: ${{ matrix.zk-version }}
          # TODO: can be removed once tests for ZK 3.4 are removed
          ZOOKEEPER_PREFIX: "${{ !contains(matrix.zk-version, '3.4') && 'apache-' || '' }}"
          ZOOKEEPER_SUFFIX: "${{ !contains(matrix.zk-version, '3.4') && '-bin' || '' }}"
          ZOOKEEPER_LIB: "${{ !contains(matrix.zk-version, '3.4') && 'lib' || '' }}"

      - name: Publish Codecov report
        uses: codecov/codecov-action@v3