diff --git a/.appveyor.yml b/.appveyor.yml index 2a641490520e..b394f5f975a9 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -91,7 +91,7 @@ artifacts: on_finish: - micromamba install codecov - - codecov -e PYTHON_VERSION PLATFORM -n "$PYTHON_VERSION Windows" + - codecov -e PYTHON_VERSION PLATFORM -n "%PYTHON_VERSION% Windows" on_failure: # Generate a html for visual tests diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5608cade2aa0..9692e0e9a7c7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -139,7 +139,6 @@ jobs: ccache \ cm-super \ dvipng \ - ffmpeg \ fonts-freefont-otf \ fonts-noto-cjk \ fonts-wqy-zenhei \ @@ -174,6 +173,9 @@ jobs: texlive-luatex \ texlive-pictures \ texlive-xetex + if [[ "${{ matrix.name-suffix }}" != '(Minimum Versions)' ]]; then + sudo apt-get install -yy --no-install-recommends ffmpeg poppler-utils + fi if [[ "${{ matrix.os }}" = ubuntu-20.04 ]]; then sudo apt-get install -yy --no-install-recommends libopengl0 else # ubuntu-22.04 @@ -196,8 +198,8 @@ jobs: done # Workaround for https://github.com/actions/runner-images/issues/10984 brew uninstall --ignore-dependencies --force pkg-config@0.29.2 - brew install ccache ghostscript gobject-introspection gtk4 ninja - brew install --cask font-noto-sans-cjk inkscape + brew install ccache ffmpeg ghostscript gobject-introspection gtk4 imagemagick ninja + brew install --cask font-noto-sans-cjk font-noto-sans-cjk-sc inkscape ;; esac diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0c891fe42fef..eed605cd32b6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -49,18 +49,6 @@ stages: - job: Pytest strategy: matrix: - Linux_py310: - vmImage: 'ubuntu-20.04' # keep one job pinned to the oldest image - python.version: '3.10' - Linux_py311: - vmImage: 'ubuntu-latest' - python.version: '3.11' - macOS_py310: - vmImage: 'macOS-latest' - python.version: '3.10' - macOS_py311: - vmImage: 'macOS-latest' - python.version: '3.11' Windows_py310: vmImage: 'windows-2019' # keep one job pinned to the oldest image python.version: '3.10' @@ -78,63 +66,7 @@ stages: displayName: 'Use Python $(python.version)' - bash: | - set -e - case "$AGENT_OS" in - Linux) - echo 'Acquire::Retries "3";' | sudo tee /etc/apt/apt.conf.d/80-retries - sudo apt update - sudo apt install --no-install-recommends \ - cm-super \ - dvipng \ - ffmpeg \ - fonts-freefont-otf \ - fonts-noto-cjk \ - fonts-wqy-zenhei \ - gdb \ - gir1.2-gtk-3.0 \ - graphviz \ - inkscape \ - language-pack-de \ - lcov \ - libcairo2 \ - libgirepository-1.0-1 \ - lmodern \ - ninja-build \ - poppler-utils \ - texlive-fonts-recommended \ - texlive-latex-base \ - texlive-latex-extra \ - texlive-latex-recommended \ - texlive-luatex \ - texlive-pictures \ - texlive-xetex - ;; - Darwin) - brew update - # Periodically, Homebrew updates Python and fails to overwrite the - # existing not-managed-by-Homebrew copy without explicitly being told - # to do so. GitHub/Azure continues to avoid fixing their runner images: - # https://github.com/actions/runner-images/issues/9966 - # so force an overwrite even if there are no Python updates. - # We don't even care about Homebrew's Python because we use the one - # from UsePythonVersion. - for python_package in $(brew list | grep python@); do - brew unlink ${python_package} - brew link --overwrite ${python_package} - done - # Workaround for https://github.com/actions/runner-images/issues/10984 - brew uninstall --ignore-dependencies --force pkg-config@0.29.2 - brew install --cask xquartz - brew install ccache ffmpeg imagemagick mplayer ninja pkg-config - brew install --cask font-noto-sans-cjk-sc - ;; - Windows_NT) - choco install ninja - ;; - *) - exit 1 - ;; - esac + choco install ninja displayName: 'Install dependencies' - bash: | @@ -144,23 +76,9 @@ stages: displayName: 'Install dependencies with pip' - bash: | - case "$AGENT_OS" in - Linux) - export CPPFLAGS='--coverage -fprofile-abs-path' - ;; - Darwin) - export CPPFLAGS='-fprofile-instr-generate=default.%m.profraw' - export CPPFLAGS="$CPPFLAGS -fcoverage-mapping" - ;; - Windows_NT) - CONFIG='--config-settings=setup-args=--vsenv' - CONFIG="$CONFIG --config-settings=setup-args=-Dcpp_link_args=-PROFILE" - CONFIG="$CONFIG --config-settings=setup-args=-Dbuildtype=debug" - ;; - *) - exit 1 - ;; - esac + CONFIG='--config-settings=setup-args=--vsenv' + CONFIG="$CONFIG --config-settings=setup-args=-Dcpp_link_args=-PROFILE" + CONFIG="$CONFIG --config-settings=setup-args=-Dbuildtype=debug" python -m pip install \ --no-build-isolation $CONFIG \ @@ -175,39 +93,38 @@ stages: - bash: | set -e - if [[ "$AGENT_OS" == 'Windows_NT' ]]; then - SESSION_ID=$(python -c "import uuid; print(uuid.uuid4(), end='')") - echo "Coverage session ID: ${SESSION_ID}" - VS=$(ls -d /c/Program\ Files*/Microsoft\ Visual\ Studio/*/Enterprise) - echo "Visual Studio: ${VS}" - DIR="$VS/Common7/IDE/Extensions/Microsoft/CodeCoverage.Console" - if [[ -d $DIR ]]; then - # This is for MSVC 2022 (on windows-latest). - TOOL="$DIR/Microsoft.CodeCoverage.Console.exe" - for f in build/cp*/src/*.pyd; do - echo $f - echo "==============================" - "$TOOL" instrument $f --session-id $SESSION_ID \ - --log-level Verbose --log-file instrument.log - cat instrument.log - rm instrument.log - done - echo "Starting $TOOL in server mode" - "$TOOL" collect \ - --session-id $SESSION_ID --server-mode \ - --output-format cobertura --output extensions.xml \ - --log-level Verbose --log-file extensions.log & - VS_VER=2022 - else - DIR="$VS"/Team\ Tools/Dynamic\ Code\ Coverage\ Tools/amd64 - if [[ -d $DIR ]]; then - # This is for MSVC 2019 (on windows-2019). - VSINSTR="$VS"/Team\ Tools/Performance\ Tools/vsinstr.exe - for f in build/cp*/src/*.pyd; do - "$VSINSTR" $f -Verbose -Coverage - done - TOOL="$DIR/CodeCoverage.exe" - cat > extensions.config << EOF + SESSION_ID=$(python -c "import uuid; print(uuid.uuid4(), end='')") + echo "Coverage session ID: ${SESSION_ID}" + VS=$(ls -d /c/Program\ Files*/Microsoft\ Visual\ Studio/*/Enterprise) + echo "Visual Studio: ${VS}" + DIR="$VS/Common7/IDE/Extensions/Microsoft/CodeCoverage.Console" + if [[ -d $DIR ]]; then + # This is for MSVC 2022 (on windows-latest). + TOOL="$DIR/Microsoft.CodeCoverage.Console.exe" + for f in build/cp*/src/*.pyd; do + echo $f + echo "==============================" + "$TOOL" instrument $f --session-id $SESSION_ID \ + --log-level Verbose --log-file instrument.log + cat instrument.log + rm instrument.log + done + echo "Starting $TOOL in server mode" + "$TOOL" collect \ + --session-id $SESSION_ID --server-mode \ + --output-format cobertura --output extensions.xml \ + --log-level Verbose --log-file extensions.log & + VS_VER=2022 + else + DIR="$VS"/Team\ Tools/Dynamic\ Code\ Coverage\ Tools/amd64 + if [[ -d $DIR ]]; then + # This is for MSVC 2019 (on windows-2019). + VSINSTR="$VS"/Team\ Tools/Performance\ Tools/vsinstr.exe + for f in build/cp*/src/*.pyd; do + "$VSINSTR" $f -Verbose -Coverage + done + TOOL="$DIR/CodeCoverage.exe" + cat > extensions.config << EOF true @@ -217,60 +134,38 @@ stages: EOF - echo "Starting $TOOL in server mode" - "$TOOL" collect \ - -config:extensions.config -session:$SESSION_ID \ - -output:extensions.coverage -verbose & - echo "Started $TOOL" - VS_VER=2019 - fi - fi - echo "##vso[task.setvariable variable=VS_COVERAGE_TOOL]$TOOL" + echo "Starting $TOOL in server mode" + "$TOOL" collect \ + -config:extensions.config -session:$SESSION_ID \ + -output:extensions.coverage -verbose & + echo "Started $TOOL" + VS_VER=2019 + fi fi + echo "##vso[task.setvariable variable=VS_COVERAGE_TOOL]$TOOL" + PYTHONFAULTHANDLER=1 pytest -rfEsXR -n 2 \ --maxfail=50 --timeout=300 --durations=25 \ --junitxml=junit/test-results.xml --cov-report=xml --cov=lib - if [[ -n $SESSION_ID ]]; then - if [[ $VS_VER == 2022 ]]; then - "$TOOL" shutdown $SESSION_ID - echo "Coverage collection log" - echo "=======================" - cat extensions.log - else - "$TOOL" shutdown -session:$SESSION_ID - fi + + if [[ $VS_VER == 2022 ]]; then + "$TOOL" shutdown $SESSION_ID + echo "Coverage collection log" + echo "=======================" + cat extensions.log + else + "$TOOL" shutdown -session:$SESSION_ID fi displayName: 'pytest' - bash: | - case "$AGENT_OS" in - Linux) - lcov --rc lcov_branch_coverage=1 --capture --directory . \ - --output-file coverage.info - lcov --rc lcov_branch_coverage=1 --output-file coverage.info \ - --extract coverage.info $PWD/src/'*' $PWD/lib/'*' - lcov --rc lcov_branch_coverage=1 --list coverage.info - find . -name '*.gc*' -delete - ;; - Darwin) - xcrun llvm-profdata merge -sparse default.*.profraw \ - -o default.profdata - xcrun llvm-cov export -format="lcov" build/*/src/*.so \ - -instr-profile default.profdata > info.lcov - ;; - Windows_NT) - if [[ -f extensions.coverage ]]; then - # For MSVC 2019. - "$VS_COVERAGE_TOOL" analyze -output:extensions.xml \ - -include_skipped_functions -include_skipped_modules \ - extensions.coverage - rm extensions.coverage - fi - ;; - *) - exit 1 - ;; - esac + if [[ -f extensions.coverage ]]; then + # For MSVC 2019. + "$VS_COVERAGE_TOOL" analyze -output:extensions.xml \ + -include_skipped_functions -include_skipped_modules \ + extensions.coverage + rm extensions.coverage + fi displayName: 'Filter C coverage' condition: succeededOrFailed() - bash: |