diff --git a/.github/workflows/core-build.yml b/.github/workflows/core-build.yml deleted file mode 100644 index d597193a0..000000000 --- a/.github/workflows/core-build.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: core-build - -on: - workflow_dispatch: - pull_request: - branches: - - main - paths: - - "src/**" - - "include/**" - - "workflows/core-build.yml" - - "vendor/**" - - "CMakeLists.txt" - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - # INFO: We are cancelling the concurrency group if the change is on PR. For workflow dispatch, this will not work. - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} - -jobs: - build: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - - - name: Get ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }} - - - name: Get latest CMake and Ninja - uses: lukka/get-cmake@latest - with: - cmakeVersion: 3.24.1 - ninjaVersion: latest - - - name: Clear ccache - run: ccache --clear - - - name: Save and restore ccache keys - uses: actions/cache@v3 - env: - cache-name: ccache-maplibre-core - with: - path: ~/.ccache - key: ${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }} - # INFO: No fallback restore. Only restoring keys that have the same github reference. Rerunning the same workflow - # will be faster. New workflow invocation with different code, sha1, or head will not be. - - - name: Build Maplibre GL Core - run: | - cmake --version - cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Debug -DMBGL_WITH_CLANG_TIDY=ON -DMBGL_WITH_CORE_ONLY=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DMBGL_WITH_COVERAGE=ON - cmake --build build diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml new file mode 100644 index 000000000..93fc6be32 --- /dev/null +++ b/.github/workflows/linux-ci.yml @@ -0,0 +1,147 @@ +name: linux-ci + +on: + workflow_dispatch: + pull_request: + branches: + - main + paths: + - "src/**" + - "include/**" + - ".github/workflows/linux-ci.yml" + - "vendor/**" + - "CMakeLists.txt" + - metrics/linux-gcc8-release-style.json + +# https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services +permissions: + id-token: write # This is required for requesting the JWT (AWS) + contents: read # This is required for actions/checkout (AWS) + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + # INFO: We are cancelling the concurrency group if the change is on PR. For workflow dispatch, this will not work. + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 + + - uses: hendrikmuhs/ccache-action@v1.2 + + - name: Get latest CMake and Ninja + uses: lukka/get-cmake@latest + with: + cmakeVersion: 3.24.1 + ninjaVersion: latest + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + libcurl4-openssl-dev \ + libuv1-dev \ + libjpeg-dev \ + libpng-dev \ + libglfw3-dev + + - name: Build Maplibre GL Core + run: | + cmake --version + cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Debug -DMBGL_WITH_CLANG_TIDY=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DMBGL_WITH_COVERAGE=ON + cmake --build build --target mbgl-core mbgl-test-runner mbgl-render-test-runner + + - name: Archive mbgl-test-runner + uses: actions/upload-artifact@v3 + with: + name: mbgl-test-runner + path: build/mbgl-test-runner + retention-days: 1 + + - name: Archive mbgl-render-test-runner + uses: actions/upload-artifact@v3 + with: + name: mbgl-render-test-runner + path: build/mbgl-render-test-runner + retention-days: 1 + + test: + needs: build + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + libopengl0 + + - name: Download mbgl-test-runner + uses: actions/download-artifact@v3 + with: + name: mbgl-test-runner + + - run: chmod +x ./mbgl-test-runner + + - name: Install npm packages and run test server in background + run: | + npm install + node test/storage/server.js & + + - name: Run C++ tests + run: xvfb-run -a ./mbgl-test-runner + + render-test: + needs: build + runs-on: ubuntu-22.04 + steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + libopengl0 + + - uses: actions/checkout@v3 + + - name: Download mbgl-render-test-runner + uses: actions/download-artifact@v3 + with: + name: mbgl-render-test-runner + + - run: chmod +x ./mbgl-render-test-runner + + - name: Run render test + continue-on-error: true + id: render_test + run: xvfb-run -a ./mbgl-render-test-runner --manifestPath=metrics/linux-gcc8-release-style.json + + - name: Configure AWS Credentials + if: ${{ steps.render_test.outcome == 'failure' }} + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-region: us-west-2 + role-to-assume: ${{ vars.OIDC_AWS_ROLE_TO_ASSUME }} + role-session-name: ${{ github.run_id }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + + - name: Upload render test results to S3 + if: ${{ steps.render_test.outcome == 'failure' }} + id: upload_render_test_results + run: | + aws s3 cp metrics/linux-gcc8-release-style.html \ + s3://maplibre-native-test-artifacts/${{ github.run_id }}-linux-gcc8-release-style.html \ + --expires "$(date -d '+30 days' --utc +'%Y-%m-%dT%H:%M:%SZ') + + - name: Make comment with test results + if: ${{ steps.upload_render_test_results.outcome == 'success' }} + uses: thollander/actions-comment-pull-request@v2 + with: + message: | + Test results at https://maplibre-native-test-artifacts.s3.eu-central-1.amazonaws.com/${{ github.run_id }}-linux-gcc8-release-style.html diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index 030b8fab0..66f742f50 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -173,6 +173,7 @@ jobs: -G Ninja \ -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DMLN_WITH_NODE=ON - name: Configure maplibre-gl-native (Linux) if: runner.os == 'Linux' @@ -182,7 +183,8 @@ jobs: -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_COMPILER=gcc-10 \ - -DCMAKE_CXX_COMPILER=g++-10 + -DCMAKE_CXX_COMPILER=g++-10 \ + -DMLN_WITH_NODE=ON - name: "Create directory '${{ github.workspace }}/platform/windows/vendor/vcpkg/bincache' (Windows)" if: runner.os == 'Windows' @@ -208,7 +210,8 @@ jobs: cmake . -B build \ -G Ninja \ -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} \ - -DCMAKE_CXX_COMPILER_LAUNCHER=sccache + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ + -DMLN_WITH_NODE=ON - name: Build maplibre-gl-native (MacOS/Linux) if: runner.os == 'MacOS' || runner.os == 'Linux' diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ecc8a353..e42e54da3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 3.10 FATAL_ERROR) option(MBGL_WITH_CORE_ONLY "Build only the core bits, no platform code" OFF) option(MBGL_WITH_CLANG_TIDY "Build with clang-tidy checks enabled" OFF) option(MBGL_WITH_COVERAGE "Enable code coverage collection" OFF) -option(MBGL_WITH_QT "Build Mapbox GL Qt bindings" OFF) +option(MBGL_WITH_QT "Build MapLibre Native Qt bindings" OFF) +option(MLN_WITH_NODE "Build MapLibre Native Node.js bindings" OFF) option(MBGL_WITH_SANITIZER "Use [address|thread|undefined] here" OFF) option(MBGL_WITH_RTTI "Compile with runtime type information" OFF) option(MBGL_WITH_OPENGL "Build with OpenGL renderer" ON) diff --git a/include/mbgl/platform/gl_functions.hpp b/include/mbgl/platform/gl_functions.hpp index 9feee8b29..00a84818d 100644 --- a/include/mbgl/platform/gl_functions.hpp +++ b/include/mbgl/platform/gl_functions.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include +#include // Pointers to OpenGL ES functions. They must be // initialized by the platform at linking time. diff --git a/platform/default/src/mbgl/storage/http_file_source.cpp b/platform/default/src/mbgl/storage/http_file_source.cpp index 09bb87faa..dc002a0d8 100644 --- a/platform/default/src/mbgl/storage/http_file_source.cpp +++ b/platform/default/src/mbgl/storage/http_file_source.cpp @@ -357,6 +357,7 @@ size_t HTTPRequest::headerCallback(char *const buffer, const size_t size, const baton->response = std::make_unique(); } + // NOLINTBEGIN(bugprone-assignment-in-if-condition) const size_t length = size * nmemb; size_t begin = std::string::npos; if ((begin = headerMatches("last-modified: ", buffer, length)) != std::string::npos) { @@ -379,6 +380,7 @@ size_t HTTPRequest::headerCallback(char *const buffer, const size_t size, const } else if ((begin = headerMatches("x-rate-limit-reset: ", buffer, length)) != std::string::npos) { baton->xRateLimitReset = std::string(buffer + begin, length - begin - 2); // remove \r\n } + // NOLINTEND(bugprone-assignment-in-if-condition) return length; } diff --git a/platform/default/src/mbgl/util/jpeg_reader.cpp b/platform/default/src/mbgl/util/jpeg_reader.cpp index c7f5e6a9b..72db47687 100644 --- a/platform/default/src/mbgl/util/jpeg_reader.cpp +++ b/platform/default/src/mbgl/util/jpeg_reader.cpp @@ -27,7 +27,7 @@ static void init_source(j_decompress_ptr cinfo) { static boolean fill_input_buffer(j_decompress_ptr cinfo) { auto* wrap = reinterpret_cast(cinfo->src); - wrap->stream->read(reinterpret_cast(&wrap->buffer[0]), BUF_SIZE); + wrap->stream->read(reinterpret_cast(wrap->buffer.data()), BUF_SIZE); std::streamsize size = wrap->stream->gcount(); wrap->manager.next_input_byte = wrap->buffer.data(); wrap->manager.bytes_in_buffer = BUF_SIZE; diff --git a/platform/linux/linux.cmake b/platform/linux/linux.cmake index 88a867806..307948ac6 100644 --- a/platform/linux/linux.cmake +++ b/platform/linux/linux.cmake @@ -137,7 +137,9 @@ target_link_libraries( add_subdirectory(${PROJECT_SOURCE_DIR}/bin) add_subdirectory(${PROJECT_SOURCE_DIR}/expression-test) add_subdirectory(${PROJECT_SOURCE_DIR}/platform/glfw) -add_subdirectory(${PROJECT_SOURCE_DIR}/platform/node) +if(MLN_WITH_NODE) + add_subdirectory(${PROJECT_SOURCE_DIR}/platform/node) +endif() add_executable( mbgl-test-runner diff --git a/platform/macos/macos.cmake b/platform/macos/macos.cmake index 71f8f6564..105c60f7f 100644 --- a/platform/macos/macos.cmake +++ b/platform/macos/macos.cmake @@ -102,7 +102,9 @@ target_link_libraries( add_subdirectory(${PROJECT_SOURCE_DIR}/bin) add_subdirectory(${PROJECT_SOURCE_DIR}/expression-test) add_subdirectory(${PROJECT_SOURCE_DIR}/platform/glfw) -add_subdirectory(${PROJECT_SOURCE_DIR}/platform/node) +if(MLN_WITH_NODE) + add_subdirectory(${PROJECT_SOURCE_DIR}/platform/node) +endif() add_executable( mbgl-test-runner diff --git a/platform/node/DEVELOPING.md b/platform/node/DEVELOPING.md index c59eab562..b8919797b 100644 --- a/platform/node/DEVELOPING.md +++ b/platform/node/DEVELOPING.md @@ -48,13 +48,13 @@ To compile the Node.js bindings and install module dependencies, from the reposi #### MacOS ```bash -cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Debug -DMBGL_WITH_COVERAGE=ON +cmake . -B build -G Ninja -DMLN_WITH_NODE=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Debug -DMBGL_WITH_COVERAGE=ON ``` #### Linux ```bash -cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 +cmake . -B build -G Ninja -DMLN_WITH_NODE=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 ``` ### Building @@ -88,8 +88,6 @@ To clean up your pull request and prepare it for merging, update your local `mai ## Publishing -We aim to publish the `@mapbox/mapbox-gl-native` package on the same four-week cadence as the iOS, Android, and JavaScript SDKs, including a beta release one week prior to the final release. Responsibility for publishing rotates between team members. - To publish a new version of the package: - [ ] make a commit in the release branch which includes: - [ ] an updated version number in [`package.json`](../../package.json#L3) diff --git a/platform/windows/windows.cmake b/platform/windows/windows.cmake index 85e73ffa2..2db7de33c 100644 --- a/platform/windows/windows.cmake +++ b/platform/windows/windows.cmake @@ -183,7 +183,9 @@ target_link_libraries( add_subdirectory(${PROJECT_SOURCE_DIR}/bin) add_subdirectory(${PROJECT_SOURCE_DIR}/expression-test) add_subdirectory(${PROJECT_SOURCE_DIR}/platform/glfw) -add_subdirectory(${PROJECT_SOURCE_DIR}/platform/node) +if(MLN_WITH_NODE) + add_subdirectory(${PROJECT_SOURCE_DIR}/platform/node) +endif() add_executable( mbgl-test-runner diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp index dbdb94260..0249aec59 100644 --- a/src/mbgl/text/placement.cpp +++ b/src/mbgl/text/placement.cpp @@ -394,6 +394,8 @@ JointPlacement Placement::placeSymbol(const SymbolInstance& symbolInstance, cons const size_t anchorsSize = variableTextAnchors.size(); const size_t placementAttempts = ctx.textAllowOverlap ? anchorsSize * 2 : anchorsSize; for (size_t i = 0u; i < placementAttempts; ++i) { + // when anchorsSize is 0, placementAttempts is also 0, so this code would not be reached + // NOLINTNEXTLINE(clang-analyzer-core.DivideZero) auto anchor = variableTextAnchors[i % anchorsSize]; const bool allowOverlap = (i >= anchorsSize); shift = calculateVariableLayoutOffset(anchor, diff --git a/test/src/mbgl/test/getrss.hpp b/test/src/mbgl/test/getrss.hpp index be45ae889..27b538b02 100644 --- a/test/src/mbgl/test/getrss.hpp +++ b/test/src/mbgl/test/getrss.hpp @@ -16,7 +16,7 @@ #include #elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__) -#include +#include #endif diff --git a/vendor/earcut.hpp b/vendor/earcut.hpp index 4811a2b69..0d0897a9d 160000 --- a/vendor/earcut.hpp +++ b/vendor/earcut.hpp @@ -1 +1 @@ -Subproject commit 4811a2b69b91f6127a75e780de6e2113609ddabb +Subproject commit 0d0897a9dc462edf6396aedb335ddeb4aa302b78