diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 58fda07..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Build - -on: - push: - tags: - - 'v*' - branches: - - 'main' - - 'dev' - - 'feature/*' - -jobs: - build: - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ "ubuntu-22.04", "ubuntu-24.04", "macos-latest", "windows-latest" ] - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install uv - uses: astral-sh/setup-uv@v5 - with: - version: "0.5.26" - enable-cache: true - cache-dependency-glob: "uv.lock" - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Set PYTHONPATH - run: echo "PYTHONPATH=$(pwd)/jaddek_tillo_sdk" >> $GITHUB_ENV - - - - name: Install the project - run: uv sync --all-extras --dev - - - name: Run Ruff - run: uv run ruff check - - - name: Run Pytests - run: uv run pytest tests/ - - - name: Upload artifact - if: ${{ success() && matrix.python-version == '3.11' && matrix.os == 'ubuntu-22.04' }} - uses: actions/upload-artifact@v4 - with: - name: artifact - path: ./ - - -# set-release-tag: -# runs-on: ubuntu-latest -# needs: ["build"] -# steps: -# - name: Download artifact -# uses: actions/download-artifact@v4 -# with: -# name: artifact -# path: ./ -# - name: Bump version -# run: | -# ls -la -# pip install bump-my-version -# bump-my-version bump patch --dry-run -vv --allow-dirty diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml new file mode 100644 index 0000000..2a8748a --- /dev/null +++ b/.github/workflows/workflow.yml @@ -0,0 +1,127 @@ +name: Build + +on: + push: + tags: + - 'v*' + branches: + - 'main' + - 'dev' + - 'feature/*' + - 'hotfix/*' + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + version: "0.5.26" + enable-cache: true + cache-dependency-glob: "uv.lock" + + - name: Install the project + run: uv sync + + - name: Build the project + run: uv build + + - name: Upload built artifacts + uses: actions/upload-artifact@v4 + with: + name: package + path: dist/* + + tests: + runs-on: ${{ matrix.os }} + needs: build + strategy: + matrix: + os: [ "ubuntu-latest", "macos-latest", "windows-latest" ] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + version: "0.5.26" + enable-cache: true + cache-dependency-glob: "uv.lock" + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Set PYTHONPATH (Linux/macOS) + if: runner.os != 'Windows' + run: echo "PYTHONPATH=$PWD/src" >> $GITHUB_ENV + shell: bash + + - name: Set PYTHONPATH (Windows) + if: runner.os == 'Windows' + run: echo PYTHONPATH=%CD%\src >> %GITHUB_ENV% + shell: cmd + + - name: Install the project + run: uv sync --all-extras --dev + + - name: Run Ruff + run: uv run ruff check + + - name: Run Pytests + run: uv run pytest tests + + publish: + runs-on: ubuntu-latest + needs: [build, tests] + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-tags: true + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + + - name: Download built artifacts + uses: actions/download-artifact@v4 + with: + path: dist + + + - name: Get latest tag and update pyproject.toml + run: | + VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//') + echo "Using version: $VERSION" + sed -i "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml + + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + version: "0.5.26" + enable-cache: true + cache-dependency-glob: "uv.lock" + + - name: Upload to PyPI + env: + PYPI_USERNAME: ${{ secrets.PP_UN }} + PYPI_PASSWORD: ${{ secrets.PP_TK }} + UV_PUBLISH_TOKEN: ${{ secrets.PP_TK }} + run: | + uv build + uv publish + + - name: Clean up + run: | + rm -rf dist diff --git a/pyproject.toml b/pyproject.toml index f2a1087..b75e15a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,18 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + [project] name = "jaddek_tillo_sdk" version = "0.1.4" -description = "Tillo SDK" +description = "The package for developers to interact with the Tillo APIv2" authors = [ { name = "Anton Nazarov", email = "tonynazarov@gmail.com" } ] readme = "README.md" requires-python = ">=3.9" +license = "MIT" dependencies = [ "httpx[http2]>=0.28.1,<0.29.0", ] @@ -23,6 +28,7 @@ dev = [ [project.urls] Homepage = "https://github.com/jaddek/tillo-sdk-python" +Issues = "https://github.com/jaddek/tillo-sdk-python/issues" [tool.bumpversion] diff --git a/uv.lock b/uv.lock index 1913a83..5474c8c 100644 --- a/uv.lock +++ b/uv.lock @@ -172,7 +172,7 @@ wheels = [ [[package]] name = "jaddek-tillo-sdk" -version = "0.1.0" +version = "0.1.4" source = { virtual = "." } dependencies = [ { name = "httpx", extra = ["http2"] },