Skip to content

Try compiling deps on win manually #4518

Try compiling deps on win manually

Try compiling deps on win manually #4518

Workflow file for this run

name: Windows
# Run CI only when a release is created, on changes to main branch, or any PR
# to main. Do not run CI on any other branch. Also, skip any non-source changes
# from running on CI
on:
push:
branches: main
paths-ignore:
- 'docs/**'
- 'examples/**'
- '.gitignore'
- '*.rst'
- '*.md'
- '.github/workflows/*.yml'
# re-include current file to not be excluded
- '!.github/workflows/build-windows.yml'
pull_request:
branches: main
paths-ignore:
- 'docs/**'
- 'examples/**'
- '.gitignore'
- '*.rst'
- '*.md'
- '.github/workflows/*.yml'
# re-include current file to not be excluded
- '!.github/workflows/build-windows.yml'
# the github release drafter can call this workflow
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-windows
cancel-in-progress: true
jobs:
deps:
name: ${{ matrix.name }} deps
runs-on: windows-latest
strategy:
matrix:
# make i686 deps and x86_64 deps
include:
- {
name: "64-bit",
winarch: x86_64,
msystem: MINGW64
}
- {
name: "32-bit",
winarch: i686,
msystem: MINGW32
}
steps:
- run: git config --global core.autocrlf input # do not introduce carriage returns
- uses: actions/[email protected]
- name: Test for Win Deps cache hit
id: windep-cache
uses: actions/[email protected]
with:
path: ${{ github.workspace }}/pygame_win_deps_${{ matrix.winarch }}
# The hash of all files in buildconfig manylinux-build and windependencies is
# the key to the cache. If anything changes here, the deps are built again
key: windep-${{ hashFiles('buildconfig/manylinux-build/**') }}-${{ hashFiles('buildconfig/windependencies/*.sh') }}-${{ matrix.winarch }}
lookup-only: true
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
install: >-
mingw-w64-${{ matrix.winarch }}-gcc
mingw-w64-${{ matrix.winarch }}-cmake
mingw-w64-${{ matrix.winarch }}-meson
mingw-w64-${{ matrix.winarch }}-autotools
mingw-w64-${{ matrix.winarch }}-nasm
mingw-w64-${{ matrix.winarch }}-python
mingw-w64-${{ matrix.winarch }}-python-setuptools
# build win deps on cache miss
- name: Build Win Deps
if: steps.windep-cache.outputs.cache-hit != 'true'
shell: msys2 {0}
run: |
export WIN_ARCH="${{ matrix.winarch }}"
cd buildconfig/windependencies
bash ./build_win_deps.sh
# Uncomment when you want to manually verify the deps by downloading them
- name: Upload win deps
uses: actions/upload-artifact@v3
with:
name: pygame-win-deps-${{ matrix.winarch }}
path: ${{ github.workspace }}/pygame_win_deps_${{ matrix.winarch }}
build:
name: ${{ matrix.winarch }}
needs: deps
runs-on: windows-latest
strategy:
fail-fast: false # if a particular matrix build fails, don't skip the rest
matrix:
include:
- { winarch: AMD64, msvc-dev-arch: x86_amd64 }
- { winarch: x86, msvc-dev-arch: x86 }
env:
CIBW_ARCHS: ${{ matrix.winarch }}
steps:
- uses: actions/[email protected]
- uses: TheMrMilchmann/setup-msvc-dev@v3 # this lets us use the developer command prompt on windows
with:
arch: ${{ matrix.msvc-dev-arch }}
- name: Install uv for speed
uses: yezz123/setup-uv@v4
with:
uv-version: "0.4.10"
- name: Build and test wheels
uses: pypa/[email protected]
- uses: actions/upload-artifact@v4
with:
name: pygame-wheels-windows-${{ matrix.winarch }}
path: ./wheelhouse/*.whl
compression-level: 0 # wheels are already zip files, no need for more compression