ladislas/feature/ci functional system refactor #884
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
# Leka - LekaOS | |
# Copyright 2022 APF France handicap | |
# SPDX-License-Identifier: Apache-2.0 | |
name: Code Analysis - Impact of changes | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
paths-ignore: | |
- "config/arm_gnu_toolchain_url" | |
- ".github/workflows/ci-code_analysis-toolchain_upgrade.yml" | |
- ".github/actions/compare_toolchain_upgrade/**" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# | |
# Mark: - Job - build_base_ref | |
# | |
build_base_ref: | |
name: build base_ref w/ debug | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
enable_log_debug: ["ON", "OFF"] | |
steps: | |
# | |
# Mark: - Setup | |
# | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Setup CI | |
id: setup_ci | |
uses: ./.github/actions/setup | |
with: | |
ccache_key: ${{ runner.os }}-ccache-compare_base_head-build_base_ref-enable_log_debug-(${{ matrix.enable_log_debug }}) | |
ccache_restore_keys: | | |
${{ runner.os }}-ccache-compare_base_head-build_base_ref-enable_log_debug-(${{ matrix.enable_log_debug }})- | |
${{ runner.os }}-ccache-compare_base_head-build_base_ref-enable_log_debug- | |
${{ runner.os }}-ccache-compare_base_head-build_base_ref- | |
${{ runner.os }}-ccache-compare_base_head- | |
${{ runner.os }}-ccache- | |
# | |
# Mark: - Config & build | |
# | |
- name: Config & build | |
id: config_build | |
uses: ./.github/actions/config_build | |
with: | |
enable_log_debug: ${{ matrix.enable_log_debug }} | |
checkout_base_ref: true | |
# | |
# Mark: - Move files | |
# | |
- name: Move ${{ env.BASE_REF }}:${{ env.BASE_SHA }} bin & map files to temporary directory | |
run: | | |
mkdir -p build_artifacts | |
find _build ! -path '*CMakeFiles*' -name "*.bin" -print0 | xargs -0 -I {} cp {} build_artifacts | |
find _build ! -path '*CMakeFiles*' -name "*.map" -print0 | xargs -0 -I {} cp {} build_artifacts | |
find _build ! -path '*CMakeFiles*' -name "*.hex" -print0 | xargs -0 -I {} cp {} build_artifacts | |
find _build ! -path '*CMakeFiles*' -name "*.elf" -print0 | xargs -0 -I {} cp {} build_artifacts | |
# | |
# Mark: - Upload artifacts | |
# | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: base_ref-build-enable_log_debug-${{ matrix.enable_log_debug }} | |
path: build_artifacts | |
retention-days: 1 | |
# | |
# Mark: - Job - build_head_ref | |
# | |
build_head_ref: | |
name: build head_ref w/ debug | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
enable_log_debug: ["ON", "OFF"] | |
steps: | |
# | |
# Mark: - Setup | |
# | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Setup CI | |
id: setup_ci | |
uses: ./.github/actions/setup | |
with: | |
ccache_key: ${{ runner.os }}-ccache-compare_base_head-build_head_ref-enable_log_debug-(${{ matrix.enable_log_debug }}) | |
ccache_restore_keys: | | |
${{ runner.os }}-ccache-compare_base_head-build_head_ref-enable_log_debug-(${{ matrix.enable_log_debug }})- | |
${{ runner.os }}-ccache-compare_base_head-build_head_ref-enable_log_debug- | |
${{ runner.os }}-ccache-compare_base_head-build_head_ref- | |
${{ runner.os }}-ccache-compare_base_head- | |
${{ runner.os }}-ccache- | |
# | |
# Mark: - Config & build | |
# | |
- name: Config & build | |
id: config_build | |
uses: ./.github/actions/config_build | |
with: | |
enable_log_debug: ${{ matrix.enable_log_debug }} | |
checkout_base_ref: false | |
# | |
# Mark: - Move files | |
# | |
- name: Move ${{ env.HEAD_REF }}:${{ env.HEAD_SHA }} bin & map files to temporary directory | |
run: | | |
mkdir -p build_artifacts | |
find _build ! -path '*CMakeFiles*' -name "*.bin" -print0 | xargs -0 -I {} cp {} build_artifacts | |
find _build ! -path '*CMakeFiles*' -name "*.map" -print0 | xargs -0 -I {} cp {} build_artifacts | |
find _build ! -path '*CMakeFiles*' -name "*.hex" -print0 | xargs -0 -I {} cp {} build_artifacts | |
find _build ! -path '*CMakeFiles*' -name "*.elf" -print0 | xargs -0 -I {} cp {} build_artifacts | |
# | |
# Mark: - Upload artifacts | |
# | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: head_ref-build-enable_log_debug-${{ matrix.enable_log_debug }} | |
path: build_artifacts | |
retention-days: 1 | |
# | |
# Mark: - Job - compare_bin_map_files | |
# | |
compare_base_head_changes: | |
name: Compare base/head changes | |
runs-on: ubuntu-22.04 | |
needs: [build_base_ref, build_head_ref] | |
strategy: | |
fail-fast: true | |
matrix: | |
enable_log_debug: ["ON", "OFF"] | |
steps: | |
# | |
# Mark: - Setup | |
# | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Setup CI | |
id: setup_ci | |
uses: ./.github/actions/setup | |
- uses: actions/download-artifact@v4 | |
with: | |
path: build_artifacts | |
- name: Display structure of downloaded files | |
working-directory: build_artifacts | |
run: ls -R | |
- name: Compare base/head files | |
uses: ./.github/actions/compare_base_head_changes | |
with: | |
comment_header: enable_log_debug-${{ matrix.enable_log_debug }} | |
enable_log_debug: ${{ matrix.enable_log_debug }} | |
base_dir: build_artifacts/base_ref-build-enable_log_debug-${{ matrix.enable_log_debug }} | |
head_dir: build_artifacts/head_ref-build-enable_log_debug-${{ matrix.enable_log_debug }} |