all: Enable features we use and disable stack check. #424
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: windows port | |
| on: | |
| push: | |
| pull_request: | |
| paths: | |
| - '.github/workflows/*.yml' | |
| - 'tools/**' | |
| - 'py/**' | |
| - 'extmod/**' | |
| - 'shared/**' | |
| - 'lib/**' | |
| - 'ports/unix/**' | |
| - 'ports/windows/**' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-vs: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: [x86, x64] | |
| configuration: [Debug, Release] | |
| variant: [dev, tns] | |
| visualstudio: ['2017', '2019', '2022'] | |
| include: | |
| - visualstudio: '2017' | |
| vs_version: '[15, 16)' | |
| custom_vs_install: true | |
| - visualstudio: '2019' | |
| vs_version: '[16, 17)' | |
| custom_vs_install: true | |
| - visualstudio: '2022' | |
| vs_version: '[17, 18)' | |
| # trim down the number of jobs in the matrix | |
| exclude: | |
| - variant: tns | |
| configuration: Debug | |
| - visualstudio: '2019' | |
| configuration: Debug | |
| runs-on: windows-latest | |
| env: | |
| CI_BUILD_CONFIGURATION: ${{ matrix.configuration }} | |
| steps: | |
| - name: Install Visual Studio ${{ matrix.visualstudio }} | |
| if: matrix.custom_vs_install | |
| shell: bash | |
| # Shell functions in this block are to retry intermittent corrupt | |
| # downloads (with a clean download dir) before failing the job outright | |
| run: | | |
| try () { ($@) || ($@) || ($@) || ($@) } | |
| clean_install () ( rm -rf $TEMP/chocolatey; choco install $1 ) | |
| try clean_install visualstudio${{ matrix.visualstudio }}buildtools | |
| try clean_install visualstudio${{ matrix.visualstudio }}-workload-vctools | |
| try clean_install windows-sdk-8.1 | |
| - uses: microsoft/setup-msbuild@v2 | |
| with: | |
| vs-version: ${{ matrix.vs_version }} | |
| - uses: actions/checkout@v5 | |
| - name: Build mpy-cross.exe | |
| run: msbuild mpy-cross\mpy-cross.vcxproj -maxcpucount -property:Configuration=${{ matrix.configuration }} -property:Platform=${{ matrix.platform }} | |
| - name: Update submodules | |
| run: msbuild ports\windows\micropython.vcxproj -target:UpdateSubmodules -property:Configuration=${{ matrix.configuration }} -property:Platform=${{ matrix.platform }} -property:PyVariant=${{ matrix.variant }} | |
| - name: Set custom build options | |
| shell: pwsh | |
| run: | | |
| @' | |
| <?xml version="1.0" encoding="utf-8"?> | |
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
| <ItemDefinitionGroup> | |
| <ClCompile> | |
| <!--To make the standard test suite pass.--> | |
| <PreprocessorDefinitions>%(PreprocessorDefinitions);MICROPY_STACK_CHECK=1</PreprocessorDefinitions> | |
| </ClCompile> | |
| </ItemDefinitionGroup> | |
| </Project> | |
| '@ | Set-Content ports\windows\msvc\user.props | |
| - name: Build micropython.dll | |
| run: msbuild ports\windows\micropythoncore.vcxproj -maxcpucount -property:Configuration=${{ matrix.configuration }} -property:Platform=${{ matrix.platform }} -property:PyVariant=${{ matrix.variant }} | |
| - 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, tns] | |
| sys: [mingw32, mingw64] | |
| include: | |
| - sys: mingw32 | |
| env: i686 | |
| - sys: mingw64 | |
| env: x86_64 | |
| runs-on: windows-latest | |
| env: | |
| CHERE_INVOKING: enabled_from_arguments | |
| defaults: | |
| run: | |
| shell: msys2 {0} | |
| steps: | |
| - uses: actions/setup-python@v6 | |
| # note: can go back to installing mingw-w64-${{ matrix.env }}-python after | |
| # MSYS2 updates to Python >3.12 (due to settrace compatibility issue) | |
| with: | |
| python-version: '3.11' | |
| - uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: ${{ matrix.sys }} | |
| update: true | |
| install: >- | |
| make | |
| mingw-w64-${{ matrix.env }}-gcc | |
| pkg-config | |
| git | |
| diffutils | |
| path-type: inherit # Remove when setup-python is removed | |
| - uses: actions/checkout@v5 | |
| - 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 }} CFLAGS_EXTRA="-DMICROPY_STACK_CHECK=1" | |
| - name: Run tests | |
| id: test | |
| run: 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@v5 | |
| - name: Install packages | |
| run: tools/ci.sh windows_setup | |
| - name: Build | |
| run: tools/ci.sh windows_build |