Skip to content

[pre-commit.ci] pre-commit autoupdate #1320

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #1320

Workflow file for this run

name: linux-ci
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- '*'
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:
pre_job:
runs-on: ubuntu-22.04
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
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"]
linux-build-and-test:
if: needs.pre_job.outputs.should_skip != 'true'
needs: pre_job
strategy:
fail-fast: true
matrix:
renderer: [legacy, drawable]
runs-on: ${{ github.event.pull_request && !github.event.pull_request.draft && 'MapLibre_Native_Linux_16_core' || 'ubuntu-22.04' }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: cpp
- uses: hendrikmuhs/[email protected]
with:
key: ${{ github.job }}
- 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 \
libopengl0
- if: matrix.renderer == 'drawable'
run: echo renderer_flag_cmake=-DMLN_DRAWABLE_RENDERER=ON >> "$GITHUB_ENV"
- if: matrix.renderer == 'legacy'
run: echo renderer_flag_cmake=-DMLN_LEGACY_RENDERER=ON >> "$GITHUB_ENV"
- name: Build MapLibre Native Core
env:
CI: 1
run: |
cmake --version
CI=1 cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Debug -DMLN_WITH_CLANG_TIDY=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DMLN_WITH_COVERAGE=ON ${{ env.renderer_flag_cmake }}
cmake --build build --target mbgl-core mbgl-test-runner mbgl-render-test-runner mbgl-expression-test
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:cpp"
# unit tests
- run: chmod +x build/mbgl-test-runner
- name: Run C++ tests
run: xvfb-run -a build/mbgl-test-runner
# render tests
- run: chmod +x build/mbgl-render-test-runner
- name: Run render test
id: render_test
run: xvfb-run -a build/mbgl-render-test-runner --manifestPath=metrics/linux-${{ matrix.renderer }}.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
# expression tests
- run: chmod +x build/expression-test/mbgl-expression-test
- name: Run expression test
run: build/expression-test/mbgl-expression-test
linux-coverage:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
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 --copt="-DCI_BUILD" \
//test:core //render-test:render-test //expression-test:test
- name: Upload coverage report
if: '!cancelled()'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ env.coverage_report }}
fail_ci_if_error: true
verbose: true
linux-ci-result:
name: Linux CI Result
if: needs.pre_job.outputs.should_skip != 'true' && always()
runs-on: ubuntu-22.04
needs:
- pre_job
- linux-build-and-test
- linux-coverage
steps:
- name: Mark result as failed
if: needs.linux-build-and-test.result != 'success' || needs.linux-coverage.result != 'success'
run: exit 1