Skip to content

Copy config file only if its supported by target (#670) (#1085) #943

Copy config file only if its supported by target (#670) (#1085)

Copy config file only if its supported by target (#670) (#1085) #943

Workflow file for this run

name: buildmgr
on:
workflow_call:
pull_request:
paths:
- '.github/workflows/buildmgr.yml'
- '.github/matrix_includes_buildmgr.json'
- 'CMakeLists.txt'
- 'libs/crossplatform/**'
- 'libs/errlog/**'
- 'libs/xmlreader/**'
- 'libs/xmltree/**'
- 'libs/xmltreeslim/**'
- 'libs/rteutils/**'
- 'libs/rtemodel/**'
- 'libs/rtefsutils/**'
- 'tools/buildmgr/**'
- '!**/docs/**/*'
- '!**/*.md'
push:
branches:
- main
paths:
- '.github/workflows/buildmgr.yml'
- '.github/matrix_includes_buildmgr.json'
- 'CMakeLists.txt'
- 'libs/crossplatform/**'
- 'libs/errlog/**'
- 'libs/xmlreader/**'
- 'libs/xmltree/**'
- 'libs/xmltreeslim/**'
- 'libs/rteutils/**'
- 'libs/rtemodel/**'
- 'libs/rtefsutils/**'
- 'tools/buildmgr/**'
- '!**/docs/**/*'
- '!**/*.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 == 'release' && startsWith(github.ref, 'refs/tags/tools/buildmgr/')) || ((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: buildmgr
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@v3
with:
submodules: true
# https://github.com/Open-CMSIS-Pack/devtools-build-action
- name: Build
uses: Open-CMSIS-Pack/devtools-build-action@arm64
id: devtools-build
with:
target: cbuildgen
arch: ${{ matrix.arch }}
- name: Archive cbuildgen
uses: actions/upload-artifact@v3
with:
name: cbuildgen-${{ matrix.target }}-${{ matrix.arch }}
path: ./build/tools/buildmgr/cbuildgen/${{ matrix.target }}-${{ matrix.arch }}/Release/cbuildgen${{ matrix.binary_extension }}
retention-days: ${{ needs.setup.outputs.retention_days }}
if-no-files-found: error
docs:
needs: setup
if: |
(github.event_name == 'pull_request') ||
(github.event_name == 'push') ||
(github.event_name == 'release' && startsWith(github.ref, 'refs/tags/tools/buildmgr/')) ||
(needs.setup.outputs.nightly == 'true')
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- name: Checkout devtools
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: ${{ github.event_name == 'push' && '0' || '1' }}
- name: Install deps
run: |
sudo apt-get update
sudo apt-get install ninja-build python3
wget -q http://launchpadlibrarian.net/163827726/doxygen_1.8.6-2_amd64.deb
sudo dpkg -i doxygen_1.8.6-2_amd64.deb
sudo pip install LinkChecker
- name: Create build folder
run: mkdir build
- name: Build documentation
run: |
cmake -G Ninja ..
echo "::add-matcher::.github/doxygen.json"
cmake --build . --target buildmgr-docs
echo "::remove-matcher owner=doxygen::"
working-directory: ./build
- name: Run linkchecker
run: |
echo "::add-matcher::.github/linkchecker.json"
../scripts/check_links.sh tools/buildmgr/docs/doxygen/output/html/index.html ../tools/buildmgr/docs/doxygen/Build/src/
echo "::remove-matcher owner=linkchecker::"
working-directory: ./build
- name: Upload documentation
uses: actions/upload-artifact@v3
with:
name: documentation
path: ./build/tools/buildmgr/docs/doxygen/output/
retention-days: ${{ needs.setup.outputs.retention_days }}
if-no-files-found: error
- name: Archive documentation
if: ${{ github.event_name == 'push' || github.event_name == 'release' }}
run: tar -cvjf /tmp/doc.tbz2 .
working-directory: ./build/tools/buildmgr/docs/doxygen/output/html/
- uses: actions/checkout@v3
if: ${{ github.event_name == 'push' || github.event_name == 'release' }}
with:
ref: gh-pages
- name: Publish main branch documentation
if: ${{ !github.event.repository.private && github.event_name == 'push' }}
run: |
BRANCH=${GITHUB_REF##refs/heads/}
rm -rf buildmgr/${BRANCH}
mkdir -p buildmgr/${BRANCH}
pushd buildmgr/${BRANCH}
tar -xvjf /tmp/doc.tbz2
popd
git config user.name github-actions
git config user.email [email protected]
git add buildmgr/${BRANCH}
git commit -m "Update buildmgr main branch documentation"
git push
- name: Publish release documentation
if: ${{ !github.event.repository.private && github.event_name == 'release' }}
run: |
VERSION=$(git show-ref ${{ github.ref }} | awk -F/ '{print $NF}')
rm -rf buildmgr/${VERSION}
rm -f buildmgr/latest
mkdir -p buildmgr/${VERSION}
ln -s ${VERSION}/ buildmgr/latest
pushd buildmgr/${VERSION}
tar -xvjf /tmp/doc.tbz2
popd
git config user.name github-actions
git config user.email [email protected]
git add buildmgr/${VERSION}
git add buildmgr/latest
git commit -m "Update buildmgr documentation for release ${VERSION}"
git push
create_installer:
needs: [ setup, build, docs ]
# Debian package generation in ubuntu 22.04 produces incompatible metadata
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- name: Install deps
run: |
sudo apt-get update
sudo apt-get install \
build-essential \
debhelper \
devscripts \
python3
- name: Checkout devtools
uses: actions/checkout@v3
- name: Create distribution folders
run: |
mkdir -p tools/buildmgr/cbuildgen/distribution/bin
mkdir -p tools/buildmgr/cbuildgen/distribution/doc
- name: Download cbuildgen linux-amd64
uses: actions/download-artifact@v3
with:
name: cbuildgen-linux-amd64
path: tools/buildmgr/cbuildgen/distribution/bin/
- name: Download cbuildgen linux-arm64
uses: actions/download-artifact@v3
with:
name: cbuildgen-linux-arm64
path: tools/buildmgr/cbuildgen/distribution/bin/
- name: Download cbuildgen macos-amd64
if: ${{ !github.event.repository.private }}
uses: actions/download-artifact@v3
with:
name: cbuildgen-darwin-amd64
path: tools/buildmgr/cbuildgen/distribution/bin/
- name: Download cbuildgen macos-arm64
if: ${{ !github.event.repository.private }}
uses: actions/download-artifact@v3
with:
name: cbuildgen-darwin-arm64
path: tools/buildmgr/cbuildgen/distribution/bin/
- name: Download cbuildgen windows-amd64
uses: actions/download-artifact@v3
with:
name: cbuildgen-windows-amd64
path: tools/buildmgr/cbuildgen/distribution/bin/
- name: Download cbuildgen windows-arm64
uses: actions/download-artifact@v3
with:
name: cbuildgen-windows-arm64
path: tools/buildmgr/cbuildgen/distribution/bin/
- name: Adding execution permission to the binaries
run: |
chmod +x *
working-directory: tools/buildmgr/cbuildgen/distribution/bin
- name: Download documentation
uses: actions/download-artifact@v3
with:
name: documentation
path: tools/buildmgr/cbuildgen/distribution/doc/
- name: Create installer
run: sudo ./create_installer.sh --input=../distribution --output=.
working-directory: tools/buildmgr/cbuildgen/installer
- name: Create deb package
run: yes | sudo ./make_deb.sh --input=../distribution --output=.
working-directory: tools/buildmgr/cbuildgen/installer
- name: Archive cbuild_install.sh
uses: actions/upload-artifact@v3
with:
name: cbuild_install
path: tools/buildmgr/cbuildgen/installer/cbuild_install.sh
retention-days: ${{ needs.setup.outputs.retention_days }}
if-no-files-found: error
- name: Archive deb package
uses: actions/upload-artifact@v3
with:
name: deb_package
path: tools/buildmgr/cbuildgen/installer/cmsis-build*.deb
retention-days: ${{ needs.setup.outputs.retention_days }}
if-no-files-found: error
- name: Attach installer to release
if: ${{ github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: tools/buildmgr/cbuildgen/installer/cbuild_install.sh
tag: ${{ github.ref }}
overwrite: true
asset_name: cbuild_install.sh
- name: Attach debian installer to release
if: ${{ github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: tools/buildmgr/cbuildgen/installer/cmsis-build*.deb
file_glob: true
tag: ${{ github.ref }}
overwrite: true
tests:
needs: [ setup, matrix_prep, create_installer ]
timeout-minutes: 15
runs-on: ${{ matrix.runs_on }}
env:
arm_gcc_install_base: ${{ matrix.arm_gcc_install_base }}
CI_CBUILD_DEB_PKG: ${{ github.workspace }}
CI_CBUILD_INSTALLER: ${{ github.workspace }}/cbuild_install.sh
CMSIS_PACK_ROOT: ${{ github.workspace }}/packs
GCC_TOOLCHAIN_ROOT: ${{ github.workspace }}/${{ matrix.toolchain_root }}
CI_ARCH: ${{ matrix.arch }}
strategy:
#fail-fast: true
matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix) }}
steps:
- name: Install macos deps
if: ${{ startsWith(matrix.runs_on, 'macos') }}
run: |
brew install \
dos2unix \
ninja \
wget
- name: Install linux deps
if: ${{ startsWith(matrix.runs_on, 'ubuntu') }}
run: |
sudo apt-get update
sudo apt-get install \
dos2unix \
ninja-build \
libxml2-utils
- name: Install windows deps
if: ${{ startsWith(matrix.runs_on, 'windows') }}
run: choco install -y unzip wget ninja
- name: Checkout devtools
uses: actions/checkout@v3
with:
submodules: true
- name: Cache ARM GCC
uses: actions/cache@v3
with:
key: "${{ matrix.arm_gcc_install_base }}/${{ matrix.installer_name }}"
path: ${{ matrix.installer_name }}
- name: Setup ARM GCC for Ubuntu and macOS
if: ${{ startsWith(matrix.runs_on, 'macos') || startsWith(matrix.runs_on, 'ubuntu') }}
env:
installer_name: ${{ matrix.installer_name }}
run: |
test -f ${installer_name} || wget -q ${arm_gcc_install_base}/${installer_name}
tar -xvf ${installer_name}
- name: Setup ARM GCC for Windows
if: ${{ startsWith(matrix.runs_on, 'windows') }}
env:
installer_name: ${{ matrix.installer_name }}
run: |
if (!(Test-Path $Env:installer_name -PathType Leaf)) {
wget -q $Env:arm_gcc_install_base/$Env:installer_name
}
unzip -o $Env:installer_name
- name: Cache CMSIS Pack
uses: actions/cache@v3
env:
CACHE_NAME: cmsis_pack
with:
key: ${{ env.CACHE_NAME }}-${{ matrix.runs_on }}
path: ${{ env.CMSIS_PACK_ROOT }}
- name: Download cbuild_install
uses: actions/download-artifact@v3
with:
name: cbuild_install
path: ${{ github.workspace }}
- name: Download deb_package
uses: actions/download-artifact@v3
with:
name: deb_package
path: ${{ github.workspace }}
- name: Set correct cbuild_install file permission
if: ${{ startsWith(matrix.runs_on, 'macos') || startsWith(matrix.runs_on, 'ubuntu') }}
run: chmod +x cbuild_install.sh
# https://github.com/Open-CMSIS-Pack/devtools-build-action
- name: Build CbuildUnitTests
uses: Open-CMSIS-Pack/devtools-build-action@arm64
with:
target: CbuildUnitTests
build_type: Debug
arch: ${{ matrix.arch }}
- name: Run CbuildUnitTests
if: matrix.arch != 'arm64'
run: ctest -V -R CbuildUnitTests
working-directory: build
- name: Archive unittest
if: always() && (matrix.arch != 'arm64')
uses: actions/upload-artifact@v3
with:
name: unit_test_result-${{ matrix.target }}-${{ matrix.arch }}
path: ./build/test_reports/cbuildunittests-*.xml
retention-days: ${{ needs.setup.outputs.retention_days }}
if-no-files-found: error
# https://github.com/Open-CMSIS-Pack/devtools-build-action
- name: Build CbuildIntegTests
uses: Open-CMSIS-Pack/devtools-build-action@arm64
with:
target: CbuildIntegTests
build_type: Debug
arch: ${{ matrix.arch }}
- name: Run Cbuild Integration Tests (excl. AC5, AC6, MultiTargetAC6Tests) for Linux amd64
if: ${{ startsWith(matrix.runs_on, 'ubuntu') && matrix.arch == 'amd64' }}
run: ./tools/buildmgr/test/integrationtests/${{ matrix.target }}-${{ matrix.arch }}/Debug/CbuildIntegTests --gtest_filter=-*AC5*:*AC6*:*MultiTargetAC6Tests* --gtest_output=xml:test_reports/cbuildintegtests-report-${{ matrix.target }}-${{ matrix.arch }}.xml
working-directory: build
- name: Run Cbuild Integration Tests (excl. AC5, AC6, MultiTargetAC6Tests) for Linux arm64
if: ${{ startsWith(matrix.runs_on, 'ubuntu') && matrix.arch == 'arm64' }}
run: /usr/bin/qemu-aarch64 -L /usr/aarch64-linux-gnu ./tools/buildmgr/test/integrationtests/${{ matrix.target }}-${{ matrix.arch }}/Debug/CbuildIntegTests --gtest_filter=-*AC5*:*AC6*:*MultiTargetAC6Tests* --gtest_output=xml:test_reports/cbuildintegtests-report-${{ matrix.target }}-${{ matrix.arch }}.xml
working-directory: build
- name: Run Cbuild Integration Tests (excl. DebPkgTests, AC5, AC6, MultiTargetAC6Tests) for macOS
if: ${{ startsWith(matrix.runs_on, 'macos') && matrix.arch == 'amd64' }}
run: ./tools/buildmgr/test/integrationtests/${{ matrix.target }}-${{ matrix.arch }}/Debug/CbuildIntegTests --gtest_filter=-*DebPkgTests*:*AC5*:*AC6*:*MultiTargetAC6Tests* --gtest_output=xml:test_reports/cbuildintegtests-report-${{ matrix.target }}-${{ matrix.arch }}.xml
working-directory: build
- name: Run Cbuild Integration Tests (excl. DebPkgTests, AC5, AC6, MultiTargetAC6Tests) for Windows
if: ${{ startsWith(matrix.runs_on, 'windows') && matrix.arch == 'amd64' }}
run: .\tools\buildmgr\test\integrationtests\${{ matrix.target }}-${{ matrix.arch }}\Debug\CbuildIntegTests.exe --gtest_filter=-*DebPkgTests*:*AC5*:*AC6*:*MultiTargetAC6Tests* --gtest_output=xml:test_reports/cbuildintegtests-report-${{ matrix.target }}-${{ matrix.arch }}.xml
working-directory: build
- name: Archive Cbuild Integration Tests
if: always() && ((matrix.arch == 'amd64') || (startsWith(matrix.runs_on, 'ubuntu')))
uses: actions/upload-artifact@v3
with:
name: integ_test_result-${{ matrix.target }}-${{ matrix.arch }}
path: ./build/test_reports/cbuildintegtests-report-${{ matrix.target }}-${{ matrix.arch }}.xml
retention-days: ${{ needs.setup.outputs.retention_days }}
if-no-files-found: error
coverage:
if: |
(github.event_name == 'pull_request') ||
(github.event_name == 'push') ||
(github.event_name == 'release' && startsWith(github.ref, 'refs/tags/tools/buildmgr/')) ||
((github.event.schedule != '') && (!github.event.repository.private))
env:
installer_name: "gcc-arm-11.2-2022.02-x86_64-arm-none-eabi.tar.xz"
arm_gcc_install_base: https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel
lcov_base: https://github.com/linux-test-project/lcov/releases/download/v1.15/
lcov_installer: lcov-1.15.tar.gz
CMSIS_PACK_ROOT: ${{ github.workspace }}/packs
GCC_TOOLCHAIN_ROOT: ${{ github.workspace }}/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi/bin
runs-on: ubuntu-22.04
timeout-minutes: 15
strategy:
fail-fast: true
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install \
bc \
build-essential \
ninja-build \
lcov
- name: Checkout devtools
uses: actions/checkout@v3
with:
submodules: recursive
- name: Create build folder
run: mkdir build
- name: Cache ARM GCC
uses: actions/cache@v3
with:
key: "${{ env.arm_gcc_install_base }}/${{ env.installer_name }}"
path: ${{ env.installer_name }}
- name: Setup ARM GCC for Ubuntu
run: |
test -f ${{ env.installer_name }} || wget -q ${{ env.arm_gcc_install_base }}/${{ env.installer_name }}
tar -xvf ${{ env.installer_name }}
- name: Cache CMSIS Pack
uses: actions/cache@v3
env:
CACHE_NAME: cmsis_pack
with:
key: ${{ env.CACHE_NAME }}-${{ runner.os }}
path: ${{ env.CMSIS_PACK_ROOT }}
- name: Build and run buildmgr tests
run: |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=ON ..
cmake --build . --target CbuildUnitTests
./tools/buildmgr/test/unittests/linux-amd64/Debug/CbuildUnitTests --gtest_output=xml:test_reports/cbuildunittests-report-linux-amd64.xml
cmake --build . --target CbuildIntegTests
./tools/buildmgr/test/integrationtests/linux-amd64/Debug/CbuildIntegTests --gtest_filter=-*AC5*:*AC6*:*MultiTargetAC6Tests*:*DebPkgTests*:*InstallerTests* --gtest_output=xml:test_reports/cbuildintegtests-report-linux-amd64.xml
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 unittest
if: (github.event_name == 'push')
uses: actions/upload-artifact@v3
with:
name: unit_test_result-linux-amd64
path: ./build/test_reports/cbuildunittests-*.xml
retention-days: ${{ steps.var.outputs.retention_days }}
if-no-files-found: error
- name: Archive Cbuild Integration Tests
if: (github.event_name == 'push')
uses: actions/upload-artifact@v3
with:
name: integ_test_result-linux-amd64
path: ./build/test_reports/cbuildintegtests-*.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/buildmgr
- 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/buildmgr/cbuild/*' '*/tools/buildmgr/cbuildgen/*' '*/tools/buildmgr/cbuild/*' -o coverage_buildmgr.info
genhtml coverage_buildmgr.info --output-directory coverage_buildmgr --branch-coverage
working-directory: ./build/tools/buildmgr
- name: Upload Report to Codecov
if: ${{ !github.event.repository.private }}
uses: Wandalen/[email protected]
with:
action: codecov/codecov-action@v3
with: |
files: ./build/tools/buildmgr/coverage_buildmgr.info
fail_ci_if_error: true
flags: buildmgr-cov
functionalities: fix
attempt_limit: 3
attempt_delay: 5000
- name: Archive coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: |
./build/tools/buildmgr/coverage_buildmgr/
./build/tools/buildmgr/coverage_buildmgr.info
retention-days: ${{ steps.var.outputs.retention_days }}
if-no-files-found: error
sanity-check-native:
needs: [ matrix_prep, create_installer ]
timeout-minutes: 15
runs-on: ${{ matrix.runs_on }}
env:
CMSIS_PACK_ROOT: ${{ github.workspace }}/packs
AC6_TOOLCHAIN_ROOT: ""
AC5_TOOLCHAIN_ROOT: ""
GCC_TOOLCHAIN_ROOT: ""
strategy:
fail-fast: true
matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix) }}
steps:
- name: Download cbuild_install
uses: actions/download-artifact@v3
with:
name: cbuild_install
path: ${{ github.workspace }}
- name: Set correct cbuild_install file permission
if: ${{ startsWith(matrix.runs_on, 'macos') || startsWith(matrix.runs_on, 'ubuntu') }}
run: chmod +x cbuild_install.sh
- name: Run cbuild_install.sh
shell: bash
run: |
echo "${{ github.workspace }}/cbuild" > config
echo "$CMSIS_PACK_ROOT" >> config
echo "$AC6_TOOLCHAIN_ROOT" >> config
echo "$AC5_TOOLCHAIN_ROOT" >> config
echo "$GCC_TOOLCHAIN_ROOT" >> config
./cbuild_install.sh < config
- name: Test cbuildgen
shell: bash
run: |
${{ github.workspace }}/cbuild/bin/cbuildgen | grep "(cbuildgen): Build Process Manager"
sanity-check-docker:
needs: create_installer
timeout-minutes: 15
runs-on: ubuntu-22.04
container:
image: ${{ matrix.image }}
env:
CMSIS_PACK_ROOT: ${{ github.workspace }}/packs
AC6_TOOLCHAIN_ROOT: ""
AC5_TOOLCHAIN_ROOT: ""
GCC_TOOLCHAIN_ROOT: ""
strategy:
fail-fast: true
matrix:
image: [ "debian:buster" ]
steps:
- name: Download cbuild_install
uses: actions/download-artifact@v3
with:
name: cbuild_install
path: ${{ github.workspace }}
- name: Set correct cbuild_install file permission
run: chmod +x cbuild_install.sh
- name: Run cbuild_install.sh
shell: bash
run: |
echo "${{ github.workspace }}/cbuild" > config
echo "$CMSIS_PACK_ROOT" >> config
echo "$AC6_TOOLCHAIN_ROOT" >> config
echo "$AC5_TOOLCHAIN_ROOT" >> config
echo "$GCC_TOOLCHAIN_ROOT" >> config
./cbuild_install.sh < config
- name: Test cbuildgen
shell: bash
run: |
${{ github.workspace }}/cbuild/bin/cbuildgen | grep "(cbuildgen): Build Process Manager"
test-results-preparation:
name: "Publish Tests Results"
needs: [ tests ]
runs-on: ubuntu-22.04
steps:
- name: Event File
uses: actions/upload-artifact@v3
with:
name: Event File
path: ${{ github.event_path }}