Skip to content

Update credentials for databricks #86

Update credentials for databricks

Update credentials for databricks #86

Workflow file for this run

# .github/workflows/ci-cd.yml
on:
push:
branches:
- main
- master
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
# Download the Databricks CLI.
# See https://github.com/databricks/setup-cli
- uses: databricks/setup-cli@main
- uses: eifinger/setup-rye@v3
id: setup-rye
with:
version: "0.29.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
env:
DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }}
DATABRICKS_CLIENT_ID: ${{ secrets.DATABRICKS_CLIENT_ID }}
DATABRICKS_CLIENT_SECRET: ${{ secrets.DATABRICKS_CLIENT_SECRET }}
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
check_version:
name: Check if version changed
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.check-version.outputs.changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if version changed
id: check-version
run: |
_diff=$(echo $(git diff ${{ github.event.before }} ${{ github.event.after }}))
if [[ $_diff == *"+version"* ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "Version changed"
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "Version did not change"
fi
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
needs:
- test
- check_version
if: ${{ needs.check_version.outputs.changed == 'true' }}
strategy:
matrix:
python-version: ["3.12.2"]
environment:
name: pypi
url: https://pypi.org/p/kedro-databricks
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v4
# Download the Databricks CLI.
# See https://github.com/databricks/setup-cli
- uses: databricks/setup-cli@main
- uses: eifinger/setup-rye@v3
id: setup-rye
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
- name: Build package
run: rye build
- name: list
run: ls -la
# retrieve your distributions here
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1