Skip to content

Commit

Permalink
Merge branch 'main' into SNOW-1478982-example-for-default
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jvasquezrojas authored Nov 25, 2024
2 parents 65fa074 + 9b2c6d1 commit a11fa36
Show file tree
Hide file tree
Showing 96 changed files with 4,814 additions and 518 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @snowflakedb/snowcli
* @snowflakedb/ORM
114 changes: 81 additions & 33 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ jobs:
python-version: '3.8'
- name: Upgrade and install tools
run: |
python -m pip install -U pip
python -m pip install -U hatch
python -m pip install -U uv
python -m uv pip install -U hatch
python -m hatch env create default
- name: Set PY
run: echo "PY=$(hatch run gh-cache-sum)" >> $GITHUB_ENV
Expand All @@ -49,6 +49,10 @@ jobs:
name: Test package build and installation
runs-on: ubuntu-latest
needs: lint
strategy:
fail-fast: true
matrix:
hatch-env: [default, sa14]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -59,15 +63,14 @@ jobs:
python-version: '3.8'
- name: Upgrade and install tools
run: |
python -m pip install -U pip
python -m pip install -U hatch
python -m pip install -U uv
python -m uv pip install -U hatch
- name: Build package
run: |
python -m hatch clean
python -m hatch build
python -m hatch -e ${{ matrix.hatch-env }} build --clean
- name: Install and check import
run: |
python -m pip install dist/snowflake_sqlalchemy-*.whl
python -m uv pip install dist/snowflake_sqlalchemy-*.whl
python -c "import snowflake.sqlalchemy; print(snowflake.sqlalchemy.__version__)"
test-dialect:
Expand All @@ -79,7 +82,7 @@ jobs:
matrix:
os: [
ubuntu-latest,
macos-latest,
macos-13,
windows-latest,
]
python-version: ["3.8"]
Expand All @@ -98,8 +101,8 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip and prepare environment
run: |
python -m pip install -U pip
python -m pip install -U hatch
python -m pip install -U uv
python -m uv pip install -U hatch
python -m hatch env create default
- name: Setup parameters file
shell: bash
Expand All @@ -108,6 +111,9 @@ jobs:
run: |
gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \
.github/workflows/parameters/parameters_${{ matrix.cloud-provider }}.py.gpg > tests/parameters.py
- name: Run test for AWS
run: hatch run test-dialect-aws
if: matrix.cloud-provider == 'aws'
- name: Run tests
run: hatch run test-dialect
- uses: actions/upload-artifact@v4
Expand All @@ -125,7 +131,7 @@ jobs:
matrix:
os: [
ubuntu-latest,
macos-latest,
macos-13,
windows-latest,
]
python-version: ["3.8"]
Expand All @@ -144,8 +150,8 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip and install hatch
run: |
python -m pip install -U pip
python -m pip install -U hatch
python -m pip install -U uv
python -m uv pip install -U hatch
python -m hatch env create default
- name: Setup parameters file
shell: bash
Expand All @@ -162,16 +168,16 @@ jobs:
path: |
./coverage.xml
test-dialect-run-v20:
name: Test dialect run v20 ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
test-dialect-v14:
name: Test dialect v14 ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
needs: [ lint, build-install ]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [
ubuntu-latest,
macos-latest,
macos-13,
windows-latest,
]
python-version: ["3.8"]
Expand All @@ -197,21 +203,70 @@ jobs:
.github/workflows/parameters/parameters_${{ matrix.cloud-provider }}.py.gpg > tests/parameters.py
- name: Upgrade pip and install hatch
run: |
python -m pip install -U pip
python -m pip install -U hatch
python -m pip install -U uv
python -m uv pip install -U hatch
python -m hatch env create default
- name: Run test for AWS
run: hatch run sa14:test-dialect-aws
if: matrix.cloud-provider == 'aws'
- name: Run tests
run: hatch run test-run_v20
run: hatch run sa14:test-dialect
- uses: actions/upload-artifact@v4
with:
name: coverage.xml_dialect-run-20-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
name: coverage.xml_dialect-v14-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
path: |
./coverage.xml
test-dialect-compatibility-v14:
name: Test dialect v14 compatibility ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [
ubuntu-latest,
macos-13,
windows-latest,
]
python-version: ["3.8"]
cloud-provider: [
aws,
azure,
gcp,
]
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip and install hatch
run: |
python -m pip install -U uv
python -m uv pip install -U hatch
python -m hatch env create default
- name: Setup parameters file
shell: bash
env:
PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }}
run: |
gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \
.github/workflows/parameters/parameters_${{ matrix.cloud-provider }}.py.gpg > tests/parameters.py
- name: Run tests
run: hatch run sa14:test-dialect-compatibility
- uses: actions/upload-artifact@v4
with:
name: coverage.xml_dialect-v14-compatibility-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
path: |
./coverage.xml
combine-coverage:
name: Combine coverage
if: ${{ success() || failure() }}
needs: [test-dialect, test-dialect-compatibility, test-dialect-run-v20]
needs: [test-dialect, test-dialect-compatibility, test-dialect-v14, test-dialect-compatibility-v14]
runs-on: ubuntu-latest
steps:
- name: Set up Python
Expand All @@ -220,8 +275,8 @@ jobs:
python-version: "3.8"
- name: Prepare environment
run: |
pip install -U pip
pip install -U hatch
python -m pip install -U uv
python -m uv pip install -U hatch
hatch env create default
- uses: actions/checkout@v4
with:
Expand All @@ -233,22 +288,15 @@ jobs:
run: |
hatch run coverage combine -a artifacts/coverage.xml_*/coverage.xml
hatch run coverage report -m
hatch run coverage xml -o combined_coverage.xml
hatch run coverage html -d htmlcov
- name: Store coverage reports
uses: actions/upload-artifact@v4
with:
name: combined_coverage.xml
path: combined_coverage.xml
- name: Store htmlcov report
uses: actions/upload-artifact@v4
with:
name: combined_htmlcov
path: htmlcov
name: coverage.xml
path: coverage.xml
- name: Uplaod to codecov
uses: codecov/codecov-action@v4
with:
file: combined_coverage.xml
file: coverage.xml
env_vars: OS,PYTHON
fail_ci_if_error: false
flags: unittests
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/create_req_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Upgrade setuptools, pip and wheel
run: python -m pip install -U setuptools pip wheel
run: python -m pip install -U setuptools pip wheel uv
- name: Install Snowflake SQLAlchemy
shell: bash
run: python -m pip install .
run: python -m uv pip install .
- name: Generate reqs file name
shell: bash
run: echo "requirements_file=temp_requirement/requirements_$(python -c 'from sys import version_info;print(str(version_info.major)+str(version_info.minor))').reqs" >> $GITHUB_ENV
Expand All @@ -34,7 +34,7 @@ jobs:
mkdir temp_requirement
echo "# Generated on: $(python --version)" >${{ env.requirements_file }}
python -m pip freeze | grep -v snowflake-sqlalchemy 1>>${{ env.requirements_file }} 2>/dev/null
echo "snowflake-sqlalchemy==$(python -m pip show snowflake-sqlalchemy | grep ^Version | cut -d' ' -f2-)" >>${{ env.requirements_file }}
echo "snowflake-sqlalchemy==$(python -m uv pip show snowflake-sqlalchemy | grep ^Version | cut -d' ' -f2-)" >>${{ env.requirements_file }}
id: create-reqs-file
- name: Show created req file
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jira_close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
token: ${{ secrets.SNOWFLAKE_GITHUB_TOKEN }} # stored in GitHub secrets
path: .
- name: Jira login
uses: atlassian/gajira-login@master
uses: atlassian/gajira-login@v3
env:
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/jira_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Jira login
uses: atlassian/gajira-login@master
uses: atlassian/gajira-login@v3
env:
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
Expand All @@ -22,7 +22,7 @@ jobs:
jira=$(echo -n $TITLE | awk '{print $1}' | sed -e 's/://')
echo ::set-output name=jira::$jira
- name: Comment on issue
uses: atlassian/gajira-comment@master
uses: atlassian/gajira-comment@v3
if: startsWith(steps.extract.outputs.jira, 'SNOW-')
with:
issue: "${{ steps.extract.outputs.jira }}"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/jira_issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ jobs:
path: .

