-
Notifications
You must be signed in to change notification settings - Fork 154
105 lines (89 loc) · 3.16 KB
/
lint.yaml
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
name: Lint
on:
push:
branches:
- main
pull_request:
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Python
id: py
uses: actions/setup-python@v5
with:
python-version: "3.7 - 3.12"
update-environment: true
- name: Set up Python 3.7
id: py37
uses: actions/setup-python@v5
with:
python-version: "3.7"
update-environment: false
- name: Check syntax (Python 3.7)
run: |
"${{ steps.py37.outputs.python-path }}" -m compileall nvitop
(
cd nvitop-exporter &&
"${{ steps.py37.outputs.python-path }}" -m compileall nvitop_exporter
)
- name: Upgrade pip
run: |
python -m pip install --upgrade pip setuptools
- name: Install dependencies
run: |
python -m pip install -r requirements.txt
- name: Import tests
run: |
python -c 'import nvitop'
python -m nvitop --version
python -m nvitop --help
python -m nvitop.select --version
python -m nvitop.select --help
- name: Import tests (Python 3.7)
run: |
"${{ steps.py37.outputs.python-path }}" -m pip install --upgrade pip setuptools
"${{ steps.py37.outputs.python-path }}" -m pip install -r requirements.txt
"${{ steps.py37.outputs.python-path }}" -c 'import nvitop'
"${{ steps.py37.outputs.python-path }}" -m nvitop --version
"${{ steps.py37.outputs.python-path }}" -m nvitop --help
"${{ steps.py37.outputs.python-path }}" -m nvitop.select --version
"${{ steps.py37.outputs.python-path }}" -m nvitop.select --help
- name: Install dependencies for nvitop-exporter
run: |
python -m pip install -r nvitop-exporter/requirements.txt
- name: Import tests for nvitop-exporter
run: |
(
cd nvitop-exporter &&
python -c 'import nvitop_exporter' &&
python -m nvitop_exporter --version &&
python -m nvitop_exporter --help
)
- name: Import tests for nvitop-exporter (Python 3.7)
run: |
(
cd nvitop-exporter &&
"${{ steps.py37.outputs.python-path }}" -m pip install -r requirements.txt &&
"${{ steps.py37.outputs.python-path }}" -c 'import nvitop_exporter' &&
"${{ steps.py37.outputs.python-path }}" -m nvitop_exporter --version &&
"${{ steps.py37.outputs.python-path }}" -m nvitop_exporter --help
)
- name: Install linters
run: |
python -m pip install --upgrade pre-commit pylint[spelling] mypy typing-extensions
- name: pre-commit
run: |
python -m pre_commit --version
python -m pre_commit install --install-hooks
python -m pre_commit run --all-files