[projmgr] csolution usage of local_repository.pidx packs #1430 (#1436) #544
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: packgen | |
on: | |
workflow_call: | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/packgen.yml' | |
- '.github/matrix_includes_packgen.json' | |
- 'CMakeLists.txt' | |
- 'libs/crossplatform/**' | |
- 'libs/rtefsutils/**' | |
- 'libs/xmlreader/**' | |
- 'libs/xmltree/**' | |
- 'libs/xmltreeslim/**' | |
- 'tools/packgen/**' | |
- '!**/docs/**/*' | |
- '!**/*.md' | |
pull_request: | |
paths: | |
- '.github/workflows/packgen.yml' | |
- '.github/matrix_includes_packgen.json' | |
- 'CMakeLists.txt' | |
- 'libs/crossplatform/**' | |
- 'libs/rtefsutils/**' | |
- 'libs/xmlreader/**' | |
- 'libs/xmltree/**' | |
- 'libs/xmltreeslim/**' | |
- 'tools/packgen/**' | |
- '!**/*.md' | |
release: | |
types: [published] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
setup: | |
uses: Open-CMSIS-Pack/devtools/.github/workflows/shared_setup_env.yml@main | |
with: | |
run_if: ${{ fromJSON((github.event_name == 'pull_request') || (github.event_name == 'workflow_dispatch') || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/tools/packgen/')) || ((github.event.schedule != '') && (!github.event.repository.private))) }} | |
matrix_prep: | |
needs: setup | |
uses: Open-CMSIS-Pack/devtools/.github/workflows/shared_matrix_prep.yml@main | |
with: | |
workflow_name: packgen | |
build: | |
needs: [ setup, matrix_prep ] | |
runs-on: ${{ matrix.runs_on }} | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: true | |
matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix) }} | |
steps: | |
- name: Checkout devtools | |
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | |
with: | |
submodules: true | |
# https://github.com/Open-CMSIS-Pack/devtools-build-action | |
- name: Build | |
uses: Open-CMSIS-Pack/devtools-build-action@79c0fc7d7bc834eb12aa1e319756deab0dda773f # arm64 | |
id: devtools-build | |
with: | |
target: packgen | |
arch: ${{ matrix.arch }} | |
- name: Archive packgen | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
name: packgen-${{ matrix.target }}-${{ matrix.arch }} | |
path: ./build/tools/packgen/${{ matrix.target }}-${{ matrix.arch }}/Release/${{ matrix.binary }} | |
retention-days: ${{ needs.setup.outputs.retention_days }} | |
if-no-files-found: error | |
release: | |
if: | | |
github.event_name == 'release' && | |
startsWith(github.ref, 'refs/tags/tools/packgen/') | |
needs: [ build, unittest ] | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout devtools | |
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | |
- name: Create distribution folders | |
run: | | |
mkdir -p tools/packgen/distribution/bin tools/packgen/distribution/doc/examples | |
cp tools/packgen/docs/LICENSE.txt tools/packgen/distribution/ | |
cp tools/packgen/docs/packgen.md tools/packgen/distribution/doc/ | |
cp -r tools/packgen/test/data/CMakeTestProject/ tools/packgen/distribution/doc/examples/ | |
cp -r tools/packgen/test/data/CMakeTestMultipleBuilds/ tools/packgen/distribution/doc/examples/ | |
- name: Download packgen linux-amd64 | |
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 | |
with: | |
name: packgen-linux-amd64 | |
path: tools/packgen/distribution/bin/linux-amd64/ | |
- name: Download packgen linux arm64 | |
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 | |
with: | |
name: packgen-linux-arm64 | |
path: tools/packgen/distribution/bin/linux-arm64/ | |
- name: Download packgen macos-amd64 | |
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 | |
with: | |
name: packgen-darwin-amd64 | |
path: tools/packgen/distribution/bin/darwin-amd64/ | |
- name: Download packgen macos-arm64 | |
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 | |
with: | |
name: packgen-darwin-arm64 | |
path: tools/packgen/distribution/bin/darwin-arm64/ | |
- name: Download packgen windows-amd64 | |
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 | |
with: | |
name: packgen-windows-amd64 | |
path: tools/packgen/distribution/bin/windows-amd64/ | |
- name: Download packgen windows-arm64 | |
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 | |
with: | |
name: packgen-windows-arm64 | |
path: tools/packgen/distribution/bin/windows-arm64/ | |
- name: Zip distribution folder | |
run: zip -r packgen.zip * | |
working-directory: tools/packgen/distribution | |
- name: Attach zip archive to release assets | |
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: tools/packgen/distribution/packgen.zip | |
tag: ${{ github.ref }} | |
overwrite: true | |
asset_name: packgen.zip | |
unittest: | |
needs: [ setup, matrix_prep ] | |
runs-on: ${{ matrix.runs_on }} | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: true | |
matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix) }} | |
steps: | |
- name: Checkout devtools | |
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | |
with: | |
submodules: true | |
# https://github.com/Open-CMSIS-Pack/devtools-build-action | |
- name: Build PackGenUnitTests | |
uses: Open-CMSIS-Pack/devtools-build-action@79c0fc7d7bc834eb12aa1e319756deab0dda773f # arm64 | |
with: | |
target: PackGenUnitTests | |
build_type: Debug | |
arch: ${{ matrix.arch }} | |
- name: Run packgen unit tests | |
if: (matrix.arch != 'arm64') | |
run: | | |
ctest -C Debug -R PackGenUnitTests | |
working-directory: ./build | |
- name: Archive unit tests results | |
if: always() && (matrix.arch != 'arm64') | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
name: unit_test_result_packgen-${{ matrix.target }}-${{ matrix.arch }} | |
path: ./build/test_reports/packgenunittests-*.xml | |
retention-days: ${{ needs.setup.outputs.retention_days }} | |
if-no-files-found: error | |
coverage: | |
if: | | |
(github.event_name == 'pull_request') || | |
(github.event_name == 'workflow_dispatch') || | |
(github.event_name == 'push') || | |
(github.event_name == 'release' && startsWith(github.ref, 'refs/tags/tools/packgen/')) || | |
((github.event.schedule != '') && (!github.event.repository.private)) | |
env: | |
lcov_base: https://github.com/linux-test-project/lcov/releases/download/v1.15/ | |
lcov_installer: lcov-1.15.tar.gz | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 15 | |
steps: | |
- name: Install linux deps | |
run: | | |
sudo apt-get update | |
sudo apt-get install \ | |
lcov | |
- name: Checkout devtools | |
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | |
with: | |
submodules: true | |
# https://github.com/Open-CMSIS-Pack/devtools-build-action | |
- name: Build PackGenUnitTests | |
uses: Open-CMSIS-Pack/devtools-build-action@79c0fc7d7bc834eb12aa1e319756deab0dda773f # arm64 | |
with: | |
add_cmake_variables: -DCOVERAGE=ON | |
arch: amd64 | |
build_type: Debug | |
target: PackGenUnitTests | |
- name: Run PackGenUnitTests | |
run: | | |
ctest -V -C Debug -R PackGenUnitTests | |
working-directory: ./build | |
- name: Get retention days | |
id: var | |
run: | | |
echo "retention_days=$(echo '${{ (!github.event.repository.private && (github.event_name == 'push' || github.event.schedule != '')) && '7' || '1' }}')" >> $GITHUB_OUTPUT | |
- name: Archive unit tests results | |
if: (github.event_name == 'push') | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
name: unit_test_result_packgen-linux-amd64 | |
path: ./build/test_reports/packgenunittests-*.xml | |
retention-days: ${{ steps.var.outputs.retention_days }} | |
if-no-files-found: error | |
# Needs to be removed once the bug is resolved | |
# lcov reporting 1.14 on 1.15 version | |
# https://groups.google.com/g/linux.debian.bugs.dist/c/a9SZGCENJ2s?pli=1 | |
- name: Setup lcov1.15 | |
run: | | |
wget -q ${{ env.lcov_base }}/${{ env.lcov_installer }} | |
tar -xvf ${{ env.lcov_installer }} | |
working-directory: ./build/tools/packgen | |
- name: Generate coverage report | |
run: | | |
lcov-1.15/bin/lcov --rc lcov_branch_coverage=1 --rc geninfo_no_exception_branch=1 -c --directory . --output-file full_coverage.info | |
lcov-1.15/bin/lcov --rc lcov_branch_coverage=1 --rc geninfo_no_exception_branch=1 -e full_coverage.info '/tools/packgen/include/*' '*/tools/packgen/src/*' -o coverage_packgen.info | |
genhtml coverage_packgen.info --output-directory coverage_packgen --branch-coverage | |
working-directory: ./build/tools/packgen/ | |
- name: Upload Report to Codecov | |
if: ${{ !github.event.repository.private }} | |
uses: Wandalen/wretry.action@42af9d415b6e955870e984489d2c9b97aabc949f # v3.1.0 | |
with: | |
action: codecov/codecov-action@v4 | |
with: | | |
files: ./build/tools/packgen/coverage_packgen.info | |
fail_ci_if_error: true | |
flags: packgen-cov | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true | |
attempt_limit: 3 | |
attempt_delay: 5000 | |
- name: Archive coverage report | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
name: coverage-report-packgen | |
path: | | |
./build/tools/packgen/coverage_packgen/ | |
./build/tools/packgen/coverage_packgen.info | |
retention-days: ${{ steps.var.outputs.retention_days }} | |
if-no-files-found: error | |
test-results-preparation: | |
name: "Publish Tests Results" | |
needs: [ unittest ] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Event File | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
name: Event File packgen | |
path: ${{ github.event_path }} |