Skip to content

Create Requirements Files #4

Create Requirements Files

Create Requirements Files #4

name: Create Requirements Files
on:
workflow_dispatch:
jobs:
create-req-files:
name: Create requirements files
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
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: 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 uv
- name: Install Snowflake SQLAlchemy
shell: bash
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
- name: Create reqs file
shell: bash
run: |
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 uv pip show snowflake-sqlalchemy | grep ^Version | cut -d' ' -f2-)" >>${{ env.requirements_file }}
id: create-reqs-file
- name: Show created req file
shell: bash
run: cat ${{ env.requirements_file }}
- uses: actions/upload-artifact@v4
with:
path: temp_requirement
push-files:
needs: create-req-files
name: Commit and push files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
token: ${{ secrets.SNOWFLAKE_GITHUB_TOKEN }} # stored in GitHub secrets
- name: Download requirement files
uses: actions/download-artifact@v4
with:
name: artifact
path: tested_requirements
- name: Commit and push new requirements files
run: |
git config user.name github-actions
git config user.email [email protected]
git add tested_requirements
git commit -m "Update requirements files" -a
git push