|
31 | 31 | run: |
|
32 | 32 | make codegen
|
33 | 33 | - name: Check if the git repository is clean
|
34 |
| - run: $(exit $(git status --porcelain --untracked-files=no | head -255 | wc -l)) || (echo "Dirty git tree"; git diff; exit 1) |
| 34 | + run: (exit "$(git status --porcelain --untracked-files=no | head -255 | wc -l)") || (echo "Dirty git tree"; git diff; exit 1) |
35 | 35 |
|
36 | 36 | ci:
|
37 | 37 | runs-on: ${{ matrix.config.os }}
|
@@ -164,7 +164,7 @@ jobs:
|
164 | 164 | run: |
|
165 | 165 | ./build/qjs -c examples/hello.js -o hello
|
166 | 166 | ./hello
|
167 |
| - |
| 167 | +
|
168 | 168 | - name: test api
|
169 | 169 | run: |
|
170 | 170 | ./build/api-test
|
@@ -418,7 +418,7 @@ jobs:
|
418 | 418 | - name: build
|
419 | 419 | run: |
|
420 | 420 | emcmake cmake -B build -DQJS_BUILD_LIBC=ON
|
421 |
| - emmake make -C build qjs_wasm -j$(getconf _NPROCESSORS_ONLN) |
| 421 | + emmake make -C build qjs_wasm "-j$(getconf _NPROCESSORS_ONLN)" |
422 | 422 | - name: result
|
423 | 423 | run: ls -lh build
|
424 | 424 | wasi:
|
@@ -509,10 +509,10 @@ jobs:
|
509 | 509 | run: |
|
510 | 510 | mkdir build
|
511 | 511 | cd build
|
512 |
| - $ANDROID_HOME/cmake/3.22.1/bin/cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_HOME/ndk/26.0.10792818/build/cmake/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-24 -DQJS_BUILD_LIBC=ON .. |
| 512 | + "$ANDROID_HOME/cmake/3.22.1/bin/cmake" "-DCMAKE_TOOLCHAIN_FILE=$ANDROID_HOME/ndk/26.0.10792818/build/cmake/android.toolchain.cmake" -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-24 -DQJS_BUILD_LIBC=ON .. |
513 | 513 | - name: Build android arm64
|
514 | 514 | run: |
|
515 |
| - $ANDROID_HOME/cmake/3.22.1/bin/cmake --build build --target qjs |
| 515 | + "$ANDROID_HOME/cmake/3.22.1/bin/cmake" --build build --target qjs |
516 | 516 | ls -lh build
|
517 | 517 |
|
518 | 518 | ios:
|
@@ -600,3 +600,198 @@ jobs:
|
600 | 600 | - name: jscheck
|
601 | 601 | run: |
|
602 | 602 | make jscheck
|
| 603 | +
|
| 604 | + meson: |
| 605 | + runs-on: ${{ matrix.platform }} |
| 606 | + name: meson on ${{ matrix.platform }} (${{ matrix.mode.name }} ${{ matrix.flavor }}, ${{ matrix.features.name }}) |
| 607 | + strategy: |
| 608 | + fail-fast: false |
| 609 | + matrix: |
| 610 | + flavor: |
| 611 | + - debug |
| 612 | + - release |
| 613 | + features: |
| 614 | + - name: default |
| 615 | + args: "" |
| 616 | + - name: libc |
| 617 | + args: -Dlibc=true |
| 618 | + - name: mimalloc |
| 619 | + args: -Dcli_mimalloc=auto |
| 620 | + mode: |
| 621 | + - name: default |
| 622 | + args: -Dtests=enabled |
| 623 | + extra_envs: {} |
| 624 | + |
| 625 | + # Alternative compiler setups |
| 626 | + - name: gcc |
| 627 | + args: -Dtests=enabled |
| 628 | + extra_envs: |
| 629 | + CC: gcc |
| 630 | + CXX: g++ |
| 631 | + - name: clang |
| 632 | + args: -Dtests=enabled |
| 633 | + extra_envs: |
| 634 | + CC: clang |
| 635 | + CXX: clang++ |
| 636 | + |
| 637 | + - name: sanitize |
| 638 | + args: >- |
| 639 | + "-Db_sanitize=address,undefined" |
| 640 | + extra_envs: {} |
| 641 | + |
| 642 | + # This is for MSVC, which only supports AddressSanitizer. |
| 643 | + # https://learn.microsoft.com/en-us/cpp/sanitizers/ |
| 644 | + - name: sanitize+asanonly |
| 645 | + args: -Db_sanitize=address |
| 646 | + extra_envs: |
| 647 | + ASAN_OPTIONS: report_globals=0:halt_on_error=1:abort_on_error=1:print_summary=1 |
| 648 | + |
| 649 | + - name: clang+sanitize |
| 650 | + args: >- |
| 651 | + "-Db_sanitize=address,undefined" |
| 652 | + extra_envs: |
| 653 | + CC: clang |
| 654 | + CXX: clang++ |
| 655 | + - name: clang+msan |
| 656 | + args: -Db_sanitize=memory |
| 657 | + extra_envs: |
| 658 | + CC: clang |
| 659 | + CXX: clang++ |
| 660 | + |
| 661 | + # default clang on GitHub hosted runners is from MSYS2. |
| 662 | + # Use Visual Studio supplied clang-cl instead. |
| 663 | + - name: clang-cl+sanitize |
| 664 | + args: >- |
| 665 | + "-Db_sanitize=address,undefined" |
| 666 | + extra_envs: |
| 667 | + CC: clang-cl |
| 668 | + CXX: clang-cl |
| 669 | + - name: clang-cl+msan |
| 670 | + args: -Db_sanitize=memory |
| 671 | + extra_envs: |
| 672 | + CC: clang-cl |
| 673 | + CXX: clang-cl |
| 674 | + platform: |
| 675 | + - ubuntu-latest |
| 676 | + - windows-latest |
| 677 | + - macos-latest |
| 678 | + |
| 679 | + exclude: |
| 680 | + # clang-cl only makes sense on windows. |
| 681 | + - platform: ubuntu-latest |
| 682 | + mode: |
| 683 | + name: clang-cl+sanitize |
| 684 | + - platform: macos-latest |
| 685 | + mode: |
| 686 | + name: clang-cl+sanitize |
| 687 | + - platform: ubuntu-latest |
| 688 | + mode: |
| 689 | + name: clang-cl+msan |
| 690 | + - platform: macos-latest |
| 691 | + mode: |
| 692 | + name: clang-cl+msan |
| 693 | + |
| 694 | + # Use clang-cl instead of MSYS2 clang. |
| 695 | + # |
| 696 | + # we already tested clang+sanitize on linux, |
| 697 | + # if this doesn't work, it should be an issue for MSYS2 team to consider. |
| 698 | + - platform: windows-latest |
| 699 | + mode: |
| 700 | + name: clang |
| 701 | + - platform: windows-latest |
| 702 | + mode: |
| 703 | + name: clang+sanitize |
| 704 | + - platform: windows-latest |
| 705 | + mode: |
| 706 | + name: clang+msan |
| 707 | + |
| 708 | + # MSVC-only sanitizers |
| 709 | + - platform: ubuntu-latest |
| 710 | + mode: |
| 711 | + name: sanitize+asanonly |
| 712 | + - platform: macos-latest |
| 713 | + mode: |
| 714 | + name: sanitize+asanonly |
| 715 | + - platform: windows-latest |
| 716 | + mode: |
| 717 | + name: sanitize |
| 718 | + |
| 719 | + # clang is the default on macos |
| 720 | + # also gcc is an alias to clang |
| 721 | + - platform: macos-latest |
| 722 | + mode: |
| 723 | + name: clang |
| 724 | + - platform: macos-latest |
| 725 | + mode: |
| 726 | + name: gcc |
| 727 | + |
| 728 | + # gcc is the default on linux |
| 729 | + - platform: ubuntu-latest |
| 730 | + mode: |
| 731 | + name: gcc |
| 732 | + |
| 733 | + # only run sanitizer tests on linux |
| 734 | + # |
| 735 | + # gcc/clang's codegen shouldn't massively change across platforms, |
| 736 | + # and linux supports most of the sanitizers. |
| 737 | + - platform: macos-latest |
| 738 | + mode: |
| 739 | + name: clang+sanitize |
| 740 | + - platform: macos-latest |
| 741 | + mode: |
| 742 | + # macos does not support msan |
| 743 | + name: clang+msan |
| 744 | + - platform: macos-latest |
| 745 | + mode: |
| 746 | + name: sanitize |
| 747 | + |
| 748 | + steps: |
| 749 | + - name: Setup meson |
| 750 | + run: | |
| 751 | + pipx install meson ninja |
| 752 | + - name: Install mimalloc |
| 753 | + if: ${{ matrix.platform == 'ubuntu-latest' && matrix.features.name == 'mimalloc' }} |
| 754 | + run: sudo apt update && sudo apt -y install libmimalloc-dev |
| 755 | + - name: Install mimalloc |
| 756 | + if: ${{ matrix.platform == 'macos-latest' && matrix.features.name == 'mimalloc' }} |
| 757 | + run: brew install mimalloc |
| 758 | + # TODO: Install mimalloc on Windows |
| 759 | + # You need to: |
| 760 | + # - checkout mimalloc |
| 761 | + # - `msbuild mimalloc\ide\vs2022\mimalloc.sln` |
| 762 | + # - not cmake, because https://github.com/microsoft/mimalloc/issues/575#issuecomment-1112723975 |
| 763 | + # - it is possible to integrate vcpkg with meson, but: |
| 764 | + # - 1. the above issue |
| 765 | + # - 2. the vcpkg port of mimalloc is outdated, and still broken on server 2019 |
| 766 | + # - or maintain a meson port for mimalloc (and ensure it behaves correctly) |
| 767 | + # - Make it findable with cmake |
| 768 | + # - not the simpler pkg-config. although there was pkg-config in PATH, |
| 769 | + # but that was from strawberry perl and thus broken |
| 770 | + # ... good job, microsoft :)))) |
| 771 | + |
| 772 | + - name: Checkout |
| 773 | + uses: actions/checkout@v4 |
| 774 | + - name: Activate MSVC and Configure |
| 775 | + if: ${{ matrix.platform == 'windows-latest' }} |
| 776 | + env: ${{ matrix.mode.extra_envs }} |
| 777 | + run: | |
| 778 | + meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }} ${{ matrix.features.args }} --vsenv |
| 779 | + - name: Configuring |
| 780 | + if: ${{ matrix.platform != 'windows-latest' }} |
| 781 | + env: ${{ matrix.mode.extra_envs }} |
| 782 | + run: | |
| 783 | + meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }} ${{ matrix.features.args }} |
| 784 | + - name: Building |
| 785 | + run: | |
| 786 | + meson compile -C build-${{ matrix.flavor }} |
| 787 | +
|
| 788 | + - name: Running tests |
| 789 | + env: ${{ matrix.mode.extra_envs }} |
| 790 | + run: | |
| 791 | + meson test -C build-${{ matrix.flavor }} --timeout-multiplier 5 --print-errorlogs |
| 792 | + meson test --benchmark -C build-${{ matrix.flavor }} --timeout-multiplier 5 --print-errorlogs |
| 793 | + - uses: actions/upload-artifact@v4 |
| 794 | + if: ${{ failure() }} |
| 795 | + with: |
| 796 | + name: ${{ matrix.platform }}-${{ matrix.mode.name }}-${{ matrix.features.name }}-${{ matrix.flavor }}-logs |
| 797 | + path: build-${{ matrix.flavor }}/meson-logs |
0 commit comments