Skip to content

Commit 861beb4

Browse files
authored
Zabbix-cli V3 (#186)
1 parent 494f214 commit 861beb4

File tree

149 files changed

+20667
-11302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+20667
-11302
lines changed

.github/workflows/build.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: build zabbix-cli
2+
3+
on:
4+
push:
5+
tags:
6+
- zabbix-cli-v*
7+
8+
concurrency:
9+
group: build-zabbix-cli-${{ github.head_ref }}
10+
11+
jobs:
12+
build_pypi:
13+
name: Build wheels and source distribution
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Exit if not on master branch
20+
if: github.ref_name != 'master'
21+
run: exit -1
22+
23+
- name: Install build dependencies
24+
run: python -m pip install --upgrade build
25+
26+
- name: Build source distribution
27+
run: python -m build
28+
29+
- uses: actions/upload-artifact@v4
30+
with:
31+
name: pypi_artifacts
32+
path: dist/*
33+
if-no-files-found: error
34+
35+
build_pyinstaller:
36+
name: Build pyinstaller binary
37+
runs-on: ${{ matrix.os }}
38+
strategy:
39+
matrix:
40+
os: [ubuntu-22.04, windows-latest, macos-latest]
41+
python-version:
42+
- '3.12'
43+
steps:
44+
- uses: actions/checkout@v4
45+
46+
- name: Set up Python ${{ matrix.python-version }}
47+
uses: actions/setup-python@v5
48+
with:
49+
python-version: ${{ matrix.python-version }}
50+
51+
- name: Build binary with PyInstaller
52+
run: |
53+
python -m pip install --upgrade pip
54+
python -m pip install -U . pyinstaller
55+
56+
57+
- name: Rename binary
58+
run: |
59+
mv dist/zabbix-cli${{ contains(matrix.os, 'windows') && '.exe' || '' }} dist/zabbix-cli-${{ matrix.os }}-${{ matrix.python-version }}${{ contains(matrix.os, 'windows') && '.exe' || '' }}
60+
61+
- uses: actions/upload-artifact@v4
62+
with:
63+
name: zabbix-cli-${{ matrix.os }}-${{ matrix.python-version }}${{ contains(matrix.os, 'windows') && '.exe' || '' }}
64+
path: dist/zabbix-cli-${{ matrix.os }}-${{ matrix.python-version }}${{ contains(matrix.os, 'windows') && '.exe' || '' }}
65+
if-no-files-found: error
66+
67+
publish_pypi:
68+
name: Publish PyPI release
69+
needs:
70+
- build_pypi
71+
runs-on: ubuntu-latest
72+
permissions:
73+
id-token: write
74+
steps:
75+
- uses: actions/download-artifact@v4
76+
with:
77+
name: pypi_artifacts
78+
path: dist
79+
80+
- name: Push build artifacts to PyPI
81+
uses: pypa/[email protected]
82+
83+
publish_github:
84+
name: Publish GitHub release
85+
needs:
86+
- build_pypi
87+
- build_pyinstaller
88+
runs-on: ubuntu-latest
89+
90+
steps:
91+
- name: Download PyInstaller binaries
92+
uses: actions/download-artifact@v4
93+
with:
94+
pattern: zabbix-cli-*
95+
path: dist
96+
merge-multiple: true
97+
98+
- name: Download wheel and source distributions
99+
uses: actions/download-artifact@v4
100+
with:
101+
pattern: pypi_artifacts
102+
path: dist
103+
merge-multiple: true
104+
105+
- name: Create GitHub release
106+
id: create_release
107+
uses: actions/create-release@v1
108+
env:
109+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110+
with:
111+
tag_name: ${{ github.ref }}
112+
release_name: Release ${{ github.ref }}
113+
body: |
114+
Release notes for ${{ github.ref }}
115+
draft: false
116+
prerelease: false
117+
118+
- name: Upload release asset
119+
id: upload-release-asset
120+
uses: softprops/action-gh-release@v2
121+
env:
122+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123+
with:
124+
files: dist/*

.github/workflows/docs.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: build-docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- docs-dev
8+
paths:
9+
- "docs/**"
10+
- "mkdocs.yml"
11+
- ".github/workflows/docs.yml"
12+
- "pyproject.toml"
13+
- "zabbix_cli/**"
14+
15+
concurrency:
16+
group: docs-deploy
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: "3.12"
29+
30+
- name: Ensure latest pip
31+
run: python -m pip install --upgrade pip
32+
33+
- name: Install hatch
34+
run: pip install hatch
35+
36+
- name: Build documentation and publish
37+
run: hatch run docs:mkdocs gh-deploy --force

.github/workflows/documentation.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,25 @@ name: CI
1212
jobs:
1313
test:
1414
name: Test
15-
runs-on: ubuntu-20.04
15+
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
1818
python-version:
19-
- '3.6'
20-
- '3.7'
2119
- '3.8'
2220
- '3.9'
2321
- '3.10'
2422
- '3.11'
2523
- '3.12'
2624
steps:
2725
- name: Checkout
28-
uses: actions/checkout@v3
26+
uses: actions/checkout@v4
2927
- name: Install Python
30-
uses: actions/setup-python@v4
28+
uses: actions/setup-python@v5
3129
with:
3230
python-version: ${{ matrix.python-version }}
3331
cache: pip
34-
# Default cache key is requirements.txt.
35-
cache-dependency-path: setup.py
3632
- name: Install dependencies
3733
run: |
38-
pip install requests pytest
34+
pip install .[test]
3935
- name: Test
4036
run: python -m pytest -vv

.gitignore

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*.pyc
22

3+
# Build files
34
dist/
45
build/
56
*.egg-info/
@@ -12,4 +13,18 @@ venv/
1213

1314
.dccache
1415
.vscode/launch.json
15-
my_tests/
16+
my_tests/
17+
18+
# Hatch Pyapp
19+
pyapp
20+
21+
# Dev commands
22+
zabbix_cli/commands/_dev.py
23+
24+
# Auto-generated docs files
25+
docs/guide/commands/
26+
docs/data
27+
site/
28+
29+
# Pyinstaller
30+
*.spec

.pre-commit-config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.6.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- repo: https://github.com/asottile/pyupgrade
12+
rev: v3.17.0
13+
hooks:
14+
- id: pyupgrade
15+
args: [--py37-plus, --keep-runtime-typing]
16+
- repo: https://github.com/charliermarsh/ruff-pre-commit
17+
rev: "v0.5.7"
18+
hooks:
19+
# Run the linter.
20+
- id: ruff
21+
args: [--fix]
22+
# Run the formatter.
23+
- id: ruff-format
24+
- repo: https://github.com/RobertCraigie/pyright-python
25+
rev: v1.1.375
26+
hooks:
27+
- id: pyright
28+
exclude: ^(tests|scripts|docs)/

0 commit comments

Comments
 (0)