]> begriffs open source - cmsis/blob - .github/workflows/corevalidation.yml
Add LLVM LIT/FileCheck tests for Core files
[cmsis] / .github / workflows / corevalidation.yml
1 name: CoreValidation
2 on:
3   workflow_dispatch:
4   pull_request:
5   push:
6     branches: [main]
7   
8 concurrency:
9   group: ${{ github.workflow }}-${{ github.ref }}
10   cancel-in-progress: true
11
12 jobs:
13   build-and-run:
14     
15     strategy:
16       fail-fast: true
17       matrix:
18         compiler: [AC6, GCC, Clang]
19     
20     runs-on: ubuntu-latest
21
22     env:
23       ARM_UBL_ACTIVATION_CODE: ${{ secrets.ARM_UBL_ACTIVATION_CODE }}
24
25     steps:
26       - run: |
27           sudo add-apt-repository ppa:deadsnakes/ppa
28           sudo apt-get install libpython3.9
29
30       - uses: actions/checkout@v3
31
32       - working-directory: /home/runner
33         env:
34           GH_TOKEN: ${{ github.token }}
35         run: |
36           if [ -d Cortex_DFP ]; then
37             cd Cortex_DFP
38             git fetch origin main
39             git checkout -f origin/main
40           else
41             gh repo clone ARM-software/Cortex_DFP
42           fi
43
44       - uses: actions/setup-python@v4
45         with:
46           python-version: '3.10'    
47           cache: 'pip'
48
49       - name: Python requirements
50         run: |
51           pip install -r ./CMSIS/CoreValidation/Project/requirements.txt
52
53       - name: Cache vcpkg
54         uses: actions/cache@v3
55         with:
56           key: vcpkg-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ matrix.compiler }}
57           restore-keys: |
58             vcpkg-${{ runner.os }}-${{ runner.arch }}-
59           path: /home/runner/.vcpkg
60
61       - name: Install LLVM/Clang dependencies
62         if: matrix.compiler == 'Clang'
63         working-directory: /home/runner
64         run: |
65           sudo apt-get update
66           sudo apt-get install libtinfo5
67     
68       - name: Prepare vcpkg env
69         working-directory: ./CMSIS/CoreValidation/Project
70         run: |
71           . <(curl https://aka.ms/vcpkg-init.sh -L)
72           vcpkg x-update-registry --all
73           vcpkg activate
74           
75           echo "Fix library search path for VHT models"
76           echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(dirname $(which VHT_MPS2_Cortex-M3))" >> $GITHUB_ENV
77
78           echo "Fix execute permissions for VHT models"
79           chmod +x $(dirname $(which VHT_MPS2_Cortex-M3))/VHT_*
80
81           echo "Patch CMSIS-Toolbox"
82           pushd $(dirname $(which cbuild))/../etc
83           curl -O https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/buildmgr/cbuildgen/config/AC6.6.18.0.cmake
84           curl -O https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/buildmgr/cbuildgen/config/GCC.10.3.1.cmake
85           curl -O https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/buildmgr/cbuildgen/config/CLANG.16.0.0.cmake
86           curl -O https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/buildmgr/cbuildgen/config/IAR.9.32.1.cmake
87           curl -O https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/buildmgr/cbuildgen/config/CMSIS-Build-Utils.cmake
88           curl -O https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/templates/cdefault.yml
89           curl -O https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/templates/ac6_linker_script.sct
90           curl -O https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/templates/clang_linker_script.ld
91           curl -O https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/templates/gcc_linker_script.ld
92           curl -O https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/templates/iar_linker_script.ifc
93           popd
94
95       - name: Activate Arm tool license
96         working-directory: ./CMSIS/CoreValidation/Project
97         run: |
98           . /home/runner/.vcpkg/vcpkg-init
99           vcpkg activate
100           if [[ -n "${{ env.ARM_UBL_ACTIVATION_CODE }}" ]]; then
101             armlm activate --code ${{ env.ARM_UBL_ACTIVATION_CODE }}
102           else
103             armlm activate --server https://mdk-preview.keil.arm.com --product KEMDK-COM0
104           fi
105         
106       - name: Initialize CodeQL
107         if: matrix.compiler == 'GCC'
108         uses: github/codeql-action/init@v2
109         with:
110           languages: cpp
111           queries: security-and-quality
112
113       - uses: ammaraskar/gcc-problem-matcher@master
114         if: matrix.compiler == 'Clang' || matrix.compiler == 'GCC'
115
116       - name: Build
117         working-directory: ./CMSIS/CoreValidation/Project
118         run: |
119           . /home/runner/.vcpkg/vcpkg-init
120           vcpkg activate
121
122           echo "Register local Cortex_DFP pack"
123           cpackget add /home/runner/Cortex_DFP/ARM.Cortex_DFP.pdsc
124
125           echo "Build test projects ..."
126           ./build.py --verbose -m VHT -c ${{ matrix.compiler }} build || echo "::warning::=== Some configurations failed to build! ==="
127
128       - name: Perform CodeQL Analysis
129         if: ${{ !cancelled() && matrix.compiler == 'GCC' }}
130         uses: github/codeql-action/analyze@v2
131
132       - name: Execute
133         if: ${{ env.ARM_UBL_ACTIVATION_CODE }}
134         working-directory: ./CMSIS/CoreValidation/Project
135         run: |
136           . /home/runner/.vcpkg/vcpkg-init
137           vcpkg activate
138       
139           echo "Run test projects ..."
140           ./build.py --verbose -m VHT -c ${{ matrix.compiler }} -d "CM[047]*" -d "CM3" -d "CM[23]3*" run || echo "::warning::==== Some configurations failed to run! ==="
141
142       - name: Deactivate Arm tool license
143         if: always()
144         working-directory: ./CMSIS/CoreValidation/Project
145         run: |
146           . /home/runner/.vcpkg/vcpkg-init
147           vcpkg activate
148           if [[ -n "${{ env.ARM_UBL_ACTIVATION_CODE }}" ]]; then
149             armlm deactivate --code ${{ env.ARM_UBL_ACTIVATION_CODE }}
150           else
151             armlm deactivate --product KEMDK-COM0
152           fi
153
154       - name: Archive Test Reports
155         if: ${{ !cancelled() && env.ARM_UBL_ACTIVATION_CODE }}
156         uses: actions/upload-artifact@v3
157         with:
158           name: test-results-${{ matrix.compiler }}
159           path: ./CMSIS/CoreValidation/Project/build/*.junit
160
161   event-file:
162     needs: [build-and-run]
163     runs-on: ubuntu-latest
164     steps:
165       - name: Archive event file
166         if: ${{ !cancelled() }}
167         uses: actions/upload-artifact@v3
168         with:
169           name: EventFile
170           path: ${{ github.event_path }}