]> begriffs open source - cmsis/blob - .github/workflows/core.yml
Update workflows and build scripts
[cmsis] / .github / workflows / core.yml
1 name: Core Checks
2 on:
3   workflow_dispatch:
4   pull_request:
5     paths: 
6       - .github/workflows/core.yml
7       - CMSIS/Core/Include/**/*
8       - CMSIS/Core/Source/**/*
9       - CMSIS/Core/Test/**/*
10   push:
11     branches: [main]
12   
13 concurrency:
14   group: ${{ github.workflow }}-${{ github.ref }}
15   cancel-in-progress: true
16
17 env:
18   IAR_VERSION: '9.40.2'
19
20 jobs:
21   lit:
22     runs-on: ubuntu-latest
23
24     env:
25       ARM_UBL_ACTIVATION_CODE: ${{ secrets.ARM_UBL_ACTIVATION_CODE }}
26
27     steps:
28       - uses: actions/checkout@v4
29       
30       - uses: actions/setup-python@v4
31         with:
32           python-version: '3.10'    
33           cache: 'pip'
34
35       - name: Python requirements
36         run: |
37           pip install -r ./CMSIS/Core/Test/requirements.txt
38
39       - name: Cache vcpkg
40         uses: actions/cache@v3
41         with:
42           key: vcpkg-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}
43           restore-keys: |
44             vcpkg-${{ runner.os }}-${{ runner.arch }}-
45           path: /home/runner/.vcpkg
46
47       - name: Install LLVM dependencies and tools
48         working-directory: /home/runner
49         run: |
50           sudo apt-get update
51           sudo apt-get install libtinfo5 llvm-15-tools
52           sudo ln -s /usr/bin/FileCheck-15 /usr/bin/FileCheck
53     
54       - name: Prepare vcpkg env
55         working-directory: ./CMSIS/Core/Test
56         run: |
57           . <(curl https://aka.ms/vcpkg-init.sh -L)
58           vcpkg x-update-registry --all
59           vcpkg activate
60
61       - name: Cache IAR Toolchain
62         uses: actions/cache@v3
63         with:
64           key: bxarm-${{env.IAR_VERSION}}-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}
65           restore-keys: |
66             bxarm-${{env.IAR_VERSION}}-${{ runner.os }}-${{ runner.arch }}-
67           path: bxarm-${{env.IAR_VERSION}}.deb
68
69       - name: Install IAR Toolchain
70         run: |
71           if [ ! -f bxarm-${{env.IAR_VERSION}}.deb ]; then
72             curl -LO http://files.iar.com/ftp/pub/box/bxarm-${{env.IAR_VERSION}}.deb
73           fi
74           sudo dpkg -i bxarm-${{env.IAR_VERSION}}.deb
75           echo "/opt/iarsystems/bxarm/arm/bin" >> "$GITHUB_PATH"
76           echo "IAR_TOOLCHAIN_${IAR_VERSION//./_}=/opt/iarsystems/bxarm/arm/bin" >> "$GITHUB_ENV"
77           # TODO: activate license
78
79       - name: Activate Arm tool license
80         working-directory: ./CMSIS/Core/Test
81         run: |
82           . /home/runner/.vcpkg/vcpkg-init
83           vcpkg activate
84           if [[ -n "${{ env.ARM_UBL_ACTIVATION_CODE }}" ]]; then
85             armlm activate --code ${{ env.ARM_UBL_ACTIVATION_CODE }}
86           else
87             armlm activate --server https://mdk-preview.keil.arm.com --product KEMDK-COM0
88           fi
89
90       - uses: ammaraskar/gcc-problem-matcher@master
91
92       - name: Run LIT
93         working-directory: ./CMSIS/Core/Test
94         run: |
95           . /home/runner/.vcpkg/vcpkg-init
96           vcpkg activate
97
98           ./build.py lit
99
100       - name: Deactivate Arm tool license
101         if: always()
102         working-directory: ./CMSIS/Core/Test
103         run: |
104           . /home/runner/.vcpkg/vcpkg-init
105           vcpkg activate
106           if [[ -n "${{ env.ARM_UBL_ACTIVATION_CODE }}" ]]; then
107             armlm deactivate --code ${{ env.ARM_UBL_ACTIVATION_CODE }}
108           else
109             armlm deactivate --product KEMDK-COM0
110           fi
111
112       - name: Publish Test Results
113         if: ${{ !cancelled() && env.ARM_UBL_ACTIVATION_CODE }}
114         uses: EnricoMi/publish-unit-test-result-action@v2
115         with:
116           report_individual_runs: true
117           files: ./CMSIS/Core/Test/*.xunit