Skip to content

Commit 8cf7ab2

Browse files
authored
Update feature/perf from master (#6000)
There is a conflict in 'dune' files, have to make PR from fork to fix, and I cannot edit the origin repo on the other PR.
2 parents dbe5b79 + 75085cb commit 8cf7ab2

File tree

391 files changed

+10239
-11839
lines changed

Some content is hidden

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

391 files changed

+10239
-11839
lines changed

.github/workflows/format.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- master
77
- 'feature/**'
88
- '*-lcm'
9+
merge_group:
910

1011
jobs:
1112
ocaml-format:

.github/workflows/generate-and-build-sdks.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ jobs:
5555
_build/install/default/xapi/sdk/go/*
5656
!_build/install/default/xapi/sdk/go/dune
5757
58+
- name: Store Java SDK source
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: SDK_Source_Java
62+
path: _build/install/default/xapi/sdk/java/*
63+
5864
- name: Trim dune cache
5965
run: opam exec -- dune cache trim --size=2GiB
6066

@@ -84,6 +90,39 @@ jobs:
8490
source/*
8591
!source/src/*.o
8692
93+
build-java-sdk:
94+
name: Build Java SDK
95+
runs-on: ubuntu-latest
96+
needs: generate-sdk-sources
97+
steps:
98+
- name: Install dependencies
99+
run: sudo apt-get install maven
100+
101+
- name: Retrieve Java SDK source
102+
uses: actions/download-artifact@v4
103+
with:
104+
name: SDK_Source_Java
105+
path: source/
106+
107+
- name: Set up JDK 17
108+
uses: actions/setup-java@v4
109+
with:
110+
java-version: '17'
111+
distribution: 'temurin'
112+
113+
- name: Build Java SDK
114+
shell: bash
115+
run: |
116+
xapi_version="${{ inputs.xapi_version }}"
117+
xapi_version="${xapi_version//v/}"
118+
mkdir -p target && mvn -f source/xen-api/pom.xml -B -Drevision=$xapi_version-prerelease clean package && mv source/xen-api/target/*.jar target/
119+
120+
- name: Store Java SDK
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: SDK_Artifacts_Java
124+
path: target/*
125+
87126
build-csharp-sdk:
88127
name: Build C# SDK
89128
runs-on: windows-2022

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ on:
66
schedule:
77
# run daily, this refreshes the cache
88
- cron: "13 2 * * *"
9+
merge_group:
910

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

1415
jobs:
@@ -45,7 +46,6 @@ jobs:
4546
- name: Make install smoketest
4647
run: |
4748
opam exec -- make install DESTDIR=$(mktemp -d)
48-
opam exec -- make install DESTDIR=$(mktemp -d) BUILD_PY2=NO
4949
5050
- name: Check disk space
5151
run: df -h || true

.github/workflows/other.yml

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ on:
66
schedule:
77
# run daily, this refreshes the cache
88
- cron: "13 2 * * *"
9+
merge_group:
910

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

1415
jobs:
@@ -18,7 +19,7 @@ jobs:
1819
strategy:
1920
fail-fast: false
2021
matrix:
21-
python-version: ["2.7", "3.11"]
22+
python-version: ["3.11"]
2223
steps:
2324
- name: Checkout code
2425
uses: actions/checkout@v4
@@ -39,48 +40,11 @@ jobs:
3940

4041
- uses: pre-commit/[email protected]
4142
name: Run pre-commit checks (no spaces at end of lines, etc)
42-
if: ${{ matrix.python-version != '2.7' }}
4343
with:
4444
extra_args: --all-files --verbose --hook-stage commit
4545
env:
4646
SKIP: no-commit-to-branch
4747

48-
- name: Install dependencies only needed for python 2
49-
if: ${{ matrix.python-version == '2.7' }}
50-
run: pip install enum
51-
52-
- name: Install dependencies only needed for python 3
53-
if: ${{ matrix.python-version != '2.7' }}
54-
run: pip install opentelemetry-api opentelemetry-exporter-zipkin-json opentelemetry-sdk pandas pytype toml wrapt
55-
56-
- name: Install common dependencies for Python ${{matrix.python-version}}
57-
run: pip install future mock pytest-coverage pytest-mock
58-
59-
- name: Run Pytest for python 2 and get code coverage
60-
if: ${{ matrix.python-version == '2.7' }}
61-
run: >
62-
pytest
63-
--cov=scripts --cov=ocaml/xcp-rrdd
64-
scripts/ ocaml/xcp-rrdd -vv -rA
65-
--junitxml=.git/pytest${{matrix.python-version}}.xml
66-
--cov-report term-missing
67-
--cov-report xml:.git/coverage${{matrix.python-version}}.xml
68-
env:
69-
PYTHONDEVMODE: yes
70-
71-
- name: Run Pytest for python 3 and get code coverage
72-
if: ${{ matrix.python-version != '2.7' }}
73-
run: >
74-
pytest
75-
--cov=scripts --cov=ocaml/xcp-rrdd --cov=python3/
76-
scripts/ ocaml/xcp-rrdd python3/ -vv -rA
77-
--junitxml=.git/pytest${{matrix.python-version}}.xml
78-
--cov-report term-missing
79-
--cov-report xml:.git/coverage${{matrix.python-version}}.xml
80-
env:
81-
PYTHONDEVMODE: yes
82-
PYTHONPATH: "python3:python3/tests/stubs"
83-
8448
- name: Upload coverage report to Coveralls
8549
uses: coverallsapp/github-action@v2
8650
with:
@@ -90,7 +54,6 @@ jobs:
9054
parallel: true
9155

9256
- uses: dciborow/[email protected]
93-
if: ${{ matrix.python-version != '2.7' }}
9457
with:
9558
reporter: github-pr-review
9659
level: warning
@@ -99,8 +62,7 @@ jobs:
9962
continue-on-error: true
10063

10164
- name: Run pytype checks
102-
if: ${{ matrix.python-version != '2.7' }}
103-
run: ./pytype_reporter.py
65+
run: pip install pandas pytype toml && ./pytype_reporter.py
10466
env:
10567
PR_NUMBER: ${{ github.event.number }}
10668
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
uses: actions/upload-artifact@v4
3434
with:
3535
name: XenAPI
36-
path: scripts/examples/python/dist/
36+
path: python3/examples/dist/
3737

3838
build-sdks:
3939
name: Build and upload SDK artifacts
@@ -64,6 +64,12 @@ jobs:
6464
name: SDK_Artifacts_C
6565
path: libxenserver/usr/local/
6666

67+
- name: Retrieve Java SDK distribution artifacts
68+
uses: actions/download-artifact@v4
69+
with:
70+
name: SDK_Artifacts_Java
71+
path: dist/
72+
6773
- name: Retrieve C# SDK distribution artifacts
6874
uses: actions/download-artifact@v4
6975
with:

.github/workflows/setup-xapi-environment/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ runs:
2828
shell: bash
2929
run: sudo apt-get update
3030

31-
- name: Install python2
31+
- name: Install python3
3232
shell: bash
33-
run: sudo apt-get install python2
33+
run: sudo apt-get install python3
3434

3535
- name: Use disk with more space for TMPDIR and XDG_CACHE_HOME
3636
shell: bash

.github/workflows/shellcheck.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ name: ShellCheck
22

33
on:
44
pull_request:
5+
merge_group:
56

67
concurrency: # On new push, cancel old workflows from the same PR, branch or tag:
7-
group: sc-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
8+
group: sc-${{ github.workflow }}-${{github.event_name}}-${{ github.event.pull_request.number || github.ref }}
89
cancel-in-progress: true
910

1011
jobs:

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ config.mk
1616
# python packaging
1717
**/__pycache__/
1818
**/*.pyc
19-
scripts/examples/python/setup.py
20-
scripts/examples/python/XenAPI.egg-info/
21-
scripts/examples/python/build/
22-
scripts/examples/python/dist/
19+
python3/examples/setup.py
20+
python3/examples/XenAPI.egg-info/
21+
python3/examples/build/
22+
python3/examples/dist/
2323

2424
# ignore file needed for building the SDK
2525
ocaml/sdk-gen/csharp/XE_SR_ERRORCODES.xml

.ocamlformat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ break-separators=before
77
break-infix=fit-or-vertical
88
break-infix-before-func=false
99
sequence-blank-line=preserve-one
10+
ocaml-version=4.14

.pre-commit-config.yaml

Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
# pre-commit run -av --hook-stage pre-push
1515
#
1616
default_stages: [commit, push]
17+
default_language_version:
18+
python: python3.11
1719
repos:
1820
# Recommendation for a minimal git pre-commit hook:
1921
# https://github.com/pre-commit/pre-commit-hooks/blob/main/README.md:
@@ -29,6 +31,95 @@ repos:
2931
- id: check-executables-have-shebangs
3032
exclude: ocaml
3133

34+
35+
# Improve Python formatting incrementally:
36+
# https://dev.to/akaihola/improving-python-code-incrementally-3f7a
37+
#
38+
# darker checks if staged python changes are formatted according using
39+
# the PEP8-aligned black formatter. It also checks if the imports are sorted.
40+
#
41+
# It is a good idea to run this before committing, and it is also run in the
42+
# GitHub Workflow.
43+
#
44+
# Note: darker only checks the changes in files ending in .py!
45+
# Python scripts that don't end in .py should be renamed to have the .py extension
46+
# when moving them to python3/bin.
47+
# (remove the .py extension in the Makefile when installing the file)
48+
#
49+
- repo: https://github.com/akaihola/darker
50+
rev: 1.7.3
51+
hooks:
52+
- id: darker
53+
files: python3/
54+
name: check changes in Python3 tree using darker and isort
55+
args: [--diff, --skip-string-normalization, --isort, -tpy36]
56+
additional_dependencies: [isort]
57+
58+
#
59+
# Run pytest and diff-cover to check that the new /python3 test suite in passes.
60+
# This hook uses a local venv containing the required dependencies. When adding
61+
# new dependencies, they should be added to the additional_dependencies below.
62+
#
63+
- repo: local
64+
hooks:
65+
- id: pytest
66+
files: python3/
67+
name: check that the Python3 test suite in passes
68+
entry: env PYTHONDEVMODE=yes sh -c 'coverage run && coverage xml &&
69+
coverage html && coverage report &&
70+
diff-cover --ignore-whitespace --compare-branch=origin/master
71+
--show-uncovered --html-report .git/coverage-diff.html
72+
--fail-under 50 .git/coverage3.11.xml'
73+
require_serial: true
74+
pass_filenames: false
75+
language: python
76+
types: [python]
77+
additional_dependencies:
78+
- coverage
79+
- diff-cover
80+
- future
81+
- opentelemetry-api
82+
- opentelemetry-exporter-zipkin-json
83+
- opentelemetry-sdk
84+
- pytest-mock
85+
- mock
86+
- wrapt
87+
- XenAPI
88+
89+
90+
- repo: https://github.com/RobertCraigie/pyright-python
91+
rev: v1.1.372
92+
hooks:
93+
- id: pyright
94+
name: check that python3 tree passes pyright/VSCode check
95+
files: python3/
96+
additional_dependencies:
97+
- mock
98+
- opentelemetry-api
99+
- opentelemetry-exporter-zipkin-json
100+
- opentelemetry-sdk
101+
- pytest
102+
- pyudev
103+
- XenAPI
104+
105+
106+
# Check that pylint passes for the changes in new /python3 code.
107+
- repo: local
108+
hooks:
109+
- id: pylint
110+
files: python3/
111+
stages: [push]
112+
name: check that changes to python3 tree pass pylint
113+
entry: diff-quality --violations=pylint
114+
--ignore-whitespace --compare-branch=origin/master
115+
pass_filenames: false
116+
language: python
117+
types: [python]
118+
additional_dependencies: [diff-cover, pylint, pytest]
119+
120+
121+
# pre-push hook (it only runs if you install pre-commit as a pre-push hook):
122+
# It can be manually tested using: `pre-commit run -av --hook-stage push`
32123
# Recommendation for a minimal git pre-push hook:
33124
# While using pre-commit yields great results, it
34125
# is "not fast". Therefore only run it pre-push,
@@ -53,4 +144,12 @@ repos:
53144
# developers have such version installed, it can be configured here:
54145
# language_version: python3.11
55146
require_serial: true
56-
additional_dependencies: [pandas, pytype]
147+
additional_dependencies:
148+
- future
149+
- opentelemetry-api
150+
- opentelemetry-exporter-zipkin-json
151+
- opentelemetry-sdk
152+
- pandas
153+
- pytest
154+
- pytype
155+
files: python3/

0 commit comments

Comments
 (0)