Wip windows #26
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: Coverage Report | |
on: | |
workflow_dispatch: # Manual trigger | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- labeled | |
- unlabeled | |
paths-ignore: | |
- .gitignore | |
- CONTRIBUTORS | |
- LICENSE | |
- NOTICE | |
- README.md | |
- docs/** | |
- packaging/** | |
- platform/*apple* | |
- platform/*_android* | |
- platform/*_ios* | |
- platform/*_mac* | |
- platform/*_win* | |
- pyhelpers/** | |
- tools/** | |
- '!tools/python/test_server/**' | |
- xcode/** | |
# Cancels previous jobs if the same branch or PR was updated again. | |
concurrency: | |
group: ${{ github.workflow }}-coverage-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
should-run-check: | |
name: Should run coverage | |
runs-on: ubuntu-24.04 | |
outputs: | |
run-from-pr: ${{ steps.run-from-pr.outputs.run-from-pr }} | |
manually-triggered: ${{ steps.manually-triggered.outputs.manually-triggered }} | |
steps: | |
- name: Check if PR has 'Coverage' label | |
id: run-from-pr | |
if: github.event_name == 'pull_request' | |
env: | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
LABEL_NAME="Coverage" | |
LABELS=$(gh pr view https://github.com/$GITHUB_REPOSITORY/pull/$PR_NUMBER --json labels) | |
if echo "$LABELS" | jq -e '.labels[].name' | grep -q "$LABEL_NAME"; then | |
echo "run-from-pr=true" >> $GITHUB_OUTPUT | |
echo "'Coverage' label found in PR." | |
fi | |
- name: Check if manually triggered | |
id: manually-triggered | |
if: github.event_name == 'workflow_dispatch' | |
run: echo "manually-triggered=true" >> $GITHUB_OUTPUT | |
coverage: | |
needs: should-run-check | |
name: Generate coverage report | |
runs-on: ubuntu-24.04 | |
if: ${{ needs.should-run-check.outputs.run-from-pr == 'true' || needs.should-run-check.outputs.manually-triggered == 'true'}} | |
steps: | |
- name: Free disk space by removing .NET, Android and Haskell | |
shell: bash | |
run: | | |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 100 # enough to get all commits for the current day | |
- name: Parallel submodules checkout | |
shell: bash | |
run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20)) | |
- name: Install build tools and dependencies | |
shell: bash | |
run: | | |
sudo apt update -y | |
sudo apt install -y \ | |
ninja-build \ | |
libgl1-mesa-dev \ | |
libglvnd-dev \ | |
qt6-base-dev \ | |
libfreetype-dev \ | |
libharfbuzz-dev \ | |
libqt6svg6-dev \ | |
qt6-positioning-dev \ | |
libqt6positioning6-plugins \ | |
libqt6positioning6 \ | |
llvm \ | |
gcovr | |
- name: Configure | |
shell: bash | |
run: ./configure.sh | |
- name: Configure ccache | |
uses: hendrikmuhs/ccache-action@v1.2 | |
with: | |
key: ${{ github.workflow }}-coverage | |
- name: CMake | |
shell: bash | |
env: | |
CC: clang-18 | |
CXX: clang++-18 | |
CMAKE_C_COMPILER_LAUNCHER: ccache | |
CMAKE_CXX_COMPILER_LAUNCHER: ccache | |
# -g1 should slightly reduce build time. | |
run: | | |
cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug \ | |
-DCMAKE_CXX_FLAGS=-g1 -DCOVERAGE_REPORT=ON | |
- name: Compile | |
shell: bash | |
working-directory: build | |
run: ninja | |
- name: Tests | |
shell: bash | |
working-directory: build | |
env: | |
QT_QPA_PLATFORM: "offscreen" | |
# generator_integration_tests - https://github.com/organicmaps/organicmaps/issues/225 | |
# opening_hours_integration_tests - https://github.com/organicmaps/organicmaps/issues/219 | |
# opening_hours_supported_features_tests - https://github.com/organicmaps/organicmaps/issues/219 | |
# routing_integration_tests - https://github.com/organicmaps/organicmaps/issues/221 | |
# shaders_tests - https://github.com/organicmaps/organicmaps/issues/223 | |
# world_feed_integration_tests - https://github.com/organicmaps/organicmaps/issues/215 | |
CTEST_EXCLUDE_REGEX: "generator_integration_tests|opening_hours_integration_tests|opening_hours_supported_features_tests|routing_benchmarks|routing_integration_tests|routing_quality_tests|search_quality_tests|storage_integration_tests|shaders_tests|world_feed_integration_tests" | |
run: | | |
sudo locale-gen en_US | |
sudo locale-gen en_US.UTF-8 | |
sudo locale-gen es_ES | |
sudo locale-gen es_ES.UTF-8 | |
sudo locale-gen fr_FR | |
sudo locale-gen fr_FR.UTF-8 | |
sudo locale-gen ru_RU | |
sudo locale-gen ru_RU.UTF-8 | |
sudo update-locale | |
ctest -L "omim-test" -E "$CTEST_EXCLUDE_REGEX" --output-on-failure | |
- name: Run coverage report generation | |
shell: bash | |
working-directory: build | |
run: | | |
cmake --build . --target omim_coverage | |
cat coverage_report/summary.txt | |
- name: Archive the coverage report | |
working-directory: build/coverage_report | |
run: zip -r coverage_report.zip html/ | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report | |
path: build/coverage_report/coverage_report.zip |