mirror of
https://github.com/XuehaiPan/nvitop.git
synced 2026-05-21 06:45:24 -06:00
78 lines
2.2 KiB
YAML
78 lines
2.2 KiB
YAML
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@v3
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Set up Python
|
|
id: py
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.7 - 3.11"
|
|
update-environment: true
|
|
|
|
- name: Set up Python 3.7
|
|
id: py37
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.7"
|
|
update-environment: false
|
|
|
|
- name: Check syntax (Python 3.7)
|
|
run: |
|
|
"${{ steps.py37.outputs.python-path }}" -m compileall nvitop
|
|
|
|
- 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 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
|