Skip to content

Create Requirements Files #81

Create Requirements Files

Create Requirements Files #81

name: Create Requirements Files
on:
workflow_dispatch:
jobs:
create-req-files:
name: Create requirements files
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
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
- name: Install Python Connector
shell: bash
run: python -m 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-connector-python 1>>${{ env.requirements_file }} 2>/dev/null
echo "snowflake-connector-python==$(python -m pip show snowflake-connector-python | 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@v3
with:
path: temp_requirement
push-files:
needs: create-req-files
name: Commit and push files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
- name: Download requirement files
uses: actions/download-artifact@v3
with:
name: artifact
path: tested_requirements
- name: Commit and push new requirements files
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add tested_requirements
git commit -m "Update requirements files" -a
git push