-
Notifications
You must be signed in to change notification settings - Fork 3.9k
72 lines (60 loc) · 2.01 KB
/
check_dependencies.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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"
mkdir -p "$WORK_DIR"/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" "$WORK_DIR"/repo_work/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: $WORK_DIR/repo_work
- name: Upgrade pip
run: |
.venv/bin/python3 -m pip install -U pip
working-directory: $WORK_DIR/repo_work
- name: Download packages
run: |
echo "Downloading packages"
.venv/bin/python3 -m pip download --dest files -r base.txt
base_txt_path="${GITHUB_WORKSPACE}/files/base.txt"
echo "Path of base.txt: ${base_txt_path}"
working-directory: $WORK_DIR/repo_work
- name: Extract GitHub URLs from base.txt
id: extract
run: |
urls=()
base_txt_path="./files/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 "::set-output name=urls::${urls[*]}"
- name: Display GitHub URLs
run: |
echo "GitHub URLs:"
echo "${{ steps.extract.outputs.urls }}"