diff --git a/.github/workflows/ports_windows.yml b/.github/workflows/ports_windows.yml index 4b1f4ea791e2..6858a146c42d 100644 --- a/.github/workflows/ports_windows.yml +++ b/.github/workflows/ports_windows.yml @@ -18,7 +18,132 @@ concurrency: cancel-in-progress: true jobs: - build: + build-vs: + strategy: + fail-fast: false + matrix: + platform: [x86, x64] + configuration: [Debug, Release] + variant: [dev, standard] + visualstudio: ['2017', '2019', '2022'] + include: + - visualstudio: '2017' + runner: windows-latest + vs_version: '[15, 16)' + - visualstudio: '2019' + runner: windows-2019 + vs_version: '[16, 17)' + - visualstudio: '2022' + runner: windows-2022 + vs_version: '[17, 18)' + # trim down the number of jobs in the matrix + exclude: + - variant: standard + configuration: Debug + - visualstudio: '2019' + configuration: Debug + runs-on: ${{ matrix.runner }} + steps: + - name: Install Visual Studio 2017 + if: matrix.visualstudio == '2017' + run: | + choco install visualstudio2017buildtools + choco install visualstudio2017-workload-vctools + choco install windows-sdk-8.1 + - uses: microsoft/setup-msbuild@v1 + with: + vs-version: ${{ matrix.vs_version }} + - uses: actions/setup-python@v4 + if: matrix.runner == 'windows-2019' + with: + python-version: '3.9' + - uses: actions/checkout@v3 + - name: Build mpy-cross.exe + run: msbuild mpy-cross\mpy-cross.vcxproj -maxcpucount -property:Configuration=${{ matrix.configuration }} -property:Platform=${{ matrix.platform }} + - name: Build micropython.exe + run: msbuild ports\windows\micropython.vcxproj -maxcpucount -property:Configuration=${{ matrix.configuration }} -property:Platform=${{ matrix.platform }} -property:PyVariant=${{ matrix.variant }} + - name: Get micropython.exe path + id: get_path + run: | + $exePath="$(msbuild ports\windows\micropython.vcxproj -nologo -v:m -t:ShowTargetPath -property:Configuration=${{ matrix.configuration }} -property:Platform=${{ matrix.platform }} -property:PyVariant=${{ matrix.variant }})" + echo ("micropython=" + $exePath.Trim()) >> $env:GITHUB_OUTPUT + - name: Run tests + id: test + env: + MICROPY_MICROPYTHON: ${{ steps.get_path.outputs.micropython }} + working-directory: tests + run: python run-tests.py + - name: Print failures + if: failure() && steps.test.conclusion == 'failure' + working-directory: tests + run: python run-tests.py --print-failures + - name: Run mpy tests + id: test_mpy + env: + MICROPY_MICROPYTHON: ${{ steps.get_path.outputs.micropython }} + working-directory: tests + run: python run-tests.py --via-mpy -d basics float micropython + - name: Print mpy failures + if: failure() && steps.test_mpy.conclusion == 'failure' + working-directory: tests + run: python run-tests.py --print-failures + + build-mingw: + strategy: + fail-fast: false + matrix: + variant: [dev, standard] + sys: [mingw32, mingw64] + include: + - sys: mingw32 + env: i686 + - sys: mingw64 + env: x86_64 + runs-on: windows-2022 + env: + CHERE_INVOKING: enabled_from_arguments + defaults: + run: + shell: msys2 {0} + steps: + - name: Get Python path + id: python_path + shell: python + run: | + import os + import sys + output = f"python={os.fspath(sys.executable)}" + print(output) + with open(os.environ["GITHUB_OUTPUT"], "w") as f: + f.write(output) + - uses: msys2/setup-msys2@v2 + with: + msystem: ${{ matrix.sys }} + update: true + install: >- + make + mingw-w64-${{ matrix.env }}-gcc + pkg-config + python3 + git + diffutils + - uses: actions/checkout@v3 + - name: Build mpy-cross.exe + run: make -C mpy-cross -j2 + - name: Update submodules + run: make -C ports/windows VARIANT=${{ matrix.variant }} submodules + - name: Build micropython.exe + run: make -C ports/windows -j2 VARIANT=${{ matrix.variant }} + - name: Run tests + id: test + # msys python breaks tests so we need to use "real" windows python + run: MICROPY_CPYTHON3=$(cygpath "${{ steps.python_path.outputs.python }}") make -C ports/windows test_full VARIANT=${{ matrix.variant }} + - name: Print failures + if: failure() && steps.test.conclusion == 'failure' + working-directory: tests + run: python run-tests.py --print-failures + + cross-build-on-linux: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/ports/windows/.appveyor.yml b/ports/windows/.appveyor.yml deleted file mode 100644 index c1a114a0f897..000000000000 --- a/ports/windows/.appveyor.yml +++ /dev/null @@ -1,90 +0,0 @@ -image: Visual Studio 2017 -clone_depth: 1 -skip_tags: true - -environment: - # Python version used - MICROPY_CPYTHON3: c:/python38/python.exe - # The variants. - matrix: - - PyVariant: dev - - PyVariant: standard - -init: - # Set build version number to commit to be travis-like -- ps: Update-AppveyorBuild -Version $env:appveyor_repo_commit.substring(0,8) - -configuration: -- Debug -- Release - -platform: -- x86 -- x64 - -matrix: - # One debug build is enough. - exclude: - - configuration: Debug - PyVariant: dev - -before_build: -- ps: | - @" - - - - - - - "@ | Set-Content build.proj - -build: - project: build.proj - parallel: true - verbosity: normal - -test_script: -- ps: | - $env:MICROPY_MICROPYTHON=(msbuild ports\windows\micropython.vcxproj /nologo /v:m /t:ShowTargetPath).Trim() - cd (Join-Path $env:APPVEYOR_BUILD_FOLDER 'tests') - & $env:MICROPY_CPYTHON3 run-tests.py - if ($LASTEXITCODE -ne 0) { - & $env:MICROPY_CPYTHON3 run-tests.py --print-failures - throw "Test failure" - } - & $env:MICROPY_CPYTHON3 run-tests.py --via-mpy -d basics float micropython - if ($LASTEXITCODE -ne 0) { - & $env:MICROPY_CPYTHON3 run-tests.py --print-failures - throw "Test failure" - } - -# After the build/test phase for the MSVC build completes, -# build and test with mingw-w64, release versions only. -after_test: -- ps: | - if ($env:configuration -eq 'Debug') { - return - } - $env:MSYSTEM = if ($platform -eq 'x86') {'MINGW32'} else {'MINGW64'} - $env:CHERE_INVOKING = 'enabled_from_arguments' - cd (Join-Path $env:APPVEYOR_BUILD_FOLDER 'mpy-cross') - C:\msys64\usr\bin\bash.exe -l -c "make -B -j4 V=1" - if ($LASTEXITCODE -ne 0) { - throw "$env:MSYSTEM mpy_cross build exited with code $LASTEXITCODE" - } - cd (Join-Path $env:APPVEYOR_BUILD_FOLDER 'ports/windows') - C:\msys64\usr\bin\bash.exe -l -c "make -B VARIANT=$($env:PyVariant) submodules" - if ($LASTEXITCODE -ne 0) { - throw "$env:MSYSTEM build exited with code $LASTEXITCODE" - } - C:\msys64\usr\bin\bash.exe -l -c "make -B -j4 V=1 MICROPY_MPYCROSS=../../mpy-cross/build/mpy-cross.exe VARIANT=$($env:PyVariant)" - if ($LASTEXITCODE -ne 0) { - throw "$env:MSYSTEM build exited with code $LASTEXITCODE" - } - C:\msys64\usr\bin\bash.exe -l -c "make V=1 test_full VARIANT=$($env:PyVariant)" - if ($LASTEXITCODE -ne 0) { - cd (Join-Path $env:APPVEYOR_BUILD_FOLDER 'tests') - & $env:MICROPY_CPYTHON3 run-tests.py --print-failures - throw "Test failure" - } diff --git a/tests/run-tests.py b/tests/run-tests.py index ecd49a7d75fe..c912f9d5424d 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -532,6 +532,14 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): if os.getenv("GITHUB_ACTIONS") == "true": skip_tests.add("thread/stress_schedule.py") # has reliability issues + if os.getenv("RUNNER_OS") == "Windows": + # fails with stack overflow on Debug builds + skip_tests.add("misc/sys_settrace_features.py") + + if os.getenv("MSYSTEM") is not None: + # fails due to wrong path separator + skip_tests.add("import/import_file.py") + if upy_float_precision == 0: skip_tests.add("extmod/uctypes_le_float.py") skip_tests.add("extmod/uctypes_native_float.py")