mirror of
https://github.com/github/codeql-action.git
synced 2025-12-26 17:20:10 +08:00
159 lines
5.0 KiB
YAML
159 lines
5.0 KiB
YAML
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]
|
|
|
|
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]
|
|
|
|
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]
|
|
|
|
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
|
|
|
|
- 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
|