From 6b3911799f56f0c8d9ca56a8ba06ea255825ecd6 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Fri, 8 Dec 2023 19:58:44 +0000 Subject: [PATCH 1/2] dist: use PyPI trusted publisher releases --- .github/workflows/comment-bot.yml | 6 ++++-- .github/workflows/test.yml | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/comment-bot.yml b/.github/workflows/comment-bot.yml index 57844ec..6d491db 100644 --- a/.github/workflows/comment-bot.yml +++ b/.github/workflows/comment-bot.yml @@ -6,6 +6,10 @@ jobs: tag: # /tag if: startsWith(github.event.comment.body, '/tag ') runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write steps: - uses: actions/checkout@v4 - name: React Seen @@ -27,7 +31,6 @@ jobs: post({ owner: context.repo.owner, repo: context.repo.repo, comment_id: context.payload.comment.id, content: "eyes"}) - github-token: ${{ secrets.GH_TOKEN }} - name: Tag Commit run: | git clone https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} repo @@ -47,4 +50,3 @@ jobs: post({ owner: context.repo.owner, repo: context.repo.repo, comment_id: context.payload.comment.id, content: "rocket"}) - github-token: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8e35246..6c3f1c8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -113,6 +113,10 @@ jobs: deploy: needs: [check, test, cuda] name: PyPI Deploy + environment: pypi + permissions: + contents: write + id-token: write runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -126,8 +130,9 @@ jobs: uses: casperdcl/deploy-pypi@v2 with: build: -s - password: ${{ secrets.PYPI_TOKEN }} - upload: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }} + upload: false + - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') name: Release run: | From 32fb56a472300c9365fc87e6b952b627d3e4b0ef Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Fri, 8 Dec 2023 20:27:09 +0000 Subject: [PATCH 2/2] docs: update local in-place build instructions --- CONTRIBUTING.md | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 241702e..058c30d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,20 +4,30 @@ Install in "development/editable" mode including dev/test dependencies: ```sh git clone https://github.com/AMYPAD/CuVec && cd CuVec -export SETUPTOOLS_ENABLE_FEATURES=legacy-editable -pip install -e .[dev] + +# `pip install -e .[dev]` won't work due to https://github.com/scikit-build/scikit-build-core/issues/114 +# work-around: +# 1. install dependencies (one-off) +pip install toml +python -c 'import toml; c=toml.load("pyproject.toml") +print("\0".join(c["build-system"]["requires"] + c["project"]["dependencies"] + c["project"]["optional-dependencies"]["dev"]), end="")' \ +| xargs -0 pip install -U ninja cmake +# 2. delete build artefacts, (re)build & install in-place with debug info +git clean -Xdf +pip install --no-build-isolation --no-deps -t . -U -v . \ + -Ccmake.define.CUVEC_DEBUG=1 + -Ccmake.define.CMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-function-type" +git restore cuvec/src # undo deletion of sources ``` -Alternatively, if `cmake` and a generator (such as `make` or `ninja`) are -available, then `setup.py build` and `develop` can be explicitly called; -optionally with extra `cmake` and generator arguments: +Once installed in development/editable mode, tests may be run using: ```sh -python setup.py build develop easy_install cuvec[dev] -- -DCUVEC_DEBUG:BOOL=ON -- -j8 +pytest ``` -Once installed in development/editable mode, tests may be run using: +To run performance tests, build with debugging disabled (`CUVEC_DEBUG=0`), then run: ```sh -pytest +python tests/test_perf.py ```