|
| 1 | +name: IncludeJS |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + |
| 6 | +jobs: |
| 7 | + test: |
| 8 | + strategy: |
| 9 | + fail-fast: false |
| 10 | + matrix: |
| 11 | + platform: |
| 12 | + # TODO: Build on more platforms |
| 13 | + - os: macos-latest |
| 14 | + cc: clang |
| 15 | + cxx: clang++ |
| 16 | + type: static |
| 17 | + - os: ubuntu-latest |
| 18 | + cc: clang |
| 19 | + cxx: clang++ |
| 20 | + type: static |
| 21 | + |
| 22 | + # TODO: Build with sanitizers |
| 23 | + |
| 24 | + runs-on: ${{ matrix.platform.os }} |
| 25 | + env: |
| 26 | + CC: ${{ matrix.platform.cc }} |
| 27 | + CXX: ${{ matrix.platform.cxx }} |
| 28 | + steps: |
| 29 | + - name: Install dependencies (GNU/Linux) |
| 30 | + if: runner.os == 'linux' |
| 31 | + run: | |
| 32 | + sudo apt-get update --yes |
| 33 | + sudo apt-get install --yes clang-format libjavascriptcoregtk-4.0-dev |
| 34 | +
|
| 35 | + # See https://github.com/actions/runner-images/issues/8659 |
| 36 | + - name: Workaround Clang issue (GNU/Linux) |
| 37 | + if: runner.os == 'linux' && matrix.platform.cc == 'clang' |
| 38 | + run: | |
| 39 | + sudo apt-get purge -y g++-13 gcc-13 libstdc++-13-dev |
| 40 | + sudo apt-get install -y --allow-downgrades libstdc++-12-dev libstdc++6=12.* libgcc-s1=12.* |
| 41 | +
|
| 42 | + - uses: actions/checkout@v4 |
| 43 | + - name: Install dependencies (macOS) |
| 44 | + if: runner.os == 'macos' |
| 45 | + run: brew bundle |
| 46 | + env: |
| 47 | + HOMEBREW_NO_ANALYTICS: 1 |
| 48 | + HOMEBREW_NO_AUTO_UPDATE: 1 |
| 49 | + - run: cmake --version |
| 50 | + - name: Configure IncludeJS (static) |
| 51 | + if: matrix.platform.type == 'static' |
| 52 | + run: > |
| 53 | + cmake -S . -B ./build |
| 54 | + -DCMAKE_BUILD_TYPE:STRING=Release |
| 55 | + -DINCLUDEJS_TESTS:BOOL=ON |
| 56 | + -DINCLUDEJS_DOCS:BOOL=OFF |
| 57 | + -DBUILD_SHARED_LIBS:BOOL=OFF |
| 58 | + -DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON |
| 59 | + ${{ matrix.platform.options }} |
| 60 | + - name: Configure IncludeJS (shared) |
| 61 | + if: matrix.platform.type == 'shared' |
| 62 | + run: > |
| 63 | + cmake -S . -B ./build |
| 64 | + -DCMAKE_BUILD_TYPE:STRING=Release |
| 65 | + -DINCLUDEJS_TESTS:BOOL=ON |
| 66 | + -DINCLUDEJS_DOCS:BOOL=OFF |
| 67 | + -DBUILD_SHARED_LIBS:BOOL=ON |
| 68 | + -DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON |
| 69 | + ${{ matrix.platform.options }} |
| 70 | + - run: cmake --build ./build --config Release --target clang_format_test |
| 71 | + - run: cmake --build ./build --config Release --parallel 4 |
| 72 | + - run: > |
| 73 | + cmake --install ./build --prefix ./build/dist --config Release --verbose |
| 74 | + --component sourcemeta_includejs |
| 75 | + - run: > |
| 76 | + cmake --install ./build --prefix ./build/dist --config Release --verbose |
| 77 | + --component sourcemeta_includejs_dev |
| 78 | +
|
| 79 | + # Not every CTest version supports the --test-dir option. If such option |
| 80 | + # is not recognized, `ctest` will successfully exit finding no tests. |
| 81 | + # Better to be sure and `cd` all the time here. |
| 82 | + - run: cd ./build && ctest --build-config Release --output-on-failure --parallel |
| 83 | + env: |
| 84 | + # See https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html |
| 85 | + UBSAN_OPTIONS: print_stacktrace=1 |
0 commit comments