Debian Codegraph @

.github/workflows/ci.yml

raw
1 name: CI
2
3 on:
4 push:
5 tags: ["*.*.*"]
6 branches: [master]
7 pull_request:
8 branches: [master]
9
10 schedule:
11 - cron: 37 1 * * 1
12
13 jobs:
14 pre-commit:
15 runs-on: ubuntu-latest
16
17 steps:
18 - uses: actions/checkout@v3
19
20 - uses: actions/setup-python@v4
21 with:
22 python-version: 3.x
23
24 - uses: pre-commit/[email protected]
25
26 lint:
27 runs-on: ubuntu-latest
28 steps:
29 - uses: actions/checkout@v3
30
31 - uses: actions/setup-python@v4
32 with:
33 python-version: 3.x
34
35 - uses: actions/cache@v3
36 with:
37 path: ~/.cache/pip
38 key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
39 restore-keys: |
40 ${{ runner.os }}-pip-
41
42 - run: make install
43 - run: make lint
44
45 test:
46 runs-on: ubuntu-20.04
47 strategy:
48 matrix:
49 python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
50
51 steps:
52 - uses: actions/checkout@v3
53
54 - uses: actions/setup-python@v4
55 with:
56 python-version: ${{ matrix.python-version }}
57
58 - uses: actions/cache@v3
59 with:
60 path: ~/.cache/pip
61 key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
62 restore-keys: |
63 ${{ runner.os }}-pip-
64
65 - run: make install
66 - run: make test
67
68 e2e:
69 runs-on: ubuntu-latest
70 strategy:
71 fail-fast: false
72 matrix:
73 zabbix-version: ["4.0", "5.0", "6.0", "6.4"]
74
75 env:
76 ZABBIX_VERSION: ${{ matrix.zabbix-version }}
77
78 steps:
79 - uses: actions/checkout@v3
80
81 - uses: actions/setup-python@v4
82 with:
83 python-version: 3.x
84
85 - uses: actions/cache@v3
86 with:
87 path: ~/.cache/pip
88 key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
89 restore-keys: |
90 ${{ runner.os }}-pip-
91
92 - run: docker-compose up -d
93 - run: docker-compose images
94 - run: make install
95 - run: make e2e
96
97 publish:
98 if: startsWith(github.ref, 'refs/tags')
99 needs: [pre-commit, lint, test, e2e]
100 runs-on: ubuntu-latest
101
102 steps:
103 - uses: actions/checkout@v3
104
105 - uses: actions/setup-python@v4
106 with:
107 python-version: 3.x
108
109 - uses: actions/cache@v3
110 with:
111 path: ~/.cache/pip
112 key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
113 restore-keys: |
114 ${{ runner.os }}-pip-
115
116 - run: make clean build
117
118 - if: github.repository_owner == 'lukecyca'
119 uses: pypa/[email protected]
120 with:
121 password: ${{ secrets.PYPI_API_TOKEN }}
122
123 - if: github.repository_owner == 'lukecyca'
124 uses: softprops/action-gh-release@v1
125 with:
126 draft: true
127 body: |
128 Please see [CHANGELOG.md](https://github.com/lukecyca/pyzabbix/blob/master/CHANGELOG.md)