Skip to content

Commit

Permalink
update to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed Dec 7, 2024
1 parent 0ccce2f commit 7b92cc5
Show file tree
Hide file tree
Showing 16 changed files with 157 additions and 368 deletions.
33 changes: 0 additions & 33 deletions .bumpversion.cfg

This file was deleted.

52 changes: 6 additions & 46 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,8 @@ jobs:
with:
python-version: '3.9'

- name: Install python dependencies
run: |
sudo apt-get update
sudo apt-get install libsasl2-dev
python -m pip install --user --upgrade pip
python -m pip --version
python -m pip install pre-commit
pre-commit --version
python -m pip install -r requirements.txt
python -m pip install -r dev-requirements.txt
python -c "import dbt.adapters.spark"
- name: Run pre-commit hooks
run: pre-commit run --all-files --show-diff-on-failure
uses: pre-commit/[email protected]

unit:
name: unit test / python ${{ matrix.python-version }}
Expand All @@ -87,29 +75,9 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install python dependencies
run: |
sudo apt-get update
sudo apt-get install libsasl2-dev
python -m pip install --user --upgrade pip
python -m pip --version
python -m pip install -r requirements.txt
python -m pip install -r dev-requirements.txt
python -m pip install -e .
- name: Run unit tests
run: python -m pytest --color=yes --csv unit_results.csv -v tests/unit
uses: pypa/hatch@install

- name: Get current date
if: always()
id: date
run: echo "date=$(date +'%Y-%m-%dT%H_%M_%S')" >> $GITHUB_OUTPUT #no colons allowed for artifacts

- uses: actions/upload-artifact@v4
if: always()
with:
name: unit_results_${{ matrix.python-version }}-${{ steps.date.outputs.date }}.csv
path: unit_results.csv
overwrite: true
- run: hatch run unit-tests

build:
name: build packages
Expand All @@ -128,24 +96,16 @@ jobs:
with:
python-version: '3.9'

- name: Install python dependencies
run: |
python -m pip install --user --upgrade pip
python -m pip install --upgrade setuptools wheel twine check-wheel-contents
python -m pip --version
- uses: pypa/hatch@install

- name: Build distributions
run: ./scripts/build-dist.sh
run: hatch build

- name: Show distributions
run: ls -lh dist/

