Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .actrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
--workflows .github/act-serial.yaml
--platform js-20.04=ghcr.io/catthehacker/ubuntu:js-20.04
--platform ubuntu-20.04=ghcr.io/catthehacker/ubuntu:act-20.04
--workflows .github/workflows/main.yml
# Use this to run only specific variants of a matrix:
# -j test --matrix python-version:3.12 --matrix python-version:3.13
--platform ubuntu-22.04=ghcr.io/catthehacker/ubuntu:act-22.04
--platform ubuntu-24.04=ghcr.io/catthehacker/ubuntu:act-24.04
--platform ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest

# If using podman, use one of these, preferably in your ~/.actrc:
# For act-cli.rpm on Fedora 37:
# --container-daemon-socket /run/user/1000/podman/podman.sock
# For the latest act, use this in your ~/.actrc:
# --container-daemon-socket unix:///run/user/1000/podman/podman.sock
# More information on setting up act can be found at:
# https://github.com/xenserver/python-libs/blob/master/CONTRIBUTING.md#running-github-actions-locally-using-act
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ exclude_lines =
precision = 1
include =
xcp/*
omit =
xcp/dmv.py
66 changes: 0 additions & 66 deletions .github/act-serial.yaml

This file was deleted.

35 changes: 26 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,25 @@ env:
PIP_DISABLE_PIP_VERSION_CHECK: "1" # Reduce noise in logs

jobs:
pre-commit:
env:
SKIP: tox,no-commit-to-branch
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.13
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: pre-commit/[email protected]
- uses: pre-commit-ci/[email protected]
if: always()


test:
needs: pre-commit
strategy:
# See: https://github.com/xenserver/python-libs/pull/26#discussion_r1179482169
# max-parallel: 1
Expand All @@ -37,30 +55,29 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
if: ${{ !(matrix.python-version == '3.11' && github.actor == 'nektos/act') }}
with:
fetch-depth: 0 # Needed by diff-cover to get the changed lines: origin/master..HEAD

- name: Set up Python ${{ matrix.python-version }}
if: ${{ !(matrix.python-version == '3.11' && github.actor == 'nektos/act') }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Python 2.7 from Ubuntu 20.04 using apt-get install
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: sudo apt-get update && sudo apt-get install -y python2-dev

- name: Install missing cpio in containers of nektos/act
if: ${{ github.actor == 'nektos/act'}}
if: ${{ (matrix.python-version != '3.11' && github.actor == 'nektos/act') }}
run: apt-get update && apt-get install -y cpio

- name: Run of tox on ubuntu-latest
if: ${{ startsWith(matrix.python-version, '3.') && matrix.python-version != 3.6 }}
- name: Run of tox on Ubuntu
if: ${{ !(matrix.python-version == '3.11' && github.actor == 'nektos/act') }}
run: |
pip install 'virtualenv<20.22' 'tox==4.5.1' tox-gh-actions
pip install tox tox-gh-actions
tox --workdir .github/workflows/.tox --recreate

- name: Select the coverage file for upload
if: |
( matrix.python-version == '3.6' || matrix.python-version == '3.11' ) &&
matrix.python-version == '3.11' &&
( !cancelled() && github.actor != 'nektos/act' )
id: coverage
run: mv $( ls -t .github/workflows/.tox/*/log/.coverage | head -1 ) .coverage
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/reviewdog-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Reviewdog PR Review comments

#
# The reviewdog steps use reporter: github-pr-review, which submits the results
# as a review comment on the pull request. It needs a GitHub token with
# public_repo scope to post the comments and can only be used in the context
# of a pull request.
#
on: pull_request

#
# Checks can be skipped by adding "skip-checks: true" to a commit message,
# or requested by adding "request-checks: true" if disabled by default for pushes:
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks#skipping-and-requesting-checks-for-individual-commits
#

concurrency: # On new workflow, cancel old workflows from the same PR, branch or tag:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
reviewdog:
runs-on: ubuntu-24.04
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.REVIEWDOG_GITHUB_API_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.13

- name: Install uv and activate the environment
uses: astral-sh/setup-uv@v6
with:
activate-environment: true

- run: uv pip install pylint types-setuptools -r pyproject.toml --extra mypy

- uses: tsuyoshicho/action-mypy@v4
name: Run mypy with reviewdog to submit GitHub checks for warnings
if: ${{ github.actor != 'nektos/act' }}
with:
install_types: false
mypy_flags: --exclude python-libs-*/stubs/
reporter: github-pr-review
level: warning
github_token: ${{ secrets.REVIEWDOG_GITHUB_API_TOKEN }}

- uses: dciborow/[email protected]
name: Run pylint with reviewdog to submit GitHub checks for warnings
if: ${{ github.actor != 'nektos/act' }}
with:
reporter: github-pr-review
glob_pattern: "xcp tests"
github_token: ${{ secrets.REVIEWDOG_GITHUB_API_TOKEN }}
65 changes: 22 additions & 43 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# https://github.com/dexpota/cheatsheets/blob/master/pre-commit
exclude: "^tests/data"
fail_fast: true
default_stages: [commit]
default_stages: [pre-commit]
repos:
- repo: local
hooks:
Expand All @@ -47,7 +47,7 @@ repos:
types: [binary]
language: fail
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v6.0.0
hooks:
- id: no-commit-to-branch
args: [--branch, master]
Expand All @@ -62,76 +62,55 @@ repos:
- isort


- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0 # Use the ref you want to point at
hooks:
# Enforce that `# type: ignore` annotations always occur with specific codes.
# Sample annotation: # type: ignore[attr-defined,name-defined]
- id: python-check-blanket-type-ignore


- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
rev: v1.17.1
hooks:
- id: mypy
additional_dependencies:
- pyfakefs
- pytest_httpserver
- pytest-subprocess
- types-mock
- types-six
- types-toml


- repo: https://github.com/rcmdnk/pyproject-pre-commit
rev: v0.1.9
rev: v0.4.2
hooks:
- id: shellcheck


- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.42.0
rev: v0.45.0
hooks:
- id: markdownlint


- repo: https://github.com/pycqa/pylint
rev: v2.17.4
hooks:
- id: pylint
args:
[
-sn, # Don't display the score
--load-plugins=pylint.extensions.eq_without_hash,
--ignore-imports=yes,
"--disable=duplicate-code,line-too-long",
]
log_file: ".git/pre-commit-pylint.log"
additional_dependencies:
- pyfakefs
- six
- mock
- pandas
- pytest_forked
- toml
- repo: local
hooks:
- id: pytype
name: pytype (may take up to two minutes)
entry: sh -c "pytype >/dev/tty"
types: [python]
verbose: true
language: python
language_version: python3.8
require_serial: true
additional_dependencies: [pytype]
- id: pytest
name: Check pytest unit tests pass
- id: tox
name: pytest unit tests and static analysis using tox
types: [python]
# entry: sh -c "pytest -x -rf --new-first --show-capture=all >/dev/tty"
entry: sh -c "tox -e py38-covcombine >/dev/tty"
entry: sh -c "tox -e py311-cov-check-pytype-pyright-lint-mdreport >/dev/tty"
verbose: true
language: python
require_serial: true
pass_filenames: false
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0 # Use the ref you want to point at
hooks:
# Enforce that `# type: ignore` annotations always occur with specific codes.
# Sample annotations: # type: ignore[attr-defined] # type: ignore[attr-defined,name-defined]
- id: python-check-blanket-type-ignore
additional_dependencies: [tox]


- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand Down
Loading