From f11608568e2156aeeaf6a24d37a7117b0ace1a12 Mon Sep 17 00:00:00 2001 From: Adrian Rumpold Date: Fri, 2 Aug 2024 15:30:21 +0200 Subject: [PATCH] fix(ci): Add `build` dependency, upload package artifacts as build assets --- .github/workflows/release.yaml | 23 +++++++++++++++- pyproject.toml | 50 +++++++++++++++++----------------- requirements-dev.txt | 7 ++++- 3 files changed, 53 insertions(+), 27 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ac4e737f..5493497a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -4,7 +4,7 @@ on: workflow_dispatch: release: types: - - released + - published permissions: contents: write @@ -22,13 +22,34 @@ jobs: pythonVersion: "3.11" # Package build - name: Build and check + id: build run: | python -m build + echo "package_wheel=$(basename dist/*.whl)" >> $GITHUB_OUTPUT + echo "package_sdist=$(basename dist/*.gz)" >> $GITHUB_OUTPUT - name: Upload build artifacts uses: actions/upload-artifact@v4 with: name: dist path: dist + - name: Add wheel as release asset + uses: actions/upload-release-asset@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: dist/${{ steps.build.outputs.package_wheel }} + asset_name: ${{ steps.build.outputs.package_wheel }} + asset_content_type: application/zip + - name: Add sdist as release asset + uses: actions/upload-release-asset@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: dist/${{ steps.build.outputs.package_sdist }} + asset_name: ${{ steps.build.outputs.package_sdist }} + asset_content_type: application/zip # Docs - name: Build release documentation run: mkdocs build diff --git a/pyproject.toml b/pyproject.toml index 2dbab65b..ee55fac4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,18 +9,18 @@ version = "0.1.0" readme = "README.md" requires-python = ">=3.10" dependencies = [ - "docker", - "kubernetes", - "ray[train,default]==2.34.0", - "tensorflow", + "docker", + "kubernetes", + "ray[train,default]==2.34.0", + "tensorflow", ] authors = [ - { name = "appliedAI Institute for Europe", email = "opensource@appliedai-institute.de" }, + { name = "appliedAI Institute for Europe", email = "opensource@appliedai-institute.de" }, ] maintainers = [ - { name = "Nicholas Junge", email = "n.junge@appliedai-institute.de" }, - { name = "Max Mynter", email = "m.mynter@appliedai-institute.de" }, - { name = "Adrian Rumpold", email = "a.rumpold@appliedai-institute.de" }, + { name = "Nicholas Junge", email = "n.junge@appliedai-institute.de" }, + { name = "Max Mynter", email = "m.mynter@appliedai-institute.de" }, + { name = "Adrian Rumpold", email = "a.rumpold@appliedai-institute.de" }, ] [project.scripts] @@ -28,20 +28,20 @@ jobs_execute = "jobs.execute:execute" jobby = "jobs.cli:main" [project.optional-dependencies] -dev = ["ruff", "pytest", "pre-commit"] +dev = ["build", "ruff", "pytest", "pre-commit"] docs = [ - "mkdocs", - "mkdocs-callouts", - "mkdocs-gen-files", - "mkdocs-literate-nav", - "mkdocs-section-index", - "mkdocs-material", - "mkdocstrings[python]", - "mkdocs-include-dir-to-nav", - "black", # formatting of signatures in docs - "mike", - "appnope", # required only on Darwin, but need to include in lockfile - "docstring-parser", + "mkdocs", + "mkdocs-callouts", + "mkdocs-gen-files", + "mkdocs-literate-nav", + "mkdocs-section-index", + "mkdocs-material", + "mkdocstrings[python]", + "mkdocs-include-dir-to-nav", + "black", # formatting of signatures in docs + "mike", + "appnope", # required only on Darwin, but need to include in lockfile + "docstring-parser", ] [tool.setuptools.package-data] @@ -57,10 +57,10 @@ src = ["src"] [tool.ruff.lint] select = ["E", "F", "I", "W"] ignore = [ - # Line too long - "E501", - # Allow capitalized variable names - "F841", + # Line too long + "E501", + # Allow capitalized variable names + "F841", ] [tool.mypy] diff --git a/requirements-dev.txt b/requirements-dev.txt index d0c510de..e5dc94f0 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -30,6 +30,8 @@ babel==2.15.0 # via mkdocs-material black==24.4.2 # via job-queue (pyproject.toml) +build==1.2.1 + # via job-queue (pyproject.toml) cachetools==5.3.3 # via google-auth certifi==2024.7.4 @@ -237,6 +239,7 @@ optree==0.12.1 packaging==24.1 # via # black + # build # keras # mkdocs # pytest @@ -298,6 +301,8 @@ pymdown-extensions==10.9 # mkdocstrings pyparsing==3.1.2 # via mike +pyproject-hooks==1.1.0 + # via build pytest==8.2.2 # via job-queue (pyproject.toml) python-dateutil==2.9.0.post0 @@ -353,7 +358,7 @@ rsa==4.9 # via google-auth ruff==0.5.1 # via job-queue (pyproject.toml) -setuptools==70.3.0 +setuptools==72.1.0 # via # tensorboard # tensorflow