Skip to content

CI: add GitHub Actions workflows for build tests #2

CI: add GitHub Actions workflows for build tests

CI: add GitHub Actions workflows for build tests #2

Workflow file for this run

name: Build - FileSystem
on:
workflow_dispatch:
pull_request:
paths:
- '.ci/FileSystem/**'
- .github/workflows/build_fs.yml
- 'Examples/FileSystem/**'
- 'Components/FileSystem/**'
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
examples:
strategy:
fail-fast: false
matrix:
compiler: [AC6, GCC]
runs-on: ubuntu-latest
steps:
- name: Checkout MDK-Middleware
uses: actions/checkout@v4
with:
path: ./MDK-Middleware
- name: Cache packs
uses: actions/cache@v4
with:
key: cmsis-packs-${{ hashFiles('**/*.csolution.yml', '**/*.cproject.yml', '**/*.clayer.yml') }}
restore-keys: |
cmsis-packs-
path: /home/runner/.cache/arm/packs
- name: Prepare vcpkg env
uses: JonatanAntoni/actions/vcpkg@main
with:
config: ./MDK-Middleware/.ci/FileSystem/vcpkg-configuration.json
- name: Initialize CMSIS pack root folder
run: |
cpackget init https://www.keil.com/pack/index.pidx
cpackget update-index
- name: Install required CMSIS packs
working-directory: ./MDK-Middleware/.ci/FileSystem/
run: |
# Create list of used packs - keep pack specification only (remove path/URL)
csolution list packs ./Library/Library.csolution.yml 2>/dev/null | sed 's/ .*//' > packs.txt
csolution list packs ./Examples/Examples.csolution.yml 2>/dev/null | sed 's/ .*//' >> packs.txt
# Remove MDK-Middleware from the list
sed -i '/.*MDK-Middleware.*/d' packs.txt
# Keep only leters, numbers, ':', '@', '.', '_' and '-'
sed -i 's/[^a-zA-Z0-9:@._-]//g' packs.txt
# Remove duplicates from the list and create final list
awk '!seen[$0]++' packs.txt | tee pack_list.txt
# Install required packs
cpackget add -a -n -f pack_list.txt
- name: Use local MDK-Middleware pack
working-directory: ./MDK-Middleware/
run: |
cpackget rm Keil.MDK-Middleware || true
cpackget add ./Keil.MDK-Middleware.pdsc
- name: Activate Arm tool license
run: |
armlm activate --server https://mdk-preview.keil.arm.com --product KEMDK-COM0
- uses: ammaraskar/gcc-problem-matcher@master
- name: Build FileSystem sources
working-directory: ./MDK-Middleware/.ci/FileSystem
run: |
cbuild ./Library/Library.csolution.yml --update-rte --toolchain ${{ matrix.compiler }} 2>&1 | tee build_${{ matrix.compiler }}.log || true
- name: Build FileSystem examples
working-directory: ./MDK-Middleware/.ci/FileSystem
run: |
cbuild ./Examples/Examples.csolution.yml --update-rte --toolchain ${{ matrix.compiler }} 2>&1 | tee -a build_${{ matrix.compiler }}.log || true
- name: Create build summary
working-directory: ./MDK-Middleware/.ci/FileSystem
run: |
# Parse build log:
# 1. keep only lines that contain text:
# - "Building context:" or
# - "error csolution:" or
# - "error cbuild: error building" or
# - "error cbuild: exit status" or
# - "cbuild: build finished"
# 2. replace all lines that contain text "error cbuild" with word "ERROR"
# 3. replace all lines that contain text "successfully" with word "OK"
# 4. to all lines that contain text "info", append the next line
sed -n '/Building context:\|error csolution:\|error cbuild: error building\|error cbuild: exit status\|cbuild: build finished/p' build_${{ matrix.compiler }}.log | sed '/error cbuild/s/.*/ERROR/' | sed '/successfully/s/.*/OK/' | sed '/info/ {N;s/\n/ /}' 2>&1 | tee summary_${{ matrix.compiler }}.log
# Return error if text "ERROR" is found in the summary
awk '/ERROR/{print "Build FAILED."; exit 1}' summary_${{ matrix.compiler }}.log
- name: Deactivate Arm tool license
if: always()
run: |
armlm deactivate --product KEMDK-COM0