Files
MapLibreParticleLab/.github/workflows/linux-ci.yml
Bart Louwers 453af362cb 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>
2023-04-22 14:24:42 +02:00

148 lines
4.5 KiB
YAML

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