Skip to content

Commit

Permalink
fix for python install on self-hosted runners
Browse files Browse the repository at this point in the history
  • Loading branch information
bratpiorka committed Nov 1, 2024
1 parent b3bbdd4 commit f7b51f0
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
22 changes: 21 additions & 1 deletion .github/workflows/reusable_codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,27 @@ jobs:
with:
fetch-depth: 0

- name: Setup newer Python
- name: Check for Python >= 3.10
id: check_python
run: |
echo "python_exists=false" >> $GITHUB_OUTPUT
$pythonCommand = Get-Command python -ErrorAction SilentlyContinue
if ($pythonCommand) {
$pythonVersion = python --version 2>&1
$versionPattern = 'Python (\d+)\.(\d+)\.(\d+)'
echo $pythonVersion
if ($pythonVersion -match $versionPattern) {
$major = [int]$matches[1]
$minor = [int]$matches[2]
if ($major -gt 3 -or ($major -eq 3 -and $minor -ge 10)) {
echo "python_exists=true" >> $GITHUB_OUTPUT
}
}
}
shell: pwsh

- name: Setup Python 3.10
if: steps.check_python.outputs.python_exists == 'false'
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: "3.10"
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/reusable_fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,47 @@ jobs:
with:
fetch-depth: 0

- name: Check for Python >= 3.10
if: matrix.os == 'windows-latest'
id: check_python
run: |
echo "python_exists=false" >> $GITHUB_OUTPUT
$pythonCommand = Get-Command python -ErrorAction SilentlyContinue
echo $pythonCommand
$pythonCommand3 = Get-Command python3 -ErrorAction SilentlyContinue
echo $pythonCommand3
echo $env:PATH
if ($pythonCommand) {
$pythonVersion = python --version 2>&1
$versionPattern = 'Python (\d+)\.(\d+)\.(\d+)'
echo $pythonVersion
if ($pythonVersion -match $versionPattern) {
$major = [int]$matches[1]
$minor = [int]$matches[2]
if ($major -gt 3 -or ($major -eq 3 -and $minor -ge 10)) {
echo "python_exists=true" >> $GITHUB_OUTPUT
}
}
}
shell: pwsh

- name: aaa
if: matrix.os == 'windows-latest'
run: |
echo "path: " + $env:PATH
$pythonCommand = Get-Command python -ErrorAction SilentlyContinue
echo "cmd: " + $pythonCommand
$pythonCommand3 = Get-Command python3 -ErrorAction SilentlyContinue
echo "cmd3: " + $pythonCommand3
python3 -m pip install -r third_party/requirements.txt
shell: pwsh

- name: aaa2
if: matrix.os == 'windows-latest'
run: |
python3 -m pip install -r third_party/requirements.txt
shell: pwsh

- name: Initialize vcpkg
if: matrix.os == 'windows-latest'
uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5
Expand Down

0 comments on commit f7b51f0

Please sign in to comment.