Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ci/integration test on call #92

Merged
merged 5 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/actions/check_version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Check Version
description: "Check the version of the project and create a bump and changelog"
inputs:
github_token:
description: "The GitHub token to use for authentication"
required: true
default: ${{ github.token }}
push:
description: "Whether to push the changes to the repository"
required: false
default: "false"
pr_number:
description: "The pull request number"
required: false
default: ""
outputs:
name:
description: "The name of the project"
value: ${{ steps.project.outputs.name }}
old_version:
description: "The old version of the project"
value: ${{ steps.project.outputs.old_version }}
new_version:
description: "The new version of the project"
value: ${{ steps.cz.outputs.version }}
is_changed:
description: "Whether the version has changed"
value: ${{ steps.cz.outputs.version != steps.project.outputs.old_version }}
runs:
using: composite
steps:
- name: Check out
uses: actions/checkout@v4
with:
token: ${{ inputs.github_token }}
fetch-depth: 0
- name: Set Name and Version from pyproject.toml to output
id: project
shell: bash
run: |
name=$(grep "^name" pyproject.toml -m 1 | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3 | tr "-" "_")
version=$(grep "^version" pyproject.toml -m 1 | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3)
echo "name=$name" >> $GITHUB_OUTPUT
echo "old_version=$version" >> $GITHUB_OUTPUT
echo "Releasing $name version $version"
- name: Create bump and changelog
id: cz
uses: commitizen-tools/commitizen-action@master
with:
github_token: ${{ inputs.github_token }}
changelog_increment_filename: body.md
push: ${{ inputs.push }}
- name: Find Comment
if: ${{ inputs.pr_number != '' && steps.cz.outputs.version != steps.project.outputs.old_version }}
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ inputs.pr_number }}
comment-author: "github-actions[bot]"
- name: Create bump comment
if: ${{ inputs.pr_number != '' && steps.cz.outputs.version != steps.project.outputs.old_version }}
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ inputs.pr_number }}
body-file: body.md
edit-mode: replace
22 changes: 9 additions & 13 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,16 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: databricks/setup-cli@main
- uses: eifinger/setup-rye@v3
id: setup-rye
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "0.42.0"
- name: Pin python-version ${{ matrix.python-version }}
run: rye pin ${{ matrix.python-version }}
- name: Install dependencies
run: rye sync --no-lock
- name: Lint code
run: rye lint
- name: Run tests
run: |
source .venv/bin/activate
rye test -- -x
python-version: ${{ matrix.python-version }}
- name: Sync kedro-databricks
run: uv sync --dev
- name: Lint kedro-databricks
run: uv run ruff check
- name: Test kedro-databricks
run: uv run pytest tests
env:
DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }}
DATABRICKS_CLIENT_ID: ${{ secrets.DATABRICKS_CLIENT_ID }}
Expand Down
62 changes: 30 additions & 32 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,32 @@ jobs:
DATABRICKS_CLIENT_ID: ${{ secrets.DATABRICKS_CLIENT_ID }}
DATABRICKS_CLIENT_SECRET: ${{ secrets.DATABRICKS_CLIENT_SECRET }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
version:
name: Set Name and Version from pyproject.toml to output
runs-on: ubuntu-latest
environment:
name: pypi
needs:
- integration_tests
outputs:
name: ${{ steps.check_version.outputs.name }}
old_version: ${{ steps.check_version.outputs.old_version }}
new_version: ${{ steps.check_version.outputs.new_version }}
is_changed: ${{ steps.check_version.outputs.is_changed }}
steps:
- name: Check Version
uses: ./.github/actions/check_version
id: check_version
with:
github_token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
push: true
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
if: ${{ needs.version.outputs.is_changed }}
needs:
- integration_tests
- version
strategy:
matrix:
python-version: ["3.9"]
Expand All @@ -34,48 +55,25 @@ jobs:
with:
token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
fetch-depth: 0
- name: Create bump and changelog
id: cz
uses: commitizen-tools/commitizen-action@master
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
changelog_increment_filename: body.md
push: true
- uses: databricks/setup-cli@main
- uses: eifinger/setup-rye@v3
id: setup-rye
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "0.29.0"
enable-cache: true
cache-prefix: ${{ matrix.python-version }}
- name: Pin python-version ${{ matrix.python-version }}
if: steps.setup-rye.outputs.cache-hit != 'true'
run: rye pin ${{ matrix.python-version }}
- name: Install dependencies
if: steps.setup-rye.outputs.cache-hit != 'true'
run: |
rye sync --no-lock
python-version: ${{ matrix.python-version }}
- name: Sync kedro-databricks
run: uv sync
- name: Build package
run: rye build
- name: Set Name and Version from pyproject.toml to output
id: project
run: |
name=$(grep "^name" pyproject.toml -m 1 | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3 | tr "-" "_")
version=$(grep "^version" pyproject.toml -m 1 | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3)
echo "NAME=$name" >> $GITHUB_OUTPUT
echo "VERSION=$version" >> $GITHUB_OUTPUT
echo "Releasing $name version $version"
ls -laR dist
run: uv build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Upload release to GitHub
uses: softprops/action-gh-release@v1
env:
PACKAGE_NAME: ${{ steps.project.outputs.NAME }}
VERSION: ${{ steps.project.outputs.VERSION }}
PACKAGE_NAME: ${{ needs.version.outputs.name }}
VERSION: ${{ needs.version.outputs.new_version }}
with:
tag_name: ${{ steps.cz.outputs.version }}
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
tag_name: ${{ env.VERSION }}
body_path: "body.md"
files: |
dist/${{ env.PACKAGE_NAME }}-${{ env.VERSION }}-py3-none-any.whl
Expand Down
31 changes: 0 additions & 31 deletions .github/workflows/test.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Unit tests
on:
pull_request: {}
permissions:
checks: write
pull-requests: write
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
kedro_version: ["0.19.7", "0.19.8"]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: ${{ matrix.python-version }}
- name: Sync kedro-databricks
run: |
uv sync --dev
uv add "kedro==${{ matrix.kedro_version }}"
- name: Lint kedro-databricks
run: uv run ruff check
- name: Test kedro-databricks
run: uv run pytest tests/unit
- name: Coverage comment
uses: MishaKav/pytest-coverage-comment@main
with:
github-token: ${{ github.token }}
title: "Unit Test Coverage Report"
pytest-xml-coverage-path: "coverage.xml"
version:
name: Check for changes and post bump comment
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Check Version
uses: ./.github/actions/check_version
with:
github_token: ${{ github.token }}
push: false
pr_number: ${{ github.event.pull_request.number }}
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
just 1.25.2
pre-commit 3.7.0
uv 0.5.13
23 changes: 11 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@ name = "kedro-databricks"
version = "0.6.7"
description = "A plugin to run Kedro pipelines on Databricks."
authors = [{ name = "Jens Peder Meldgaard", email = "[email protected]" }]
readme = "README.md"
requires-python = ">= 3.9"

dependencies = [
"kedro>=0.19.8",
"mergedeep>=1.3.4",
"tomlkit>=0.13.0",
"databricks-sdk>=0.36.0",
]
readme = "README.md"
requires-python = ">= 3.9"
[dependency-groups]
dev = [
"pytest>=8.3.3",
"pytest-cov>=6.0.0",
"pre-commit>=4.0.1",
"ruff>=0.7.2",
"commitizen>=3.30.0",
]

[project.urls]
Homepage = "https://github.com/jenspederm/kedro-databricks"
Expand All @@ -23,16 +32,6 @@ databricks = "kedro_databricks.plugin:commands"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.rye]
managed = true
dev-dependencies = [
"pytest>=8.3.3",
"pytest-cov>=6.0.0",
"pre-commit>=4.0.1",
"ruff>=0.7.2",
"commitizen>=3.30.0",
]

[tool.hatch.metadata]
allow-direct-references = true

Expand Down
Loading
Loading