diff --git a/.github/workflows/build-debian-multiarch.yml b/.github/workflows/build-debian-multiarch.yml index 8e60e6b160..24bb5d41e7 100644 --- a/.github/workflows/build-debian-multiarch.yml +++ b/.github/workflows/build-debian-multiarch.yml @@ -96,13 +96,11 @@ jobs: install: ${{ env.INSTALL_CMD }} # Build a wheel, install it for running unit tests. - # --no-build-isolation is passed so that preinstalled meson-python can be used - # (done for optimization reasons) + # pip does not know that ninja is installed, and tries to install it again. + # so pass --ignore-dep ninja explicitly run: | - echo "\nBuilding pygame wheel\n" - pip3 wheel . --no-build-isolation --wheel-dir /artifacts -vvv - echo "\nInstalling wheel\n" - pip3 install --no-index --pre --break-system-packages --find-links /artifacts pygame-ce + echo "\nBuilding and installing pygame wheel\n" + PIP_BREAK_SYSTEM_PACKAGES=1 python3 dev.py --ignore-dep ninja build --wheel /artifacts --lax echo "\nRunning tests\n" export SDL_VIDEODRIVER=dummy export SDL_AUDIODRIVER=disk diff --git a/.github/workflows/build-on-msys2.yml b/.github/workflows/build-on-msys2.yml index 315e7c41f1..299cb220e5 100644 --- a/.github/workflows/build-on-msys2.yml +++ b/.github/workflows/build-on-msys2.yml @@ -69,12 +69,10 @@ jobs: # mingw-w64-${{ matrix.env }}-freetype # mingw-w64-${{ matrix.env }}-portmidi - - name: Building pygame wheel - run: | - pip3 wheel . --wheel-dir /artifacts -vvv --no-build-isolation - - - name: Installing wheel - run: pip3 install --no-index --pre --find-links /artifacts pygame-ce + # pip does not know that ninja is installed, and tries to install it again. + # so pass --ignore-dep ninja explicitly + - name: Build and install pygame wheel + run: python3 dev.py --ignore-dep ninja build --wheel /artifacts --lax - name: Run tests env: diff --git a/.github/workflows/build-sdl3.yml b/.github/workflows/build-sdl3.yml index cb2c555f04..4333047047 100644 --- a/.github/workflows/build-sdl3.yml +++ b/.github/workflows/build-sdl3.yml @@ -74,12 +74,8 @@ jobs: cmake --build . --config Release --parallel sudo cmake --install . --config Release - - name: Make sdist and install it - run: > - python3 -m pip install . -v -Csetup-args=-Dsdl_api=3 - -Csetup-args=-Dimage=disabled - -Csetup-args=-Dmixer=disabled - -Csetup-args=-Dfont=disabled + - name: Build with SDL3 + run: python3 dev.py build --sdl3 # - name: Run tests # env: diff --git a/.github/workflows/build-ubuntu-coverage.yml b/.github/workflows/build-ubuntu-coverage.yml index 5999252842..bb7274c988 100644 --- a/.github/workflows/build-ubuntu-coverage.yml +++ b/.github/workflows/build-ubuntu-coverage.yml @@ -61,22 +61,17 @@ jobs: - uses: actions/checkout@v4.2.1 - name: Install deps - # install numpy from pip and not apt because the one from pip is newer, - # and has typestubs # https://github.com/actions/runner-images/issues/7192 # https://github.com/orgs/community/discussions/47863 run: | sudo apt-get update --fix-missing sudo apt-get install lcov -y sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libfreetype6-dev libportmidi-dev python3-dev -y - pip3 install --upgrade pip - pip3 install meson-python ninja cython "sphinx<=7.2.6" # because we are doing --no-build-isolation - pip3 install numpy>=1.21.0 - name: Build with coverage hooks and install id: build run: | - pip3 install -e . --no-build-isolation -Cbuild-dir=./.mesonpy-rel -Csetup-args=-Dcoverage=true + python3 dev.py build --coverage - name: Run tests env: diff --git a/.github/workflows/build-ubuntu-sdist.yml b/.github/workflows/build-ubuntu-sdist.yml index d7382a34bb..80a1523981 100644 --- a/.github/workflows/build-ubuntu-sdist.yml +++ b/.github/workflows/build-ubuntu-sdist.yml @@ -48,7 +48,7 @@ jobs: strategy: fail-fast: false # if a particular matrix build fails, don't skip the rest matrix: - os: [ubuntu-24.04, ubuntu-22.04] + os: [ubuntu-22.04] env: # Pip now forces us to either make a venv or set this flag, so we will do @@ -89,7 +89,6 @@ jobs: # We upload the generated files under github actions assets - name: Upload sdist - if: matrix.os == 'ubuntu-24.04' # upload sdist only once uses: actions/upload-artifact@v4 with: name: pygame-wheels-sdist diff --git a/.github/workflows/dev-check.yml b/.github/workflows/dev-check.yml new file mode 100644 index 0000000000..cfcbb9f714 --- /dev/null +++ b/.github/workflows/dev-check.yml @@ -0,0 +1,42 @@ +name: python3 dev.py all + +# Run CI on changes to main branch, or any PR to main. Do not run CI on +# any other branch. +# Run on changes to all files. +on: + push: + branches: main + + pull_request: + branches: main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-dev-check + cancel-in-progress: true + +jobs: + dev-check: + runs-on: ubuntu-24.04 + + env: + # Pip now forces us to either make a venv or set this flag, so we will do + # this + PIP_BREAK_SYSTEM_PACKAGES: 1 + + # We are using dependencies installed from apt + PG_DEPS_FROM_SYSTEM: 1 + + # environment variables to set while testing + SDL_VIDEODRIVER: "dummy" + SDL_AUDIODRIVER: "disk" + + steps: + - uses: actions/checkout@v4.2.1 + + - name: Install deps + run: | + sudo apt-get update --fix-missing + sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libfreetype6-dev libportmidi-dev python3-dev + + - name: Check dev.py all + run: python3 dev.py all diff --git a/.github/workflows/format-lint.yml b/.github/workflows/format-lint.yml deleted file mode 100644 index 99016b7dde..0000000000 --- a/.github/workflows/format-lint.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: python3 setup.py lint - -# Run lint CI on changes to main branch, or any PR to main. Do not run CI on -# any other branch. -# Run only if there are changes on files that are linted (C, Python and rst files) -on: - push: - branches: main - paths: - - '**.h' - - '**.c' - - '**.py' - - '**.rst' - - '.pre-commit-config.yaml' - - pull_request: - branches: main - paths: - - '**.h' - - '**.c' - - '**.py' - - '**.rst' - - '.pre-commit-config.yaml' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-format-lint - cancel-in-progress: true - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.2.1 - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - uses: pre-commit/action@v3.0.1 - - format-lint-code-check: - runs-on: ubuntu-24.04 - - env: - # Pip now forces us to either make a venv or set this flag, so we will do - # this - PIP_BREAK_SYSTEM_PACKAGES: 1 - - steps: - - uses: actions/checkout@v4.2.1 - - - name: Install deps - run: python3 -m pip install pylint sphinx"<7.2.0" - - - name: Check code linting - run: pylint src_py docs - - - name: Check docs changes are checked in - run: | - python3 buildconfig/make_docs.py - if [[ `git status --porcelain` ]]; then - echo "Generating docs caused changes. Please check them in." - echo "You may need to run: python3 buildconfig/make_docs.py full_generation" - # Run git status again, so people can see what changed. - git status --porcelain - exit 1 - fi diff --git a/docs/README.md b/docs/README.md index 349849b658..337938d68e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -9,9 +9,8 @@ but the documentation can also be launched with `python -m pygame.docs` Steps: -- Install Sphinx (`pip install Sphinx`) - Fork the pygame-ce repository, download and navigate to it in the terminal -- Run `python -m buildconfig docs` +- Run `python dev.py docs` - If you are using the legacy `python setup.py docs` (which is now deprecated): - (Run `python -m pip install -U pip setuptools` first if `ModuleNotFoundError: No module named setuptools` occurs) @@ -30,7 +29,7 @@ is useful when editing the theme CSS. --- **INSTEAD USE** --- -There is also `python -m buildconfig docs full_generation` for regenerating +There is also `python dev.py docs --full` for regenerating everything regardless of whether Sphinx thinks it should be regenerated. This is useful when editing the theme CSS. diff --git a/setup.py b/setup.py index 47648be978..cbad740727 100644 --- a/setup.py +++ b/setup.py @@ -807,11 +807,9 @@ def run(self): runs Sphinx to build the docs. ''' import subprocess - command_line = [ - sys.executable, "-m", "buildconfig", "docs" - ] + command_line = [sys.executable, "dev.py", "docs"] if self.fullgeneration: - command_line.append('full_generation') + command_line.append('--full') print("WARNING: This command is deprecated and will be removed in the future.") print(f"Please use the following replacement: `{' '.join(command_line)}`\n") @@ -834,9 +832,7 @@ def run(self): runs mypy to build the docs. ''' import subprocess - command_line = [ - sys.executable, os.path.join("buildconfig", "stubs", "stubcheck.py") - ] + command_line = [sys.executable, "dev.py", "stubs"] print("WARNING: This command is deprecated and will be removed in the future.") print(f"Please use the following replacement: `{' '.join(command_line)}`\n") result = subprocess.run(command_line)