Use Bazel to build XCFramework for release (#1457) #74
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: linux-ci | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- "src/**" | |
- "test/**" | |
- "render-test/**" | |
- "expression-test/**" | |
- "include/**" | |
- ".github/workflows/linux-ci.yml" | |
- "vendor/**" | |
- "CMakeLists.txt" | |
- metrics/linux-gcc8-release-style.json | |
- WORKSPACE | |
- BUILD.bazel | |
- .bazelrc | |
- .bazelversion | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "src/**" | |
- "test/**" | |
- "render-test/**" | |
- "expression-test/**" | |
- "include/**" | |
- ".github/workflows/linux-ci.yml" | |
- "vendor/**" | |
- "CMakeLists.txt" | |
- metrics/linux-gcc8-release-style.json | |
- WORKSPACE | |
- BUILD.bazel | |
- .bazelrc | |
- .bazelversion | |
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 \ | |
libwebp-dev | |
- name: Build MapLibre Native Core | |
env: | |
CI: 1 | |
run: | | |
cmake --version | |
cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Debug -DMLN_WITH_CLANG_TIDY=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DMLN_WITH_COVERAGE=ON | |
cmake --build build --target mbgl-core mbgl-test-runner mbgl-render-test-runner mbgl-expression-test | |
- 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 | |
- name: Archive mbgl-expression-test | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mbgl-expression-test | |
path: build/expression-test/mbgl-expression-test | |
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 | |
expression-test: | |
needs: build | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download mbgl-expression-test | |
uses: actions/download-artifact@v3 | |
with: | |
name: mbgl-expression-test | |
- run: chmod +x ./mbgl-expression-test | |
- name: Run expression test | |
run: ./mbgl-expression-test | |
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 | |
id: render_test | |
run: xvfb-run -a ./mbgl-render-test-runner --manifestPath=metrics/linux-gcc8-release-style.json | |
- name: Upload render test result | |
if: always() && steps.render_test.outcome == 'failure' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: render-test-result | |
path: | | |
metrics/linux-gcc8-release-style.html | |
coverage: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y \ | |
libcurl4-openssl-dev \ | |
libuv1-dev \ | |
libjpeg-dev \ | |
libpng-dev \ | |
libwebp-dev \ | |
libglfw3-dev \ | |
libsqlite3-dev \ | |
xvfb \ | |
x11-xserver-utils | |
- name: Cache Bazel | |
uses: actions/cache@v3 | |
with: | |
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE', 'WORKSPACE.bazel', 'MODULE.bazel') }} | |
restore-keys: | | |
${{ runner.os }}-bazel- | |
path: ~/.cache/bazel | |
- name: Start server | |
run: | | |
npm install --ignore-scripts | |
node test/storage/server.js & | |
- name: Generate coverage report | |
run: | | |
xvfb-run -a \ | |
bazel coverage --combined_report=lcov --instrumentation_filter="//:mbgl-core" --//:maplibre_platform=linux \ | |
--test_output=errors --local_test_jobs=1 \ | |
--test_env=DISPLAY --test_env=XAUTHORITY --define=CI_BUILD=1 \ | |
//test:core | |
- name: Upload coverage report | |
if: '!cancelled()' | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ${{ env.coverage_report }} | |
fail_ci_if_error: true | |
verbose: true |