Skip to content

Commit

Permalink
Add GH workflow to Core FileChecks
Browse files Browse the repository at this point in the history
  • Loading branch information
JonatanAntoni committed Oct 10, 2023
1 parent 4af5767 commit 001387e
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 7 deletions.
106 changes: 106 additions & 0 deletions .github/workflows/core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Core Checks
on:
workflow_dispatch:
pull_request:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lit:
runs-on: ubuntu-latest

env:
ARM_UBL_ACTIVATION_CODE: ${{ secrets.ARM_UBL_ACTIVATION_CODE }}

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'

- name: Python requirements
run: |
pip install -r ./CMSIS/CoreValidation/Project/requirements.txt
- name: Cache vcpkg
uses: actions/cache@v3
with:
key: vcpkg-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ matrix.compiler }}
restore-keys: |
vcpkg-${{ runner.os }}-${{ runner.arch }}-
path: /home/runner/.vcpkg

- name: Cache LLVM/Clang 17.0.0-devdrop0
uses: actions/cache@v3
with:
key: clang-17.0.0-devdrop0-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}
restore-keys: |
clang-17.0.0-devdrop0-${{ runner.os }}-${{ runner.arch }}-
clang-17.0.0-devdrop0
path: /home/runner/LLVMEmbeddedToolchainForArm-17.0.0-Linux-x86_64

- name: Install LLVM/Clang 17.0.0-devdrop0
working-directory: /home/runner
run: |
sudo apt-get update
sudo apt-get install libtinfo5 llvm-15-tools
sudo ln -s /usr/bin/FileCheck-15 /usr/bin/FileCheck
if [[ ! -d LLVMEmbeddedToolchainForArm-17.0.0-Linux-x86_64 ]]; then
wget https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/preview-17.0.0-devdrop0/LLVMEmbeddedToolchainForArm-17.0.0-Linux-x86_64.tar.xz
tar -xf LLVMEmbeddedToolchainForArm-17.0.0-Linux-x86_64.tar.xz
fi
./LLVMEmbeddedToolchainForArm-17.0.0-Linux-x86_64/bin/clang --version
echo "CLANG_TOOLCHAIN_17_0_0=$(pwd)/LLVMEmbeddedToolchainForArm-17.0.0-Linux-x86_64/bin" >> $GITHUB_ENV
- name: Prepare vcpkg env
working-directory: ./CMSIS/Core/Test
run: |
. <(curl https://aka.ms/vcpkg-init.sh -L)
vcpkg x-update-registry --all
vcpkg activate
- name: Activate Arm tool license
working-directory: ./CMSIS/Core/Test
run: |
. /home/runner/.vcpkg/vcpkg-init
vcpkg activate
if [[ -n "${{ env.ARM_UBL_ACTIVATION_CODE }}" ]]; then
armlm activate --code ${{ env.ARM_UBL_ACTIVATION_CODE }}
else
armlm activate --server https://mdk-preview.keil.arm.com --product KEMDK-COM0
fi
- uses: ammaraskar/gcc-problem-matcher@master

- name: Run LIT
working-directory: ./CMSIS/Core/Test
run: |
. /home/runner/.vcpkg/vcpkg-init
vcpkg activate
./build.py lit
- name: Deactivate Arm tool license
if: always()
working-directory: ./CMSIS/Core/Test
run: |
. /home/runner/.vcpkg/vcpkg-init
vcpkg activate
if [[ -n "${{ env.ARM_UBL_ACTIVATION_CODE }}" ]]; then
armlm deactivate --code ${{ env.ARM_UBL_ACTIVATION_CODE }}
else
armlm deactivate --product KEMDK-COM0
fi
- name: Publish Test Results
if: ${{ !cancelled() && env.ARM_UBL_ACTIVATION_CODE }}
uses: EnricoMi/publish-unit-test-result-action@v2
with:
report_individual_runs: true
files: ./CMSIS/Core/Test/*.xunit
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
**/__pycache__
CMSIS/Documentation/
CMSIS/DoxyGen/**/*.dxy
CMSIS/Core/Test/*.o
CMSIS/Core/Test/*.xunit
CMSIS/CoreValidation/Project/*.zip
CMSIS/CoreValidation/Project/*.junit
CMSIS/CoreValidation/Project/*.clangd
Expand Down
13 changes: 6 additions & 7 deletions CMSIS/Core/Test/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@

from datetime import datetime
from enum import Enum
from glob import glob, iglob
from pathlib import Path

from lxml.etree import XMLSyntaxError
from zipfile import ZipFile

from matrix_runner import main, matrix_axis, matrix_action, matrix_command, matrix_filter, \
ConsoleReport, CropReport, TransformReport, JUnitReport
FileReport, JUnitReport


@matrix_axis("device", "d", "Device(s) to be considered.")
Expand Down Expand Up @@ -67,9 +62,13 @@ def lit(config):
yield run_lit(config.compiler[0], config.device[1], config.optimize[0])


def timestamp():
return datetime.now().strftime('%Y%m%d%H%M%S')

@matrix_command()
def run_lit(toolchain, device, optimize):
return ["lit", "-D", f"toolchain={toolchain}", "-D", f"device={device}", "-D", f"optimize={optimize}", "." ]

return ["lit", "--xunit-xml-output", f"lit-{toolchain}-{optimize}-{device}.xunit", "-D", f"toolchain={toolchain}", "-D", f"device={device}", "-D", f"optimize={optimize}", "." ]

@matrix_filter
def filter_iar(config):
Expand Down
6 changes: 6 additions & 0 deletions CMSIS/Core/Test/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
#
# Python requirements for build.py script
#
python-matrix-runner~=1.0
lit~=17
1 change: 1 addition & 0 deletions CMSIS/Core/Test/systick.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// REQUIRES: unsupported
// RUN: %cc% %ccflags% %ccout% %s.o %s; llvm-objdump -d %s.o | FileCheck --allow-unused-prefixes --check-prefixes %prefixes% %s

#include <stdint.h>
Expand Down
20 changes: 20 additions & 0 deletions CMSIS/Core/Test/vcpkg-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"registries": [
{
"kind": "artifact",
"location": "https://aka.ms/vcpkg-ce-default",
"name": "microsoft"
},
{
"kind": "artifact",
"location": "https://artifacts.keil.arm.com/vcpkg-ce-registry/registry.zip",
"name": "arm"
}
],
"requires": {
"arm:compilers/arm/armclang":"^6.20.0",
"arm:compilers/arm/arm-none-eabi-gcc": "^12.2.1-0",
"arm:compilers/arm/llvm-embedded": "^16.0.0"
}
}

0 comments on commit 001387e

Please sign in to comment.