Skip to content

chore: add workflow to find the python dependencies in repo #50

chore: add workflow to find the python dependencies in repo

chore: add workflow to find the python dependencies in repo #50

name: Check Python Dependencies
on:
pull_request:
defaults:
run:
shell: bash # strict bash
jobs:
check_dependencies:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Create repo_work directory
run: |
WORK_DIR="/tmp/unpack_reqs"
repo_name="${{ github.repository }}"
repo_work="$WORK_DIR/$repo_name"
mkdir -p "$repo_work"
echo "$repo_work"
- name: Copy Python requirements file
run: |
for req_file in "requirements/edx/base.txt" "requirements/base.txt" "requirements.txt"; do
if [ -f "$req_file" ]; then
cp "$req_file" /tmp/unpack_reqs/openedx/edx-platform/base.txt
echo "Python requirements file found: $req_file"
echo "Content of base.txt:"
cat "$req_file"
break
fi
done
- name: Create virtual environment
run: python3 -m venv .venv
working-directory: /tmp/unpack_reqs/openedx/edx-platform
- name: Upgrade pip
run: |
.venv/bin/python3 -m pip install -U pip
working-directory: /tmp/unpack_reqs/openedx/edx-platform
- name: Download packages
run: |
echo "Downloading packages"
.venv/bin/python3 -m pip download --dest files -r base.txt
echo "Path of files: ${{ github.workspace }}/files"
cat ${{ github.workspace }}/files"
working-directory: /tmp/unpack_reqs/openedx/edx-platform
- name: Print WHL Files
run: |
echo "Path of files: /home/runner/work/edx-platform/edx-platform/files"
echo "WHL files found:"
for file in /home/runner/work/edx-platform/edx-platform/files/*.whl; do
echo "File: $file"
echo "Contents:"
cat "$file"
echo "-----------------"
done
- name: Extract GitHub URLs from base.txt
id: extract
run: |
urls=()
base_txt_path="/tmp/unpack_reqs/openedx/edx-platform/base.txt"
while IFS= read -r line; do
if [[ $line =~ (https://github.com[^@ #]*(\.git)?) ]]; then
urls+=("${BASH_REMATCH[0]}")
fi
done < "${base_txt_path}"
echo "{name}={urls}" >> $GITHUB_OUTPUT
- name: Display GitHub URLs
run: |
echo "GitHub URLs:"
echo "${{ steps.extract.outputs.urls }}"