Skip to content

Commit fb7d0f7

Browse files
authored
Merge pull request #270 from github/daverlo/python-mac
Port python deps setup to mac
2 parents badb286 + e23b3ef commit fb7d0f7

File tree

7 files changed

+126
-141
lines changed

7 files changed

+126
-141
lines changed

.github/workflows/python-deps-linux.yml

Lines changed: 0 additions & 63 deletions
This file was deleted.

.github/workflows/python-deps-windows.yml

Lines changed: 0 additions & 61 deletions
This file was deleted.

.github/workflows/python-deps.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: Test Python Package Installation on Linux and Mac
2+
3+
on:
4+
push:
5+
branches: [main, v1]
6+
pull_request:
7+
8+
jobs:
9+
10+
test-setup-python-scripts:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
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
40+
41+
steps:
42+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
43+
- uses: actions/checkout@v2
44+
45+
- name: Initialize CodeQL
46+
uses: github/codeql-action/init@v1
47+
with:
48+
languages: python
49+
50+
- name: Test Auto Package Installation
51+
run: |
52+
set -x
53+
$GITHUB_WORKSPACE/python-setup/install_tools.sh
54+
55+
cd $GITHUB_WORKSPACE/${{ matrix.test_dir }}
56+
57+
case ${{ matrix.os }} in
58+
ubuntu-latest*) basePath="/opt";;
59+
macos-latest*) basePath="/Users/runner";;
60+
esac
61+
echo ${basePath}
62+
63+
find ${basePath}/hostedtoolcache/CodeQL -path "*x64/codeql" -exec $GITHUB_WORKSPACE/python-setup/auto_install_packages.py {} \;
64+
- name: Setup for extractor
65+
run: |
66+
echo $CODEQL_PYTHON
67+
# only run if $CODEQL_PYTHON is set
68+
if [ ! -z $CODEQL_PYTHON ]; then
69+
$GITHUB_WORKSPACE/python-setup/tests/from_python_exe.py $CODEQL_PYTHON;
70+
fi
71+
- name: Verify packages installed
72+
run: |
73+
${{ matrix.test_script }}
74+
75+
test-setup-python-scripts-windows:
76+
runs-on: windows-latest
77+
strategy:
78+
fail-fast: false
79+
matrix:
80+
include:
81+
- test_dir: python-setup/tests/pipenv/requests-2
82+
python_version: 2
83+
- test_dir: python-setup/tests/pipenv/requests-3
84+
python_version: 3
85+
86+
- test_dir: python-setup/tests/poetry/requests-2
87+
python_version: 2
88+
- test_dir: python-setup/tests/poetry/requests-3
89+
python_version: 3
90+
91+
- test_dir: python-setup/tests/requirements/requests-2
92+
python_version: 2
93+
- test_dir: python-setup/tests/requirements/requests-3
94+
python_version: 3
95+
96+
- test_dir: python-setup/tests/setup_py/requests-2
97+
python_version: 2
98+
- test_dir: python-setup/tests/setup_py/requests-3
99+
python_version: 3
100+
101+
steps:
102+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
103+
- uses: actions/checkout@v2
104+
105+
- name: Initialize CodeQL
106+
uses: github/codeql-action/init@v1
107+
with:
108+
languages: python
109+
110+
- name: Test Auto Package Installation
111+
run: |
112+
$cmd = $Env:GITHUB_WORKSPACE + "\\python-setup\\install_tools.ps1"
113+
powershell -File $cmd
114+
115+
cd $Env:GITHUB_WORKSPACE\\${{ matrix.test_dir }}
116+
py -3 $Env:GITHUB_WORKSPACE\\python-setup\\auto_install_packages.py C:\\hostedtoolcache\\windows\\CodeQL\\0.0.0-20200826\\x64\\codeql
117+
- name: Setup for extractor
118+
run: |
119+
echo $Env:CODEQL_PYTHON
120+
121+
py -3 $Env:GITHUB_WORKSPACE\\python-setup\\tests\\from_python_exe.py $Env:CODEQL_PYTHON
122+
- name: Verify packages installed
123+
run: |
124+
$cmd = $Env:GITHUB_WORKSPACE + "\\python-setup\\tests\\check_requests_123.ps1"
125+
powershell -File $cmd ${{ matrix.python_version }}

lib/init.js

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python-setup/install_tools.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ python3 -m pip install --user --upgrade pip setuptools wheel
1818
python2 -m pip install --user virtualenv
1919
python3 -m pip install --user virtualenv
2020

21-
# venv is required for installation of poetry or pipenv (I forgot which)
22-
sudo apt-get install -y python3-venv
23-
2421
# We install poetry with pip instead of the recommended way, since the recommended way
2522
# caused some problem since `poetry run` gives output like:
2623
#

src/init.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,6 @@ export async function injectWindowsTracer(
186186
export async function installPythonDeps(codeql: CodeQL, logger: Logger) {
187187
logger.startGroup("Setup Python dependencies");
188188

189-
if (process.platform === "darwin") {
190-
logger.info(
191-
"Currently, auto-installing python dependencies is not supported on MacOS"
192-
);
193-
logger.endGroup();
194-
return;
195-
}
196-
197189
const scriptsFolder = path.resolve(__dirname, "../python-setup");
198190

199191
// Setup tools on the Github hosted runners

0 commit comments

Comments
 (0)