|
| 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 | + tools: latest |
| 49 | + languages: python |
| 50 | + |
| 51 | + - name: Test Auto Package Installation |
| 52 | + run: | |
| 53 | + set -x |
| 54 | + $GITHUB_WORKSPACE/python-setup/install_tools.sh |
| 55 | +
|
| 56 | + cd $GITHUB_WORKSPACE/${{ matrix.test_dir }} |
| 57 | +
|
| 58 | + case ${{ matrix.os }} in |
| 59 | + ubuntu-latest*) basePath="/opt";; |
| 60 | + macos-latest*) basePath="/Users/runner";; |
| 61 | + esac |
| 62 | + echo ${basePath} |
| 63 | +
|
| 64 | + codeql_version="0.0.0-$(cat "$GITHUB_WORKSPACE/src/defaults.json" | jq -r .bundleVersion | rev | cut -d - -f 1 | rev)" |
| 65 | + $GITHUB_WORKSPACE/python-setup/auto_install_packages.py "${basePath}/hostedtoolcache/CodeQL/$codeql_version/x64/codeql" |
| 66 | + - name: Setup for extractor |
| 67 | + run: | |
| 68 | + echo $CODEQL_PYTHON |
| 69 | + # only run if $CODEQL_PYTHON is set |
| 70 | + if [ ! -z $CODEQL_PYTHON ]; then |
| 71 | + $GITHUB_WORKSPACE/python-setup/tests/from_python_exe.py $CODEQL_PYTHON; |
| 72 | + fi |
| 73 | + - name: Verify packages installed |
| 74 | + run: | |
| 75 | + ${{ matrix.test_script }} |
| 76 | +
|
| 77 | + test-setup-python-scripts-windows: |
| 78 | + runs-on: windows-latest |
| 79 | + strategy: |
| 80 | + fail-fast: false |
| 81 | + matrix: |
| 82 | + include: |
| 83 | + - test_dir: python-setup/tests/pipenv/requests-2 |
| 84 | + python_version: 2 |
| 85 | + - test_dir: python-setup/tests/pipenv/requests-3 |
| 86 | + python_version: 3 |
| 87 | + |
| 88 | + - test_dir: python-setup/tests/poetry/requests-2 |
| 89 | + python_version: 2 |
| 90 | + - test_dir: python-setup/tests/poetry/requests-3 |
| 91 | + python_version: 3 |
| 92 | + |
| 93 | + - test_dir: python-setup/tests/requirements/requests-2 |
| 94 | + python_version: 2 |
| 95 | + - test_dir: python-setup/tests/requirements/requests-3 |
| 96 | + python_version: 3 |
| 97 | + |
| 98 | + - test_dir: python-setup/tests/setup_py/requests-2 |
| 99 | + python_version: 2 |
| 100 | + - test_dir: python-setup/tests/setup_py/requests-3 |
| 101 | + python_version: 3 |
| 102 | + |
| 103 | + steps: |
| 104 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 105 | + - uses: actions/checkout@v2 |
| 106 | + |
| 107 | + - name: Initialize CodeQL |
| 108 | + uses: github/codeql-action/init@v1 |
| 109 | + with: |
| 110 | + tools: latest |
| 111 | + languages: python |
| 112 | + |
| 113 | + - name: Test Auto Package Installation |
| 114 | + run: | |
| 115 | + $cmd = $Env:GITHUB_WORKSPACE + "\\python-setup\\install_tools.ps1" |
| 116 | + powershell -File $cmd |
| 117 | +
|
| 118 | + cd $Env:GITHUB_WORKSPACE\\${{ matrix.test_dir }} |
| 119 | + $DefaultsPath = Join-Path (Join-Path $Env:GITHUB_WORKSPACE "src") "defaults.json" |
| 120 | + $CodeQLBundleName = (Get-Content -Raw -Path $DefaultsPath | ConvertFrom-Json).bundleVersion |
| 121 | + $CodeQLVersion = "0.0.0-" + $CodeQLBundleName.split("-")[-1] |
| 122 | + py -3 $Env:GITHUB_WORKSPACE\\python-setup\\auto_install_packages.py C:\\hostedtoolcache\\windows\\CodeQL\\$CodeQLVersion\\x64\\codeql |
| 123 | + - name: Setup for extractor |
| 124 | + run: | |
| 125 | + echo $Env:CODEQL_PYTHON |
| 126 | +
|
| 127 | + py -3 $Env:GITHUB_WORKSPACE\\python-setup\\tests\\from_python_exe.py $Env:CODEQL_PYTHON |
| 128 | + - name: Verify packages installed |
| 129 | + run: | |
| 130 | + $cmd = $Env:GITHUB_WORKSPACE + "\\python-setup\\tests\\check_requests_123.ps1" |
| 131 | + powershell -File $cmd ${{ matrix.python_version }} |
0 commit comments