Linux C++ test & render tests on CI (#1033)

Co-authored-by: rpitre-wetdog <129877142+rpitre-wetdog@users.noreply.github.com>
Co-authored-by: Tadej Novak <tadej@tano.si>
Co-authored-by: Robin <boldtrn@users.noreply.github.com>
Co-authored-by: Siarhei Fedartsou <siarhei.fedartsou@gmail.com>
This commit is contained in:
Bart Louwers
2023-04-22 14:24:42 +02:00
committed by GitHub
parent 33791d5379
commit 453af362cb
14 changed files with 173 additions and 71 deletions

View File

@@ -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

147
.github/workflows/linux-ci.yml vendored Normal file
View File

@@ -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

View File

@@ -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'