Skip to content

SNOW-1797964: Clean up references from github workflows #617

SNOW-1797964: Clean up references from github workflows

SNOW-1797964: Clean up references from github workflows #617

name: Build Snowpark Checkpoints
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions: write-all
env:
PYTHON_VERSION: "3.11"
jobs:
build:
name: Build Packages
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip -q
pip install build twine sigstore hatch -q
pip list
- name: Fetch tags
run: git fetch --tags
- name: Get version from tag
id: get_version
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
VERSION=${VERSION#v}
echo "version=$VERSION"
else
echo "GIT REF is not a tag"
VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))
VERSION=${VERSION#v}
echo "version=$VERSION"
fi
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(rc[0-9]+)?$ ]]; then
echo "version=$VERSION"
echo "Error: No version found"
exit 1
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Update Version [snowpark-checkpoints]
run: |
set -e
echo "Current directory: $PWD" && ls -la
echo "NEW_VERSION=${NEW_VERSION}"
echo "FILE_NAME=${FILE_NAME}"
sed -i "s/^__version__ = \".*\"/__version__ = \"${NEW_VERSION}\"/" ${FILE_NAME}
echo "Package Version updated:" && cat ${FILE_NAME}
env:
NEW_VERSION: ${{ steps.get_version.outputs.version }}
FILE_NAME: __version__.py
working-directory: ${{ github.workspace }}
- name: Update Version [snowpark-configuration]
run: |
set -e
echo "Current directory: $PWD" && ls -l
echo "Updating pip file ${FILE_NAME} with version: ${NEW_VERSION}"
find $(pwd) -name "${FILE_NAME}" -exec sed -i "s/^__version__ = \".*\"/__version__ = \"${NEW_VERSION}\"/" {} \;
echo "Package Version updated:" && cat $(find . -name "${FILE_NAME}")
env:
NEW_VERSION: ${{ steps.get_version.outputs.version }}
FILE_NAME: __version__.py
working-directory: ./snowpark-checkpoints-configuration
- name: Update Version [snowpark-checkpoints-hypothesis]
run: |
set -e
echo "Current directory: $PWD" && ls -l
echo "Updating pip file ${FILE_NAME} with version: ${NEW_VERSION}"
find $(pwd) -name "${FILE_NAME}" -exec sed -i "s/^__version__ = \".*\"/__version__ = \"${NEW_VERSION}\"/" {} \;
echo "Package Version updated:" && cat $(find . -name "${FILE_NAME}")
env:
NEW_VERSION: ${{ steps.get_version.outputs.version }}
FILE_NAME: __version__.py
working-directory: ./snowpark-checkpoints-hypothesis
- name: Update Version [snowpark-checkpoints-validators]
run: |
set -e
echo "Current directory: $PWD" && ls -l
echo "Updating pip file ${FILE_NAME} with version: ${NEW_VERSION}"
find $(pwd) -name "${FILE_NAME}" -exec sed -i "s/^__version__ = \".*\"/__version__ = \"${NEW_VERSION}\"/" {} \;
echo "Package Version updated:" && cat $(find . -name "${FILE_NAME}")
env:
NEW_VERSION: ${{ steps.get_version.outputs.version }}
FILE_NAME: __version__.py
working-directory: ./snowpark-checkpoints-validators
- name: Update Version [snowpark-checkpoints-collector]
run: |
set -e
echo "Current directory: $PWD" && ls -l
echo "Updating pip file ${FILE_NAME} with version: ${NEW_VERSION}"
find $(pwd) -name "${FILE_NAME}" -exec sed -i "s/^__version__ = \".*\"/__version__ = \"${NEW_VERSION}\"/" {} \;
echo "Package Version updated:" && cat $(find . -name "${FILE_NAME}")
env:
NEW_VERSION: ${{ steps.get_version.outputs.version }}
FILE_NAME: __version__.py
working-directory: ./snowpark-checkpoints-collectors
- name: Generate Package [snowpark-checkpoints]
run: |
hatch build
echo "Current directory: $PWD" && ls -la dist
working-directory: ${{ github.workspace }}
- name: Generate Package [snowpark-configuration]
run: |
hatch build
echo "Current directory: $PWD" && ls -la dist
working-directory: ./snowpark-checkpoints-configuration
- name: Generate Package [snowpark-checkpoints-hypothesis]
run: |
hatch build
echo "Current directory: $PWD" && ls -la dist
working-directory: ./snowpark-checkpoints-hypothesis
- name: Generate Package [snowpark-checkpoints-validators]
run: |
hatch build
echo "Current directory: $PWD" && ls -la dist
working-directory: ./snowpark-checkpoints-validators
- name: Generate Package [snowpark-checkpoints-collector]
run: |
hatch build
echo "Current directory: $PWD" && ls -la dist
working-directory: ./snowpark-checkpoints-collectors
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: all-snowpark-checkpoints
path: |
./dist/*
./**/dist/*
publish:
name: Publish Packages Internally
runs-on: ubuntu-latest
needs: build
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: all-snowpark-checkpoints
path: ./dist
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Verify Artifacts
run: |
echo "Current working directory: $PWD" && ls -la
python -m pip install --upgrade pip -q
python -m venv wheelvenv
wheelvenv/bin/pip install --upgrade pip -q
wheelvenv/bin/pip install dist/*.whl -q
wheelvenv/bin/pip list --verbose
wheelvenv/bin/pip show $PACKAGE_NAME
working-directory: ./dist
env:
PACKAGE_NAME: snowpark-checkpoints