GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — RustPython/.github/workflows/ci.yaml at main · RustPython/RustPython 1289 lines (1162 loc) · 45.8 KB / Copy pathci.yamlFile metadata and controls1289 lines (1162 loc) · 45.8 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 on: push: branches: [main, release] pull_request: types: [unlabeled, opened, synchronize, reopened] merge_group: workflow_dispatch: name: CI permissions: contents: read # Cancel previous workflows if they are the same workflow on same ref (branch/tags) # with the same event (push/pull_request) even they are in progress. # This setting will help reduce the number of duplicated workflows. concurrency: group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: true env: CARGO_ARGS: --no-default-features --features stdlib,importlib,stdio,encodings,sqlite,ssl-rustls-aws-lc,host_env,doc,ucd_3_2_0 CARGO_ARGS_NO_SSL: --no-default-features --features stdlib,importlib,stdio,encodings,sqlite,host_env,doc,ucd_3_2_0 CARGO_ARGS_MOST_FEATS: --features capi,encodings,jit,sqlite,threading # Crates excluded from workspace builds: # - rustpython_wasm: requires wasm target # - rustpython-venvlauncher: Windows-only WORKSPACE_EXCLUDES: --exclude rustpython_wasm --exclude rustpython-venvlauncher X86_64_PC_WINDOWS_MSVC_OPENSSL_LIB_DIR: C:\Program Files\OpenSSL\lib\VC\x64\MD X86_64_PC_WINDOWS_MSVC_OPENSSL_INCLUDE_DIR: C:\Program Files\OpenSSL\include CARGO_INCREMENTAL: 0 CARGO_PROFILE_TEST_DEBUG: 0 CARGO_PROFILE_DEV_DEBUG: 0 CARGO_PROFILE_RELEASE_DEBUG: 0 CARGO_TERM_COLOR: always CI: true FORCE_COLOR: 1 jobs: determine_changes: name: Determine changes runs-on: ubuntu-slim outputs: # Flag that is raised when any rust code is changed. rust_code: ${{ steps.check_rust_code.outputs.changed }} update_lib: ${{ steps.check_update_lib.outputs.changed }} # WASM demo / notebook / example_projects, independent of rust_code. wasm_code: ${{ steps.check_wasm_code.outputs.changed }} # Cross-target cargo check is skipped unless the diff can change # platform-specific compilation. Force with the run:cross-check label. cross_target: ${{ steps.check_cross_target.outputs.changed }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 persist-credentials: false - name: Determine merge base id: merge_base run: | sha=$(git merge-base HEAD "origin/${BASE_REF}") echo "sha=${sha}" >> "$GITHUB_OUTPUT" env: BASE_REF: ${{ github.event.pull_request.base.ref || 'main' }} - name: Check if there was any code related change id: check_rust_code run: | if git diff --quiet "${MERGE_BASE}...HEAD" -- \ ':Cargo.toml' \ ':Cargo.lock' \ ':rust-toolchain.toml' \ ':.cargo/config.toml' \ ':crates/**' \ ':src/**' \ ':build.rs' \ ':tests/**' \ ':examples/**' \ ':benches/**' \ ':example_projects/**' \ ':extra_tests/snippets/**' \ ':extra_tests/test_snippets.py' \ ':extra_tests/rustpython_wasi.sh' \ ':extra_tests/requirements.txt' \ ':.github/workflows/ci.yaml' \ ; then echo "changed=false" >> "$GITHUB_OUTPUT" else echo "changed=true" >> "$GITHUB_OUTPUT" fi env: MERGE_BASE: ${{ steps.merge_base.outputs.sha }} - name: Check if update_lib changed id: check_update_lib run: | if git diff --quiet "${MERGE_BASE}...HEAD" -- ':scripts/update_lib/**' ':.python-version'; then echo "changed=false" >> "$GITHUB_OUTPUT" else echo "changed=true" >> "$GITHUB_OUTPUT" fi env: MERGE_BASE: ${{ steps.merge_base.outputs.sha }} - name: Check if WASM package or demo sources changed id: check_wasm_code run: | if git diff --quiet "${MERGE_BASE}...HEAD" -- \ ':wasm/**' \ ':crates/wasm/**' \ ':example_projects/wasm32_without_js/**' \ ; then echo "changed=false" >> "$GITHUB_OUTPUT" else echo "changed=true" >> "$GITHUB_OUTPUT" fi env: MERGE_BASE: ${{ steps.merge_base.outputs.sha }} - name: Check if cross-target compilation can change id: check_cross_target run: | if [ "${FORCE_CROSS_TARGET}" = "true" ]; then echo "changed=true" >> "$GITHUB_OUTPUT" exit 0 fi if ! git diff --quiet "${MERGE_BASE}...HEAD" -- \ ':rust-toolchain.toml' \ ':.cargo/**' \ ':.github/workflows/ci.yaml' \ ':crates/host_env/**' \ ':crates/stdlib/src/openssl/**' \ ':crates/stdlib/src/ssl/**' \ ':**/_signal.rs' \ ':**/_testconsole.rs' \ ':**/_thread.rs' \ ':**/_winapi.rs' \ ':**/_wmi.rs' \ ':**/cert_store.rs' \ ':**/crt_fd*.rs' \ ':**/errno.rs' \ ':**/faulthandler.rs' \ ':**/fcntl.rs' \ ':**/fileutils.rs' \ ':**/grp.rs' \ ':**/locale.rs' \ ':**/mmap.rs' \ ':**/msvcrt.rs' \ ':**/multiprocessing.rs' \ ':**/native_certs.rs' \ ':**/nt.rs' \ ':**/openssl.rs' \ ':**/os.rs' \ ':**/overlapped.rs' \ ':**/posix*.rs' \ ':**/pwd.rs' \ ':**/resource.rs' \ ':**/scproxy.rs' \ ':**/select.rs' \ ':**/shm.rs' \ ':**/signal.rs' \ ':**/socket.rs' \ ':**/ssl.rs' \ ':**/syslog.rs' \ ':**/thread.rs' \ ':**/time.rs' \ ':**/termios.rs' \ ':**/testconsole.rs' \ ':**/tkinter.rs' \ ':**/uuid.rs' \ ':**/winapi.rs' \ ':**/windows.rs' \ ':**/winreg.rs' \ ':**/winsound.rs' \ ':**/wmi.rs' then echo "changed=true" >> "$GITHUB_OUTPUT" exit 0 fi # Added or bumped packages bring new code to every target. Removed # packages only matter while cfg-gated code still references them. lock_diff=$(git diff -U0 "${MERGE_BASE}...HEAD" -- Cargo.lock) if grep -Eq '^\+[^+]' <<< "${lock_diff}"; then echo "changed=true" >> "$GITHUB_OUTPUT" exit 0 fi while IFS= read -r crate; do crate=${crate//-/_} if git grep -qE "(^|[^A-Za-z0-9_])${crate}::|(use|crate) ${crate}([^A-Za-z0-9_]|$)" -- '*.rs'; then echo "changed=true" >> "$GITHUB_OUTPUT" exit 0 fi done < <(sed -n 's/^-name = "\(.*\)"$/\1/p' <<< "${lock_diff}") # Platform cfg, or FFI crates that only exist on some targets. platform_re='target_os|target_arch|target_family|target_env|target_vendor|target_pointer_width|target_endian|cfg\(windows\)|cfg\(unix\)|cfg\(wasi|not\(windows|not\(unix|\[target\.|\blibc::|\bnix::|windows_sys|winapi::|rustix::|std::os::' if ! git diff -G "${platform_re}" --quiet "${MERGE_BASE}...HEAD"; then echo "changed=true" >> "$GITHUB_OUTPUT" exit 0 fi while IFS= read -r file; do [ -f "${file}" ] || continue if grep -Eq "${platform_re}" "${file}"; then echo "changed=true" >> "$GITHUB_OUTPUT" exit 0 fi done < <(git diff --name-only "${MERGE_BASE}...HEAD" -- '*.rs') echo "changed=false" >> "$GITHUB_OUTPUT" env: MERGE_BASE: ${{ steps.merge_base.outputs.sha }} FORCE_CROSS_TARGET: ${{ contains(github.event.pull_request.labels.*.name, 'run:cross-check') }} rust_tests: # Required check: keep the job so a Lib-only PR still gets a green # "Run rust tests (*)" status. Skip the build when rust sources did not change. if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} needs: - determine_changes env: RUST_BACKTRACE: full RUN_RUST_TESTS: ${{ needs.determine_changes.outputs.rust_code == 'true' || github.ref == 'refs/heads/main' }} RUN_UPDATE_LIB_TESTS: ${{ needs.determine_changes.outputs.update_lib == 'true' }} # Named after the matrix entry rather than left to be named for it: a # generated name lists every value in the entry, so adding or removing one # renames the check and drops it from the required list. name: Run rust tests (${{ matrix.os }}) runs-on: ${{ matrix.os }} timeout-minutes: 45 strategy: matrix: os: [macos-latest, ubuntu-latest, windows-2025] fail-fast: false steps: - name: Skip rust tests when sources did not change if: env.RUN_RUST_TESTS != 'true' run: echo "No rust source changes; skipping Rust build and tests." - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 if: env.RUN_RUST_TESTS == 'true' || (env.RUN_UPDATE_LIB_TESTS == 'true' && runner.os == 'Linux') with: persist-credentials: false - uses: dtolnay/rust-toolchain@stable if: env.RUN_RUST_TESTS == 'true' - name: Use a short Cargo home on Windows if: env.RUN_RUST_TESTS == 'true' && runner.os == 'Windows' shell: pwsh run: | "CARGO_HOME=$env:RUNNER_TEMP\c" >> $env:GITHUB_ENV git config --global core.longpaths true - name: Restore cache if: env.RUN_RUST_TESTS == 'true' uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ ${{ runner.temp }}/c/registry/index/ ${{ runner.temp }}/c/registry/cache/ ${{ runner.temp }}/c/git/db/ target/ key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}- restore-keys: | ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}- ${{ runner.os }}-stable-- # Windows runners randomly crashes, https://github.com/actions/cache/issues/1754 continue-on-error: true - name: Install macOS dependencies if: env.RUN_RUST_TESTS == 'true' uses: ./.github/actions/install-macos-deps - name: Build rust tests if: env.RUN_RUST_TESTS == 'true' run: cargo test --no-run --locked --workspace --exclude rustpython-capi ${{ env.WORKSPACE_EXCLUDES }} --features threading ${{ env.CARGO_ARGS }} env: INSTA_WORKSPACE_ROOT: ${{ github.workspace }} - name: run rust tests if: env.RUN_RUST_TESTS == 'true' run: cargo test --locked --workspace --exclude rustpython-capi ${{ env.WORKSPACE_EXCLUDES }} --features threading ${{ env.CARGO_ARGS }} --lib --bins --tests env: INSTA_WORKSPACE_ROOT: ${{ github.workspace }} - name: Run rust doctests if: env.RUN_RUST_TESTS == 'true' run: cargo test --doc --locked --workspace --exclude rustpython-capi ${{ env.WORKSPACE_EXCLUDES }} --features threading ${{ env.CARGO_ARGS }} env: INSTA_WORKSPACE_ROOT: ${{ github.workspace }} - name: Build c-api tests if: env.RUN_RUST_TESTS == 'true' && runner.os != 'Windows' # Requires pyo3 0.29+ on Windows working-directory: crates/capi run: cargo test --no-run --locked - name: run c-api tests if: env.RUN_RUST_TESTS == 'true' && runner.os != 'Windows' # Requires pyo3 0.29+ on Windows working-directory: crates/capi run: cargo test --locked --lib --bins --tests - name: Run c-api doctests if: env.RUN_RUST_TESTS == 'true' && runner.os != 'Windows' # Requires pyo3 0.29+ on Windows working-directory: crates/capi run: cargo test --doc --locked - name: Check host_env without ctypes if: env.RUN_RUST_TESTS == 'true' && runner.os == 'Windows' run: cargo check --locked -p rustpython-host_env --no-default-features --lib - name: check compilation without host_env (sandbox mode) if: env.RUN_RUST_TESTS == 'true' && runner.os == 'Linux' run: | cargo check --locked -p rustpython-vm --no-default-features --features compiler cargo check --locked -p rustpython-stdlib --no-default-features --features compiler cargo build --locked --no-default-features --features stdlib,importlib,stdio,encodings,freeze-stdlib - name: sandbox smoke test if: env.RUN_RUST_TESTS == 'true' && runner.os == 'Linux' run: | target/debug/rustpython extra_tests/snippets/sandbox_smoke.py target/debug/rustpython extra_tests/snippets/stdlib_re.py - name: Test openssl build if: env.RUN_RUST_TESTS == 'true' && runner.os == 'Linux' run: | cargo build --locked --no-default-features --features ssl-openssl cargo build --locked --release --features threading,jit,ssl-openssl ${{ env.CARGO_ARGS_NO_SSL }} target/release/rustpython -B extra_tests/snippets/stdlib_ssl.py target/release/rustpython -B -m test -v --single-process --timeout=300 test_ssl timeout-minutes: 30 - name: Test vendored OpenSSL build if: env.RUN_RUST_TESTS == 'true' && runner.os == 'Linux' run: cargo build --locked --no-default-features --features ssl-openssl-vendor # - name: Install tk-dev for tkinter build # run: sudo apt-get update && sudo apt-get install -y tk-dev # if: runner.os == 'Linux' # - name: Test tkinter build # run: cargo build --features tkinter # if: runner.os == 'Linux' - name: Build example projects if: env.RUN_RUST_TESTS == 'true' && runner.os == 'Linux' run: | cargo build --manifest-path example_projects/barebone/Cargo.toml cargo build --manifest-path example_projects/frozen_stdlib/Cargo.toml env: CARGO_TARGET_DIR: example_projects/target - name: Run example projects if: env.RUN_RUST_TESTS == 'true' && runner.os == 'Linux' run: | example_projects/target/debug/example-barebone example_projects/target/debug/example_frozen_stdlib - name: Build rustpython for update_lib tests if: env.RUN_RUST_TESTS == 'true' && runner.os == 'Linux' run: cargo build --locked - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 if: env.RUN_RUST_TESTS != 'true' && env.RUN_UPDATE_LIB_TESTS == 'true' && runner.os == 'Linux' with: python-version-file: .python-version - name: run update_lib tests if: (env.RUN_RUST_TESTS == 'true' || env.RUN_UPDATE_LIB_TESTS == 'true') && runner.os == 'Linux' run: | if [ "$RUN_RUST_TESTS" = "true" ]; then target/debug/rustpython -m unittest discover -s scripts/update_lib/tests -v else python -m unittest update_lib.tests.test_patch_spec update_lib.tests.test_migrate -v fi env: PYTHONPATH: scripts cargo_check: # Named after the matrix entry rather than left to be named for it: a # generated name lists every value in the entry, so adding or removing one # renames the check and drops it from the required list. name: cargo check (${{ matrix.os }}, ${{ matrix.target }}) runs-on: ${{ matrix.os }} needs: - determine_changes if: | ( !contains(github.event.pull_request.labels.*.name, 'skip:ci') && needs.determine_changes.outputs.cross_target == 'true' ) || github.ref == 'refs/heads/main' strategy: matrix: include: - os: ubuntu-latest target: aarch64-linux-android - os: ubuntu-latest target: i686-unknown-linux-gnu dependencies: gcc-multilib: true - os: ubuntu-latest target: i686-unknown-linux-musl dependencies: musl-tools: true skip_ssl: true - os: ubuntu-latest target: wasm32-wasip2 skip_ssl: true - os: ubuntu-latest target: x86_64-unknown-freebsd skip_ssl: true - os: ubuntu-latest target: aarch64-unknown-linux-gnu dependencies: gcc-aarch64-linux-gnu: true - os: ubuntu-latest target: x86_64-pc-windows-gnu dependencies: gcc-mingw-w64-x86-64: true - os: macos-latest target: aarch64-apple-ios x86_64-apple-darwin fail-fast: false steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Install dependencies uses: ./.github/actions/install-linux-deps # zizmor has an issue with dynamic `with` # with: ${{ matrix.dependencies || fromJSON('{}') }} with: gcc-multilib: ${{ matrix.dependencies.gcc-multilib || false }} musl-tools: ${{ matrix.dependencies.musl-tools || false }} gcc-aarch64-linux-gnu: ${{ matrix.dependencies.gcc-aarch64-linux-gnu || false }} gcc-mingw-w64-x86-64: ${{ matrix.dependencies.gcc-mingw-w64-x86-64 || false }} - name: Restore cache uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ # key won't match, will rely on restore-keys key: ${{ runner.os }}-${{ matrix.target }} restore-keys: | ${{ runner.os }}-stable-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml') }}- ${{ runner.os }}-stable-${{ matrix.target }}- ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}- ${{ runner.os }}-stable-- - uses: dtolnay/rust-toolchain@stable with: target: ${{ matrix.target }} - name: Setup Android NDK if: ${{ matrix.target == 'aarch64-linux-android' }} id: setup-ndk uses: nttld/setup-ndk@ed92fe6cadad69be94a966a7ee3271275e62f779 # v1.6.0 with: ndk-version: r27 add-to-path: true - name: Append env conf to cargo if: ${{ matrix.target == 'aarch64-linux-android' }} env: NDK_PATH: ${{ steps.setup-ndk.outputs.ndk-path }} run: | { echo "[env]" echo "CC_aarch64_linux_android = \"${NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang\"" echo "AR_aarch64_linux_android = \"${NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar\"" echo "CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER = \"${NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang\"" } >> .cargo/config.toml # - name: Prepare repository for redox compilation # run: bash scripts/redox/uncomment-cargo.sh # - name: Check compilation for Redox # uses: coolreader18/redoxer-action@v1 # with: # command: check # args: --ignore-rust-version - name: Check compilation with threading run: | read -ra targets <<< "$TARGETS" cargo check --locked "${targets[@]/#/--target=}" ${{ env.CARGO_ARGS_NO_SSL }} --features threading env: TARGETS: ${{ matrix.target }} - name: Check compilation with ssl if: ${{ !matrix.skip_ssl }} run: | read -ra targets <<< "$TARGETS" cargo check --locked "${targets[@]/#/--target=}" ${{ env.CARGO_ARGS }} env: TARGETS: ${{ matrix.target }} snippets_cpython: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} env: RUST_BACKTRACE: full # Named after the matrix entry rather than left to be named for it: a # generated name lists every value in the entry, so adding or removing one # renames the check and drops it from the required list. name: Run snippets and cpython tests (${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: matrix: include: - os: macos-latest extra_test_args: - '-u all' - '--timeout 600' - '--dont-add-python-opts' env_polluting_tests: [] skips: [] timeout: 50 - os: ubuntu-latest extra_test_args: - '-u all' - '--timeout 600' - '--dont-add-python-opts' env_polluting_tests: [] skips: [] timeout: 60 - os: windows-2025 extra_test_args: - '-u all' - '--timeout 600' - '--dont-add-python-opts' # CPython's installed py.exe reports its own version, not RustPython's. # Keep the remaining launcher integration tests and runtime version checks. - '--ignore test.test_launcher.TestLauncher.test_version' env_polluting_tests: [] skips: [] timeout: 50 fail-fast: false steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: dtolnay/rust-toolchain@stable - name: Use a short Cargo home on Windows if: runner.os == 'Windows' shell: pwsh run: | "CARGO_HOME=$env:RUNNER_TEMP\c" >> $env:GITHUB_ENV git config --global core.longpaths true - name: Restore cache uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ ${{ runner.temp }}/c/registry/index/ ${{ runner.temp }}/c/registry/cache/ ${{ runner.temp }}/c/git/db/ target/ key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}- restore-keys: | ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}- ${{ runner.os }}-stable-- # Windows runners randomly crashes, https://github.com/actions/cache/issues/1754 continue-on-error: true - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 - name: Install macOS dependencies uses: ./.github/actions/install-macos-deps with: openssl: true # Keep features in sync with update-caches.yml CARGO_ARGS. - name: build rustpython run: cargo build --locked --release --verbose --features=threading,jit ${{ env.CARGO_ARGS }} - name: run snippets run: python -m pip install -r requirements.txt && pytest -v working-directory: ./extra_tests - name: Detect available cores id: cores shell: bash run: | cores=$(python -c 'print(__import__("os").process_cpu_count())') echo "cores=${cores}" >> "$GITHUB_OUTPUT" - name: Run CPython tests run: | # shellcheck disable=SC2086 target/release/rustpython -u -m test --slow-ci -j "$CORES" $EXTRA_TEST_ARGS $SKIPS timeout-minutes: ${{ matrix.timeout }} shell: bash env: RUSTPYTHON_SKIP_ENV_POLLUTERS: true CORES: ${{ steps.cores.outputs.cores }} EXTRA_TEST_ARGS: ${{ join(matrix.extra_test_args, ' ') }} SKIPS: ${{ join(matrix.skips, ' ') }} - name: run cpython tests to check if env polluters have stopped polluting shell: bash run: | IFS=' ' read -r -a target_array <<< "$TARGETS" for thing in "${target_array[@]}"; do for i in $(seq 1 10); do set +e target/release/rustpython -u -m test --slow-ci -u all -j 1 --timeout 600 --dont-add-python-opts "${thing}" exit_code=$? set -e if [ "${exit_code}" -eq 3 ]; then echo "Test ${thing} polluted the environment on attempt ${i}." break fi done if [ "${exit_code}" -ne 3 ]; then echo "Test ${thing} is no longer polluting the environment after ${i} attempts!" echo "Please remove ${thing} from matrix.env_polluting_tests in '.github/workflows/ci.yaml'." echo "Please also remove the skip decorators that include the word 'POLLUTERS' in ${thing}." if [ "${exit_code}" -ne 0 ]; then echo "Test ${thing} failed with exit code ${exit_code}." echo "Please investigate which test item in ${thing} is failing and either mark it as an expected failure or a skip." fi exit 1 fi done env: TARGETS: ${{ join(matrix.env_polluting_tests, ' ') }} timeout-minutes: 15 - if: runner.os != 'Windows' name: check that --install-pip succeeds run: | mkdir site-packages target/release/rustpython --install-pip ensurepip --user target/release/rustpython -m pip install six - name: Check that ensurepip succeeds. run: | target/release/rustpython -m ensurepip target/release/rustpython -c "import pip" - if: runner.os == 'Windows' name: Check pip HTTPS with the Windows trust store run: >- target/release/rustpython -m pip download --disable-pip-version-check --no-cache-dir --no-deps --only-binary=:all: --dest "$env:RUNNER_TEMP\rustpython-pip-smoke" six - if: runner.os != 'Windows' name: Check if pip inside venv is functional run: | target/release/rustpython -m venv testvenv testvenv/bin/rustpython -m pip install wheel - name: Check whats_left is not broken shell: bash run: python -I scripts/whats_left.py --signature --rustpython target/release/rustpython clippy: # Named after the matrix entry rather than left to be named for it: a # generated name lists every value in the entry, so adding or removing one # renames the check and drops it from the required list. name: clippy (${{ matrix.os }}) runs-on: ${{ matrix.os }} needs: - determine_changes permissions: contents: read if: | needs.determine_changes.outputs.rust_code == 'true' || github.ref == 'refs/heads/main' strategy: fail-fast: false matrix: os: - ubuntu-latest steps: &clippy_steps - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: dtolnay/rust-toolchain@stable with: components: clippy - name: Use a short Cargo home on Windows if: runner.os == 'Windows' shell: pwsh run: | "CARGO_HOME=$env:RUNNER_TEMP\c" >> $env:GITHUB_ENV git config --global core.longpaths true - name: Restore cache uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ ${{ runner.temp }}/c/registry/index/ ${{ runner.temp }}/c/registry/cache/ ${{ runner.temp }}/c/git/db/ target/ key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}- restore-keys: | ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}- ${{ runner.os }}-stable-- # Windows runners randomly crashes, https://github.com/actions/cache/issues/1754 continue-on-error: true - name: Clippy run: cargo clippy --locked --keep-going ${{ env.CARGO_ARGS_MOST_FEATS }} --workspace --all-targets --bins --examples --tests ${{ env.WORKSPACE_EXCLUDES }} -- -Dwarnings # macOS/Windows clippy uses the same OS-surface filter as cargo check. # Force with the run:cross-check label. Check names stay clippy (<os>). clippy_cross: name: clippy (${{ matrix.os }}) runs-on: ${{ matrix.os }} needs: - determine_changes permissions: contents: read if: | github.ref == 'refs/heads/main' || needs.determine_changes.outputs.cross_target == 'true' strategy: fail-fast: false matrix: os: - macos-latest - windows-latest steps: *clippy_steps cargo_shear: name: cargo shear runs-on: ubuntu-latest needs: - determine_changes permissions: contents: read if: | needs.determine_changes.outputs.rust_code == 'true' || github.ref == 'refs/heads/main' steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: dtolnay/rust-toolchain@stable - uses: taiki-e/install-action@682ce6c3c696a4cd5168a05f98e51aa02b877941 # v2.89.1 with: tool: cargo-shear fallback: none - name: cargo shear run: cargo shear --locked lint: name: Lint runs-on: ubuntu-latest permissions: contents: read checks: write issues: write pull-requests: write security-events: write # for zizmor steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 - uses: dtolnay/rust-toolchain@stable with: components: rustfmt - name: actionlint uses: reviewdog/action-actionlint@619a81ec64ff8c0211cd6146eb2b21e8f1d7f440 # v1.81.1 - name: zizmor uses: zizmorcore/zizmor-action@45d7276c9ca790aabd705e31ca99c6185c3e76dd # v0.8.1 - name: restore prek cache uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: key: prek-${{ hashFiles('.pre-commit-config.yaml') }} path: ~/.cache/prek - name: install prek id: prek uses: j178/prek-action@44924fe9ef4a6f88253c4b6b1bf11c689d3ce53d # v3.1.0 with: cache: false show-verbose-logs: false install-only: true - name: prek run run: prek run --show-diff-on-failure --color=always --all-files - name: Clone CPython opcode metadata source uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: python/cpython path: cpython ref: "v3.15.0" persist-credentials: false - name: prek run (manual stage) run: prek run --show-diff-on-failure --color=always --all-files --hook-stage manual env: CPYTHON_ROOT: ${{ github.workspace }}/cpython - name: save prek cache if: ${{ github.ref == 'refs/heads/main' }} # only save on main uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: key: prek-${{ hashFiles('.pre-commit-config.yaml') }} path: ~/.cache/prek - name: restore git permissions if: ${{ !cancelled() }} run: sudo chown -R "$(id -u):$(id -g)" .git - name: reviewdog if: ${{ !cancelled() }} uses: reviewdog/action-suggester@ac5ce6d94e35c00530447dc63c271e38e4fd36c6 # v1.26.3 with: level: warning fail_level: error miri: needs: - determine_changes if: | !contains(github.event.pull_request.labels.*.name, 'skip:ci') && ( needs.determine_changes.outputs.rust_code == 'true' || github.ref == 'refs/heads/main' ) name: Run tests under miri runs-on: ubuntu-latest timeout-minutes: 30 env: NIGHTLY_CHANNEL: nightly steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ env.NIGHTLY_CHANNEL }} components: miri - name: Restore cache uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }} restore-keys: | ${{ runner.os }}- - name: Build tests under miri run: cargo +${{ env.NIGHTLY_CHANNEL }} miri test --no-run --locked -p rustpython-vm -- miri_test env: MIRIFLAGS: "-Zmiri-ignore-leaks -Zmiri-permissive-provenance" - name: Run tests under miri run: cargo +${{ env.NIGHTLY_CHANNEL }} miri test --locked -p rustpython-vm -- miri_test env: # miri-ignore-leaks because the type-object circular reference means that there will always be # a memory leak, at least until we have proper cyclic gc # miri-permissive-provenance because function pointer identity checks (slot comparisons) # cast fn pointers to usize, which strips provenance — this is the standard pattern for # fn pointer comparison in Rust and not a soundness issue MIRIFLAGS: "-Zmiri-ignore-leaks -Zmiri-permissive-provenance" wasm: needs: - determine_changes if: | !contains(github.event.pull_request.labels.*.name, 'skip:ci') && ( needs.determine_changes.outputs.rust_code == 'true' || needs.determine_changes.outputs.wasm_code == 'true' || github.ref == 'refs/heads/main' ) name: Check the WASM package and demo runs-on: ubuntu-latest timeout-minutes: 30 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: dtolnay/rust-toolchain@stable with: components: clippy - name: Restore cache uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}- restore-keys: | ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}- ${{ runner.os }}-stable-- ${{ runner.os }}- - name: cargo clippy run: cargo --locked clippy --keep-going --manifest-path=crates/wasm/Cargo.toml -- -Dwarnings - name: install wasm-pack run: curl https://wasm-bindgen.github.io/wasm-pack/installer/init.sh -sSf | sh - name: install geckodriver run: | wget https://github.com/mozilla/geckodriver/releases/download/v0.36.0/geckodriver-v0.36.0-linux64.tar.gz mkdir geckodriver tar -xzf geckodriver-v0.36.0-linux64.tar.gz -C geckodriver - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 - run: python -m pip install -r requirements.txt working-directory: ./wasm/tests - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: package-manager-cache: false - name: Get npm cache directory id: npm-cache-dir shell: bash run: echo "dir=$(npm config get cache)" >> "$GITHUB_OUTPUT" - name: Restore npm cache uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 # don't restore on main or release if: github.ref != 'refs/heads/main' && github.ref != 'refs/heads/release' with: path: ${{ steps.npm-cache-dir.outputs.dir }} key: node-${{ runner.os }}-wasm-demo- restore-keys: | node-${{ runner.os }}-wasm-demo- - name: run test run: | driver_path="$(pwd)/../../geckodriver" export PATH="$PATH:${driver_path}" npm install npm run test env: NODE_OPTIONS: "--openssl-legacy-provider" working-directory: ./wasm/demo - uses: mwilliamson/setup-wabt-action@427f2fdd70bc4dbc2e53c2eb4f19f66162d71bd2 # v4.0.0 with: wabt-version: "1.0.36" - name: Build wasm32-unknown without js working-directory: example_projects/wasm32_without_js/rustpython-without-js run: cargo build - name: Build wasm-runtime |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |