Ensure Start shortcuts and file associations use good working directory. #265
Workflow file for this run
This file contains hidden or 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: 'Build and Test' | |
on: [push, pull_request, workflow_dispatch] | |
env: | |
COVERAGE_CORE: sysmon | |
FORCE_COLOR: 1 | |
PIP_DISABLE_PIP_VERSION_CHECK: true | |
PIP_NO_INPUT: true | |
PIP_PROGRESS_BAR: off | |
PIP_REQUIRE_VIRTUALENV: false | |
PIP_VERBOSE: true | |
PYMSBUILD_VERBOSE: true | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Remove existing PyManager install' | |
run: | | |
# Ensure we aren't currently installed | |
$msix = Get-AppxPackage PythonSoftwareFoundation.PythonManager -EA SilentlyContinue | |
if ($msix) { | |
"Removing $($msix.Name)" | |
Remove-AppxPackage $msix | |
} | |
shell: powershell | |
#- name: Set up Python 3.14 | |
# uses: actions/setup-python@v5 | |
# with: | |
# python-version: 3.14-dev | |
# We move faster than GitHub's Python runtimes, so use NuGet instead | |
# One day we can use ourselves to download Python, but not yet... | |
- name: Set up NuGet | |
uses: nuget/[email protected] | |
- name: Set up Python 3.14.0b2 | |
run: | | |
nuget install python -Version 3.14.0-b2 -x -o . | |
$py = Get-Item python\tools | |
Write-Host "Adding $py to PATH" | |
"$py" | Out-File $env:GITHUB_PATH -Encoding UTF8 -Append | |
working-directory: ${{ runner.temp }} | |
- name: Check Python version is 3.14.0b2 | |
run: > | |
python -c "import sys; | |
print(sys.version); | |
print(sys.executable); | |
sys.exit(0 if sys.version_info[:5] == (3, 14, 0, 'beta', 2) else 1)" | |
- name: Install build dependencies | |
run: python -m pip install "pymsbuild>=1.2.0b1" | |
- name: 'Install test runner' | |
run: python -m pip install pytest pytest-cov | |
- name: 'Build test module' | |
run: python -m pymsbuild -c _msbuild_test.py | |
- name: 'Run pre-test' | |
shell: bash | |
run: | | |
python -m pytest -vv \ | |
--cov src \ | |
--cov tests \ | |
--cov-report term \ | |
--cov-report xml | |
- name: 'Upload coverage' | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_ORG_TOKEN }} | |
- name: 'Build package' | |
run: python make.py | |
env: | |
PYMSBUILD_TEMP_DIR: ${{ runner.temp }}/bin | |
PYMSBUILD_DIST_DIR: ${{ runner.temp }}/dist | |
PYMSBUILD_LAYOUT_DIR: ${{ runner.temp }}/layout | |
TEST_MSIX_DIR: ${{ runner.temp }}/test_msix | |
- name: 'Build MSIX package' | |
run: python make-msix.py | |
env: | |
PYMSBUILD_TEMP_DIR: ${{ runner.temp }}/bin | |
PYMSBUILD_DIST_DIR: ${{ runner.temp }}/dist | |
PYMSBUILD_LAYOUT_DIR: ${{ runner.temp }}/layout | |
TEST_MSIX_DIR: ${{ runner.temp }}/test_msix | |
- name: 'Build MSI package' | |
run: python make-msi.py | |
env: | |
PYMSBUILD_TEMP_DIR: ${{ runner.temp }}/bin | |
PYMSBUILD_DIST_DIR: ${{ runner.temp }}/dist | |
PYMSBUILD_LAYOUT_DIR: ${{ runner.temp }}/layout | |
TEST_MSIX_DIR: ${{ runner.temp }}/test_msix | |
- name: 'Register unsigned MSIX' | |
run: | | |
$msix = dir "${env:PYMSBUILD_DIST_DIR}\*.msix" ` | |
| ?{ -not ($_.BaseName -match '.+-store') } ` | |
| select -first 1 | |
cp $msix "${msix}.zip" | |
Expand-Archive "${msix}.zip" (mkdir -Force $env:TEST_MSIX_DIR) | |
Add-AppxPackage -Register "${env:TEST_MSIX_DIR}\appxmanifest.xml" | |
Get-AppxPackage PythonSoftwareFoundation.PythonManager | |
env: | |
PYMSBUILD_TEMP_DIR: ${{ runner.temp }}/bin | |
PYMSBUILD_DIST_DIR: ${{ runner.temp }}/dist | |
PYMSBUILD_LAYOUT_DIR: ${{ runner.temp }}/layout | |
TEST_MSIX_DIR: ${{ runner.temp }}/test_msix | |
shell: powershell | |
- name: 'Ensure global commands are present' | |
run: | | |
gcm pymanager | |
gcm pywmanager | |
# These are likely present due to the machine configuration, | |
# but we'll check for them anyway. | |
gcm py | |
gcm python | |
gcm pyw | |
gcm pythonw | |
- name: 'Show help output' | |
run: pymanager | |
- name: 'Install default runtime' | |
run: pymanager install default | |
env: | |
PYMANAGER_DEBUG: true | |
- name: 'List installed runtimes' | |
run: pymanager list | |
env: | |
PYMANAGER_DEBUG: true | |
- name: 'List installed runtimes (legacy)' | |
run: pymanager --list-paths | |
env: | |
PYMANAGER_DEBUG: true | |
- name: 'Launch default runtime' | |
run: pymanager exec -m site | |
env: | |
PYMANAGER_DEBUG: true | |
- name: 'Uninstall runtime' | |
run: pymanager uninstall -y default | |
env: | |
PYMANAGER_DEBUG: true | |
- name: 'Emulate first launch' | |
run: | | |
$i = (mkdir -force test_installs) | |
ConvertTo-Json @{ | |
install_dir="$i"; | |
download_dir="$i\_cache"; | |
global_dir="$i\_bin"; | |
} | Out-File $env:PYTHON_MANAGER_CONFIG -Encoding utf8 | |
pymanager install --configure -y | |
if ($?) { pymanager list } | |
env: | |
PYTHON_MANAGER_INCLUDE_UNMANAGED: false | |
PYTHON_MANAGER_CONFIG: .\test-config.json | |
PYMANAGER_DEBUG: true | |
- name: 'Offline bundle download and install' | |
run: | | |
pymanager list --online 3 3-32 3-64 3-arm64 | |
pymanager install --download .\bundle 3 3-32 3-64 3-arm64 | |
pymanager list --source .\bundle | |
pymanager install --source .\bundle 3 3-32 3-64 3-arm64 | |
env: | |
PYMANAGER_DEBUG: true | |
- name: 'Remove MSIX' | |
run: | | |
Get-AppxPackage PythonSoftwareFoundation.PythonManager | Remove-AppxPackage | |
shell: powershell |