66 pull_request :
77
88jobs :
9-
109 test-setup-python-scripts :
1110 runs-on : ${{ matrix.os }}
1211 strategy :
1312 fail-fast : false
1413 matrix :
1514 os : [ubuntu-latest, macos-latest]
16- include :
17- - test_dir : python-setup/tests/pipenv/requests-2
18- test_script : $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 2
19- - test_dir : python-setup/tests/pipenv/requests-3
20- test_script : $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 3
21-
22- - test_dir : python-setup/tests/poetry/requests-2
23- test_script : $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 2
24- - test_dir : python-setup/tests/poetry/requests-3
25- test_script : $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 3
26-
27- - test_dir : python-setup/tests/requirements/requests-2
28- test_script : $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 2
29- - test_dir : python-setup/tests/requirements/requests-3
30- test_script : $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 3
31-
32- - test_dir : python-setup/tests/setup_py/requests-2
33- test_script : $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 2
34- - test_dir : python-setup/tests/setup_py/requests-3
35- test_script : $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh 3
36-
37- # This one shouldn't fail, but also won't install packages
38- - test_dir : python-setup/tests/requirements/non-standard-location
39- test_script : test -z $LGTM_INDEX_IMPORT_PATH
15+ python_deps_type : [pipenv, poetry, requirements, setup_py]
16+ python_version : [2, 3]
17+
18+ env :
19+ PYTHON_DEPS_TYPE : ${{ matrix.python_deps_type }}
20+ PYTHON_VERSION : ${{ matrix.python_version }}
4021
4122 steps :
4223 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
5536 set -x
5637 $GITHUB_WORKSPACE/python-setup/install_tools.sh
5738
58- cd $GITHUB_WORKSPACE/${{ matrix.test_dir } }
39+ cd $GITHUB_WORKSPACE/python-setup/tests/${PYTHON_DEPS_TYPE}/requests-${PYTHON_VERSION }
5940
6041 case ${{ matrix.os }} in
6142 ubuntu-latest*) basePath="/opt";;
@@ -71,35 +52,69 @@ jobs:
7152 if [ ! -z $CODEQL_PYTHON ]; then
7253 $GITHUB_WORKSPACE/python-setup/tests/from_python_exe.py $CODEQL_PYTHON;
7354 fi
55+
7456 - name : Verify packages installed
7557 run : |
76- ${{ matrix.test_script }}
58+ $GITHUB_WORKSPACE/python-setup/tests/check_requests_123.sh ${PYTHON_VERSION}
59+
60+ # This one shouldn't fail, but also won't install packages
61+ test-setup-python-scripts-non-standard-location :
62+ runs-on : ${{ matrix.os }}
63+ strategy :
64+ fail-fast : false
65+ matrix :
66+ os : [ubuntu-latest, macos-latest]
67+
68+ steps :
69+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
70+ - uses : actions/checkout@v2
71+
72+ - name : Initialize CodeQL
73+ uses : ./init
74+ id : init
75+ with :
76+ tools : latest
77+ languages : python
78+ setup-python-dependencies : false
79+
80+ - name : Test Auto Package Installation
81+ run : |
82+ set -x
83+ $GITHUB_WORKSPACE/python-setup/install_tools.sh
84+
85+ cd $GITHUB_WORKSPACE/python-setup/tests/requirements/non-standard-location
86+
87+ case ${{ matrix.os }} in
88+ ubuntu-latest*) basePath="/opt";;
89+ macos-latest*) basePath="/Users/runner";;
90+ esac
91+ echo ${basePath}
92+
93+ $GITHUB_WORKSPACE/python-setup/auto_install_packages.py "$(dirname ${{steps.init.outputs.codeql-path}})"
94+
95+ - name : Setup for extractor
96+ run : |
97+ echo $CODEQL_PYTHON
98+ # only run if $CODEQL_PYTHON is set
99+ if [ ! -z $CODEQL_PYTHON ]; then
100+ $GITHUB_WORKSPACE/python-setup/tests/from_python_exe.py $CODEQL_PYTHON;
101+ fi
102+
103+ - name : Verify packages installed
104+ run : |
105+ test -z $LGTM_INDEX_IMPORT_PATH
77106
78107 test-setup-python-scripts-windows :
79108 runs-on : windows-latest
80109 strategy :
81110 fail-fast : false
82111 matrix :
83- include :
84- - test_dir : python-setup/tests/pipenv/requests-2
85- python_version : 2
86- - test_dir : python-setup/tests/pipenv/requests-3
87- python_version : 3
88-
89- - test_dir : python-setup/tests/poetry/requests-2
90- python_version : 2
91- - test_dir : python-setup/tests/poetry/requests-3
92- python_version : 3
93-
94- - test_dir : python-setup/tests/requirements/requests-2
95- python_version : 2
96- - test_dir : python-setup/tests/requirements/requests-3
97- python_version : 3
98-
99- - test_dir : python-setup/tests/setup_py/requests-2
100- python_version : 2
101- - test_dir : python-setup/tests/setup_py/requests-3
102- python_version : 3
112+ python_deps_type : [pipenv, poetry, requirements, setup_py]
113+ python_version : [2, 3]
114+
115+ env :
116+ PYTHON_DEPS_TYPE : ${{ matrix.python_deps_type }}
117+ PYTHON_VERSION : ${{ matrix.python_version }}
103118
104119 steps :
105120 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
@@ -117,17 +132,19 @@ jobs:
117132 $cmd = $Env:GITHUB_WORKSPACE + "\\python-setup\\install_tools.ps1"
118133 powershell -File $cmd
119134
120- cd $Env:GITHUB_WORKSPACE\\${{ matrix.test_dir }}
135+ cd $Env:GITHUB_WORKSPACE\\python-setup/tests/$Env:PYTHON_DEPS_TYPE/requests-$Env:PYTHON_VERSION
121136 $DefaultsPath = Join-Path (Join-Path $Env:GITHUB_WORKSPACE "src") "defaults.json"
122137 $CodeQLBundleName = (Get-Content -Raw -Path $DefaultsPath | ConvertFrom-Json).bundleVersion
123138 $CodeQLVersion = "0.0.0-" + $CodeQLBundleName.split("-")[-1]
124139 py -3 $Env:GITHUB_WORKSPACE\\python-setup\\auto_install_packages.py C:\\hostedtoolcache\\windows\\CodeQL\\$CodeQLVersion\\x64\\codeql
140+
125141 - name : Setup for extractor
126142 run : |
127143 echo $Env:CODEQL_PYTHON
128144
129145 py -3 $Env:GITHUB_WORKSPACE\\python-setup\\tests\\from_python_exe.py $Env:CODEQL_PYTHON
146+
130147 - name : Verify packages installed
131148 run : |
132149 $cmd = $Env:GITHUB_WORKSPACE + "\\python-setup\\tests\\check_requests_123.ps1"
133- powershell -File $cmd ${{ matrix.python_version }}
150+ powershell -File $cmd $Env:PYTHON_VERSION
0 commit comments