Skip to content

Commit

Permalink
Migrate CMSIS-CoreValidation to CMSIS-Toolbox build system
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Günther <[email protected]>
  • Loading branch information
grasci-arm and Martin Günther authored Oct 13, 2022
1 parent dde5bac commit e5dc191
Show file tree
Hide file tree
Showing 241 changed files with 27,171 additions and 4,681 deletions.
60 changes: 52 additions & 8 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,72 @@ jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
container:
image: ghcr.io/jonatanantoni/cmsis/linux.gnu:latest
permissions:
actions: read
contents: read
security-events: write
env:
CMSIS_PACK_ROOT: /tmp/.packs-${{ github.run_id }}

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install build dependencies
run: |
sudo apt install gcc-arm-none-eabi ninja-build cmake
- name: Cache pack folder
id: cache-packs
uses: actions/cache@v3
with:
key: packs-${{ github.run_id }}
restore-keys: |
packs-
path: /tmp/.packs-${{ github.run_id }}

- name: Install CMSIS-Toolbox
run: |
wget https://github.com/Open-CMSIS-Pack/cmsis-toolbox/releases/download/1.1.0/cmsis-toolbox.sh
chmod +x cmsis-toolbox.sh
sudo ./cmsis-toolbox.sh <<EOI
/opt/ctools
$CMSIS_PACK_ROOT
$(dirname $(which arm-none-eabi-gcc 2>/dev/null))
EOI
echo "/opt/ctools/bin" >> $GITHUB_PATH
echo "cpackget : $(which cpackget)"
echo "csolution: $(which csolution)"
echo "cbuild : $(which cbuild)"
- name: Initialize packs folder
if: steps.cache-packs.outputs.cache-hit != 'true'
run: cpackget init https://www.keil.com/pack/index.pidx

- name: Update pack index
if: steps.cache-packs.outputs.cache-hit == 'true'
run: cpackget update-index

- name: Install build.py requirements
run: pip install -r requirements.txt
working-directory: CMSIS/CoreValidation/Project

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: cpp
queries: security-and-quality

- run: |
ln -s /root/.rtebuild /github/home/.rtebuild
cd CMSIS/CoreValidation/Tests
python3 build.py -c GCC -o low build

- name: Build projects
working-directory: CMSIS/CoreValidation/Project
run: |
pip install -r requirements.txt
cpackget add -a -f cpacklist.txt
python build.py --verbose -c GCC -d "CM[047]*" -d "CM[23]3*" -o low build || echo "Something failed!"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
46 changes: 46 additions & 0 deletions .github/workflows/corevalidation-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish CoreValidation Test Results

on:
workflow_run:
workflows: ["CoreValidation"]
branches-ignore: ["develop"]
types:
- completed

jobs:
publish-test-results:
name: Publish CoreValidation Test Results
runs-on: ubuntu-latest
permissions:
contents: read
issues: read
checks: write
pull-requests: write
if: |
github.event.workflow_run.event == "pull_request" &&
github.event.workflow_run.conclusion != 'skipped'
steps:
- name: Download test results
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
mkdir -p artifacts && cd artifacts
artifacts_url=${{ github.event.workflow_run.artifacts_url }}
gh api "$artifacts_url" -q '.artifacts[] | select(.name=="tests") | [.name, .archive_download_url] | @tsv' | while read artifact
do
IFS=$'\t' read name url <<< "$artifact"
gh api $url > "$name.zip"
unzip -d "$name" "$name.zip"
done
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
commit: ${{ github.event.workflow_run.head_sha }}
event_file: artifacts/Event File/event.json
report_individual_runs: true
event_name: ${{ github.event.workflow_run.event }}
junit_files: "artifacts/**/*.junit"
78 changes: 78 additions & 0 deletions .github/workflows/corevalidation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# The repository needs to provide the following secrets
# - AWS_DEFAULT_REGION The data center region to be used.
# - AWS_S3_BUCKET_NAME The name of the S3 storage bucket to be used for data exchange.
# - AWS_IAM_PROFILE The IAM profile to be used.
# - AWS_ASSUME_ROLE The AWS access role to be assumed.
# - AWS_SECURITY_GROUP_ID The id of the security group to add the EC2 instance to.
# - AWS_SUBNET_ID The id of the network subnet to connect the EC2 instance to.

name: CoreValidation
on:
push:
branches: [ main ]
pull_request:
paths:
- .github/workflows/corevalidation.yml
- CMSIS/Core/**/*
- CMSIS/Core_A/**/*
- CMSIS/CoreValidation/**/*
- Device/ARM/**/*
workflow_dispatch:

env:
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }}
AWS_IAM_PROFILE: ${{ secrets.AWS_IAM_PROFILE }}
AWS_SECURITY_GROUP_ID: ${{ secrets.AWS_SECURITY_GROUP_ID }}
AWS_SUBNET_ID: ${{ secrets.AWS_SUBNET_ID }}
jobs:
ci_test:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
outputs:
avhresult: ${{ steps.avh.conclusion }}
testbadge: ${{ steps.avh.outputs.badge }}
steps:
- name: Check out repository code
uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install AVH Client for Python
run: |
pip install git+https://github.com/ARM-software/[email protected]
- uses: ammaraskar/gcc-problem-matcher@master

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}

- name: Run tests
id: avh
run: |
avhclient -b aws execute --specfile CMSIS/CoreValidation/Project/avh.yml
- name: Archive build results
uses: actions/upload-artifact@v2
with:
name: builds
path: CMSIS/CoreValidation/Project/Core_Validation-*.zip
retention-days: 1
if-no-files-found: error
if: always()

- name: Archive test results
uses: actions/upload-artifact@v2
with:
name: tests
path: CMSIS/CoreValidation/Project/Core_Validation-*.junit
retention-days: 1
if-no-files-found: error
if: always()
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
Local_Release/
CMSIS/Documentation/
CMSIS/RTOS2/RTX/Library/ARM/MDK/RTX_CM.uvguix.*
CMSIS/CoreValidation/Tests/build
CMSIS/CoreValidation/Tests/bootloader/build
CMSIS/CoreValidation/Project/*.zip
CMSIS/CoreValidation/Project/*.junit
CMSIS/CoreValidation/Project/Validation.*/
CMSIS/CoreValidation/Project/Bootloader.*/
*.uvguix.*
*.uvmpw.uvgui.*
*.zip
Expand Down
Loading

0 comments on commit e5dc191

Please sign in to comment.