- name: Login
uses: atlassian/gajira-login@v2.0.0
uses: atlassian/gajira-login@v3
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}

- name: Create JIRA Ticket
id: create
uses: atlassian/gajira-create@v2.0.1
uses: atlassian/gajira-create@v3
with:
project: SNOW
issuetype: Bug
Expand Down
49 changes: 45 additions & 4 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ on:
types: [published]

permissions:
contents: read
contents: write
id-token: write

jobs:
deploy:
Expand All @@ -30,10 +31,50 @@ jobs:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
python -m pip install -U uv
python -m uv pip install -U hatch
- name: Build package
run: python -m build
run: python -m hatch build --clean
- name: List artifacts
run: ls ./dist
- name: Install sigstore
run: python -m pip install sigstore
- name: Signing
run: |
for dist in dist/*; do
dist_base="$(basename "${dist}")"
echo "dist: ${dist}"
echo "dist_base: ${dist_base}"
python -m \
sigstore sign "${dist}" \
--output-signature "${dist_base}.sig" \
--output-certificate "${dist_base}.crt" \
--bundle "${dist_base}.sigstore"
# Verify using `.sig` `.crt` pair;
python -m \
sigstore verify identity "${dist}" \
--signature "${dist_base}.sig" \
--cert "${dist_base}.crt" \
--cert-oidc-issuer https://token.actions.githubusercontent.com \
--cert-identity ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/.github/workflows/python-publish.yml@${GITHUB_REF}
# Verify using `.sigstore` bundle;
python -m \
sigstore verify identity "${dist}" \
--bundle "${dist_base}.sigstore" \
--cert-oidc-issuer https://token.actions.githubusercontent.com \
--cert-identity ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/.github/workflows/python-publish.yml@${GITHUB_REF}
done
- name: List artifacts after sign
run: ls ./dist
- name: Copy files to release
run: |
gh release upload ${{ github.event.release.tag_name }} *.sigstore
gh release upload ${{ github.event.release.tag_name }} *.sig
gh release upload ${{ github.event.release.tag_name }} *.crt
env:
GITHUB_TOKEN: ${{ github.TOKEN }}
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale_issue_bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v7
- uses: actions/stale@v9
with:
close-issue-message: 'To clean up and re-prioritize bugs and feature requests we are closing all issues older than 6 months as of Apr 1, 2023. If there are any issues or feature requests that you would like us to address, please re-create them. For urgent issues, opening a support case with this link [Snowflake Community](https://community.snowflake.com/s/article/How-To-Submit-a-Support-Case-in-Snowflake-Lodge) is the fastest way to get a response'
days-before-issue-stale: ${{ inputs.staleDays }}
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ repos:
rev: v4.5.0
hooks:
- id: trailing-whitespace
exclude: '\.ambr$'
- id: end-of-file-fixer
- id: check-yaml
exclude: .github/repo_meta.yaml
Expand Down
Loading

0 comments on commit a11fa36

Please sign in to comment.