- name: Check distribution descriptions
run: |
twine check dist/*
- name: Check wheel contents
run: |
check-wheel-contents dist/*.whl --ignore W007,W008
run: hatch run build:check-all

- name: Check if this is an alpha version
id: check-is-alpha
Expand Down
26 changes: 4 additions & 22 deletions .github/workflows/release-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,9 @@ jobs:
python-version: "${{ env.PYTHON_TARGET_VERSION }}"

- name: Install python dependencies
run: |
sudo apt-get update
sudo apt-get install libsasl2-dev
python -m pip install --user --upgrade pip
python -m pip --version
python -m pip install -r requirements.txt
python -m pip install -r dev-requirements.txt
python -m pip install -e .
uses: pypa/hatch@install

- name: Run unit tests
run: python -m pytest --color=yes --csv unit_results.csv -v tests/unit
- run: hatch run unit-tests

run-integration-tests:
name: "${{ matrix.test }}"
Expand Down Expand Up @@ -102,21 +94,11 @@ jobs:

steps:
- name: Check out the repository
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v4
with:
persist-credentials: false

# explicitly checkout the branch for the PR,
# this is necessary for the `pull_request` event
- name: Check out the repository (PR)
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
persist-credentials: false
ref: ${{ github.event.pull_request.head.ref }}

# the python version used here is not what is used in the tests themselves
# the python version used here is not what is used in the tests themselves
- name: Set up Python for dagger
uses: actions/setup-python@v5
with:
Expand All @@ -140,6 +122,6 @@ jobs:
package_test_command: "${{ inputs.package_test_command }}"
dbms_name: "spark"
ref: "${{ inputs.ref }}"
skip_tests: "${{ inputs.skip_tests }}"
skip_tests: "true"

secrets: "inherit"
78 changes: 22 additions & 56 deletions .github/workflows/release-prep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ jobs:
run: |
if [[ ${{ steps.set_existence.outputs.exists }} != true ]]
then
title="Spark version-bump.yml check"
message="dbt-spark needs version-bump.yml run before running the release. The changelog is not up to date."
title="Spark version bump check"
message="dbt-spark needs a version bump before running the release. The changelog is not up to date."
echo "::error title=${{ env.NOTIFICATION_PREFIX }}: $title::$message"
exit 1
fi
Expand All @@ -186,28 +186,32 @@ jobs:
runs-on: ubuntu-latest

outputs:
up_to_date: ${{ steps.version-check.outputs.up_to_date }}
up_to_date: ${{ steps.version.outputs.is-current }}

steps:
- name: "Checkout ${{ github.repository }} Commit ${{ inputs.sha }}"
uses: actions/checkout@v4
with:
ref: ${{ inputs.sha }}

- uses: pypa/hatch@install

- name: "Check Current Version In Code"
id: version-check
id: version
run: |
is_updated=false
if grep -Fxq "current_version = ${{ inputs.version_number }}" .bumpversion.cfg
is_current=false
current_version=$(hatch version)
if test "$current_version" = "${{ inputs.version }}"
then
is_updated=true
is_current=true
fi
echo "up_to_date=$is_updated" >> $GITHUB_OUTPUT
echo "is-current=$is_current" >> $GITHUB_OUTPUT
- name: "[Notification] Check Current Version In Code"
run: |
title="Version check"
if [[ ${{ steps.version-check.outputs.up_to_date }} == true ]]
if [[ ${{ steps.version.outputs.is-current }} == true ]]
then
message="The version in the codebase is equal to the provided version"
else
Expand All @@ -218,7 +222,7 @@ jobs:
- name: "Spark safety check"
if: ${{ contains(github.repository, 'dbt-labs/dbt-spark') }}
run: |
if [[ ${{ steps.version-check.outputs.up_to_date }} != true ]]
if [[ ${{ steps.version.outputs.is-current }} != true ]]
then
title="Spark version-bump.yml check"
message="dbt-spark needs version-bump.yml run before running the release. The version bump is not up to date."
Expand All @@ -228,7 +232,7 @@ jobs:
- name: "[DEBUG] Print Outputs"
run: |
echo up_to_date: ${{ steps.version-check.outputs.up_to_date }}
echo up_to_date: ${{ steps.version.outputs.is-current }}
skip-generate-changelog:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -383,26 +387,10 @@ jobs:
with:
python-version: ${{ env.PYTHON_TARGET_VERSION }}

- name: "Install Python Dependencies"
if: needs.audit-version-in-code.outputs.up_to_date == 'false'
run: |
python3 -m venv env
source env/bin/activate
python -m pip install --upgrade pip
- uses: pypa/hatch@install

- name: "Bump Version To ${{ inputs.version_number }}"
if: needs.audit-version-in-code.outputs.up_to_date == 'false'
# note: bumpversion is no longer supported, it actually points to bump2version now
run: |
source env/bin/activate
if [ -f "editable-requirements.txt" ]
then
python -m pip install -r dev-requirements.txt -r editable-requirements.txt
else
python -m pip install -r dev-requirements.txt
fi
env/bin/bumpversion --allow-dirty --new-version ${{ inputs.version_number }} major
git status
run: hatch version ${{ inputs.version_number }}

- name: "[Notification] Bump Version To ${{ inputs.version_number }}"
if: needs.audit-version-in-code.outputs.up_to_date == 'false'
Expand All @@ -415,14 +403,14 @@ jobs:
- name: "Remove Trailing Whitespace Via Pre-commit"
continue-on-error: true
run: |
pre-commit run trailing-whitespace --files .bumpversion.cfg CHANGELOG.md .changes/*
pre-commit run trailing-whitespace --files CHANGELOG.md .changes/*
git status
# this step will fail on newline errors but also correct them
- name: "Removing Extra Newlines Via Pre-commit"
continue-on-error: true
run: |
pre-commit run end-of-file-fixer --files .bumpversion.cfg CHANGELOG.md .changes/*
pre-commit run end-of-file-fixer --files CHANGELOG.md .changes/*
git status
- name: "Commit & Push Changes"
Expand Down Expand Up @@ -459,18 +447,10 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install python dependencies
run: |
sudo apt-get update
sudo apt-get install libsasl2-dev
python -m pip install --user --upgrade pip
python -m pip --version
python -m pip install -r requirements.txt
python -m pip install -r dev-requirements.txt
python -m pip install -e .
- uses: pypa/hatch@install

- name: Run unit tests
run: python -m pytest --color=yes --csv unit_results.csv -v tests/unit
run: hatch run unit-tests

run-integration-tests:
name: ${{ matrix.test }}
Expand Down Expand Up @@ -505,34 +485,20 @@ jobs:

steps:
- name: Check out the repository
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v4
with:
persist-credentials: false

# explicitly checkout the branch for the PR,
# this is necessary for the `pull_request` event
- name: Check out the repository (PR)
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
persist-credentials: false
ref: ${{ github.event.pull_request.head.sha }}

# the python version used here is not what is used in the tests themselves
- name: Set up Python for dagger
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install python dependencies
run: |
python -m pip install --user --upgrade pip
python -m pip --version
python -m pip install -r dagger/requirements.txt
- uses: pypa/hatch@install

- name: Run tests for ${{ matrix.test }}
run: python dagger/run_dbt_spark_tests.py --profile ${{ matrix.test }}
run: hatch run python dagger/run_dbt_spark_tests.py --profile ${{ matrix.test }}

merge-changes-into-target-branch:
runs-on: ubuntu-latest
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/version-bump.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,7 @@ repos:
- --pretty
files: ^dbt/adapters
additional_dependencies:
- types-PyYAML
- types-python-dateutil
- types-pytz
- types-requests
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

Loading

0 comments on commit 7b92cc5

Please sign in to comment.