Permalink
Cannot retrieve contributors at this time
186 lines (156 sloc)
6 KB
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/.github/workflows/python-deps.yml
View runs Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Python Package Installation on Linux and Mac | |
on: | |
push: | |
branches: [main, releases/v1, releases/v2] | |
pull_request: | |
# Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened | |
# by other workflows. | |
types: [opened, synchronize, reopened, ready_for_review] | |
paths: | |
# Changes to this workflow. | |
- '.github/workflows/python-deps.yml' | |
# Changes to the Python package installation scripts and their tests. | |
- 'python-setup/**' | |
# Changes to the default CodeQL bundle version. | |
- '**/defaults.json' | |
schedule: | |
# Weekly on Monday. | |
- cron: '0 0 * * 1' | |
workflow_dispatch: | |
jobs: | |
test-setup-python-scripts: | |
timeout-minutes: 45 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python_deps_type: [pipenv, poetry, requirements, setup_py] | |
python_version: [2, 3] | |
exclude: | |
# Python2 and poetry are not supported. See https://github.com/actions/setup-python/issues/374 | |
- python_version: 2 | |
python_deps_type: poetry | |
# Python2 and pipenv are not supported since pipenv v2021.11.5 | |
- python_version: 2 | |
python_deps_type: pipenv | |
env: | |
PYTHON_DEPS_TYPE: ${{ matrix.python_deps_type }} | |
PYTHON_VERSION: ${{ matrix.python_version }} | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Initialize CodeQL | |
uses: ./init | |
id: init | |
with: | |
tools: latest | |
languages: python | |
setup-python-dependencies: false | |
- name: Test Auto Package Installation | |
run: | | |
set -x | |
$GITHUB_WORKSPACE/python-setup/install_tools.sh | |
cd $GITHUB_WORKSPACE/python-setup/tests/${PYTHON_DEPS_TYPE}/requests-${PYTHON_VERSION} | |
case ${{ matrix.os }} in | |
ubuntu-latest*) basePath="/opt";; | |
macos-latest*) basePath="/Users/runner";; | |
esac | |
echo ${basePath} | |
$GITHUB_WORKSPACE/python-setup/auto_install_packages.py "$(dirname ${{steps.init.outputs.codeql-path}})" | |
- name: Setup for extractor | |
run: | | |
echo $CODEQL_PYTHON | |
# only run if $CODEQL_PYTHON is set | |
if [ ! -z $CODEQL_PYTHON ]; then | |
$GITHUB_WORKSPACE/python-setup/tests/from_python_exe.py $CODEQL_PYTHON; | |
fi | |
- name: Verify packages installed | |
run: | | |
$GITHUB_WORKSPACE/python-setup/tests/check_requests_2_26_0.sh ${PYTHON_VERSION} | |
# This one shouldn't fail, but also won't install packages | |
test-setup-python-scripts-non-standard-location: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Initialize CodeQL | |
uses: ./init | |
id: init | |
with: | |
tools: latest | |
languages: python | |
setup-python-dependencies: false | |
- name: Test Auto Package Installation | |
run: | | |
set -x | |
$GITHUB_WORKSPACE/python-setup/install_tools.sh | |
cd $GITHUB_WORKSPACE/python-setup/tests/requirements/non-standard-location | |
case ${{ matrix.os }} in | |
ubuntu-latest*) basePath="/opt";; | |
macos-latest*) basePath="/Users/runner";; | |
esac | |
echo ${basePath} | |
$GITHUB_WORKSPACE/python-setup/auto_install_packages.py "$(dirname ${{steps.init.outputs.codeql-path}})" | |
- name: Setup for extractor | |
run: | | |
echo $CODEQL_PYTHON | |
# only run if $CODEQL_PYTHON is set | |
if [ ! -z $CODEQL_PYTHON ]; then | |
$GITHUB_WORKSPACE/python-setup/tests/from_python_exe.py $CODEQL_PYTHON; | |
fi | |
- name: Verify packages installed | |
run: | | |
test -z $LGTM_INDEX_IMPORT_PATH | |
test-setup-python-scripts-windows: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python_deps_type: [pipenv, poetry, requirements, setup_py] | |
python_version: [2, 3] | |
exclude: | |
# Python2 and poetry are not supported. See https://github.com/actions/setup-python/issues/374 | |
- python_version: 2 | |
python_deps_type: poetry | |
# Python2 and pipenv are not supported since pipenv v2021.11.5 | |
- python_version: 2 | |
python_deps_type: pipenv | |
env: | |
PYTHON_DEPS_TYPE: ${{ matrix.python_deps_type }} | |
PYTHON_VERSION: ${{ matrix.python_version }} | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Initialize CodeQL | |
uses: ./init | |
with: | |
tools: latest | |
languages: python | |
setup-python-dependencies: false | |
env: | |
TEST_MODE: true | |
- name: Test Auto Package Installation | |
run: | | |
$cmd = $Env:GITHUB_WORKSPACE + "\\python-setup\\install_tools.ps1" | |
powershell -File $cmd | |
cd $Env:GITHUB_WORKSPACE\\python-setup/tests/$Env:PYTHON_DEPS_TYPE/requests-$Env:PYTHON_VERSION | |
$DefaultsPath = Join-Path (Join-Path $Env:GITHUB_WORKSPACE "src") "defaults.json" | |
$CodeQLBundleName = (Get-Content -Raw -Path $DefaultsPath | ConvertFrom-Json).bundleVersion | |
$CodeQLVersion = "0.0.0-" + $CodeQLBundleName.split("-")[-1] | |
py -3 $Env:GITHUB_WORKSPACE\\python-setup\\auto_install_packages.py C:\\hostedtoolcache\\windows\\CodeQL\\$CodeQLVersion\\x64\\codeql | |
- name: Setup for extractor | |
run: | | |
echo $Env:CODEQL_PYTHON | |
py -3 $Env:GITHUB_WORKSPACE\\python-setup\\tests\\from_python_exe.py $Env:CODEQL_PYTHON | |
- name: Verify packages installed | |
run: | | |
$cmd = $Env:GITHUB_WORKSPACE + "\\python-setup\\tests\\check_requests_2_26_0.ps1" | |
powershell -File $cmd $Env:PYTHON_VERSION |