diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index 42ed76565c2..45abab99bbb 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -15,56 +15,27 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Pull configuration from xs-opam - run: | - curl --fail --silent https://raw.githubusercontent.com/xapi-project/xs-opam/master/tools/xs-opam-ci.env | cut -f2 -d " " > .env - - - name: Load environment file - id: dotenv - uses: falti/dotenv-action@v1.0.2 - - - name: Use python + - name: Use python uses: actions/setup-python@v4 with: python-version: '3.x' - - name: Retrieve date for cache key - id: cache-key - run: echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")" - shell: bash - - - name: Restore opam cache - id: opam-cache - uses: actions/cache@v3 - with: - path: "~/.opam" - # invalidate cache daily, gets built daily using a scheduled job - key: ${{ steps.cache-key.outputs.date }} - - - name: Use ocaml - uses: ocaml/setup-ocaml@v1 - with: - ocaml-version: ${{ steps.dotenv.outputs.ocaml_version_full }} - opam-repository: ${{ steps.dotenv.outputs.repository }} - - - name: Install dependencies + - name: Install build dependencies run: | - opam update - opam pin add xapi-datamodel . --no-action - opam upgrade - opam install xapi-stdext-unix xapi-datamodel + pip install build + sudo apt-get install ocaml dune libfindlib-ocaml-dev libdune-ocaml-dev libcmdliner-ocaml-dev - name: Generate python package for XenAPI run: | - opam exec -- ./configure - opam exec -- make python + ./configure --xapi-version=${{ github.ref_name }} + make python - name: Draft Release ${{ github.ref_name }} - id: create_release - uses: softprops/action-gh-release@v1 - with: - files: | - scripts/examples/python/dist/* - fail_on_unmatched_files: true - draft: true - generate_release_notes: true + run: gh release create ${{ github.ref_name }} --draft --generate-notes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload artifacts + run: gh release upload ${{ github.ref_name }} scripts/examples/python/dist/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/quality-gate.sh b/quality-gate.sh index 559a0884cc3..c42d718cbf8 100755 --- a/quality-gate.sh +++ b/quality-gate.sh @@ -25,7 +25,7 @@ verify-cert () { } mli-files () { - N=510 + N=509 # do not count ml files from the tests in ocaml/{tests/perftest/quicktest} MLIS=$(git ls-files -- '**/*.mli' | grep -vE "ocaml/tests|ocaml/perftest|ocaml/quicktest" | xargs -I {} sh -c "echo {} | cut -f 1 -d '.'" \;) MLS=$(git ls-files -- '**/*.ml' | grep -vE "ocaml/tests|ocaml/perftest|ocaml/quicktest" | xargs -I {} sh -c "echo {} | cut -f 1 -d '.'" \;) diff --git a/scripts/examples/python/Makefile b/scripts/examples/python/Makefile index 03d8d70cb6f..251f747250d 100644 --- a/scripts/examples/python/Makefile +++ b/scripts/examples/python/Makefile @@ -1,15 +1,12 @@ PROFILE=release +SETUPTOOLS_SCM_PRETEND_VERSION ?= "" .PHONY: build clean -build: setup.py - pip wheel -w dist --no-deps . - python setup.py sdist - -setup.py: - dune build --profile=$(PROFILE) ./setuppy_gen.exe - dune exec --profile=$(PROFILE) -- ./setuppy_gen.exe +build: + SETUPTOOLS_SCM_PRETEND_VERSION=$(XAPI_VERSION) python -m build --wheel . + SETUPTOOLS_SCM_PRETEND_VERSION=$(XAPI_VERSION) python -m build --sdist . clean: dune clean - rm -rf setup.py dist/ build/ XenAPI.egg-info/ + rm -rf dist/ build/ XenAPI.egg-info/ diff --git a/scripts/examples/python/dune b/scripts/examples/python/dune deleted file mode 100644 index d764aa66a66..00000000000 --- a/scripts/examples/python/dune +++ /dev/null @@ -1,10 +0,0 @@ -(executable - (modes byte exe) - (name setuppy_gen) - (libraries - dune-build-info - xapi-stdext-unix - xapi-datamodel - ) -) - diff --git a/scripts/examples/python/pyproject.toml b/scripts/examples/python/pyproject.toml index 4e50ea74011..f556f2539ab 100644 --- a/scripts/examples/python/pyproject.toml +++ b/scripts/examples/python/pyproject.toml @@ -1,3 +1,6 @@ [build-system] -requires = ["setuptools >= 38.6.0", "wheel"] -build-backend = "setuptools.build_meta:__legacy__" +requires = ["setuptools >= 38.6.0", "setuptools_scm[toml]", "wheel"] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +root = "../../.." diff --git a/scripts/examples/python/setuppy_gen.ml b/scripts/examples/python/setuppy_gen.ml deleted file mode 100644 index aa73befb3ac..00000000000 --- a/scripts/examples/python/setuppy_gen.ml +++ /dev/null @@ -1,7 +0,0 @@ -let filename = Filename.concat "." "setup.py" - -let setuppy = - Printf.sprintf "from setuptools import setup\n\nsetup(version='%s')\n" - Datamodel_common.api_version_string - -let () = Xapi_stdext_unix.Unixext.write_string_to_file filename setuppy