Skip to content

CORE generation

CORE generation #59

# This is a basic workflow that is manually triggered
name: CORE generation
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
mcu_name:
# Name of the MCU for which generation is running
description: 'MCU name'
# Default value if no value is explicitly provided
default: 'mk20dn32vlh5'
# Input has to be provided for the workflow to run
required: true
# The data type of the input
type: string
vendor:
# Vendor of the MCU
description: 'Vendor'
# Default value if no value is explicitly provided
default: 'nxp'
# Input has to be provided for the workflow to run
required: true
# The data type of the input
type: string
architecture:
# Architecture of the MCU
description: 'Architecture'
# Default value if no value is explicitly provided
default: 'ARM'
# Input has to be provided for the workflow to run
required: true
# The data type of the input
type: string
pdfFile:
# Path to the reference manual PDF file
description: 'Reference manual PDF file path'
# Default value if no value is explicitly provided
default: '/tmp/documentation/mk20dn32vlh5_rm.pdf'
# Input has to be provided for the workflow to run
required: true
# The data type of the input
type: string
new_branch:
type: bool
description: To create a new branch for this run or use the last one
default: true
build_version:
type: string
description: Tag to use for script run (i.e. v1.0.7)
default: "latest"
env:
NVIDIA_API_KEY: ${{ secrets.NVIDIA_API_KEY }}
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "Generate CORE"
Generate_Core:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a single command using the runners shell
- name: Send greeting
run: echo "Starting CORE generation workflow..."
# Checkout branch
- uses: actions/checkout@v2
- name: Authorize Mikroe Actions App
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.MIKROE_ACTIONS }}
private-key: ${{ secrets.MIKROE_ACTIONS_KEY_AUTHORIZE }}
- name: Add GitHub Actions credentials
run: |
git config user.name github-actions
git config user.email [email protected]
# Create a new branch
- name: Create branch
run: |
echo "Found branches: $(git branch --list "*automation*")"
if [ `git branch --list "*automation*"` ]; then
highest=$(git branch --list "*new-feature/automation/*" | sed -n 's/.*-\([0-9]\+\)$/\1/p' | sort -n | tail -1)
number=$(git branch --list "*new-feature/automation/*" | grep "$highest")
if ${{ github.event.inputs.new_branch }} == true; then
number=$((number+1))
fi
else
number=1
fi
echo "Found number: $number"
git branch "new-feature/automation/$number"
git checkout "new-feature/automation/$number"
git push -u origin "new-feature/automation/$number"
# Create a new directory at the root of your repository
- name: Create automatization directory
run: mkdir -p automatization
# Aquire the asset that we just generated with the sdk_automation script
- name: Fetch asset
run: gh release download --repo MikroElektronika/sdk_automation latest
env:
GH_TOKEN: ${{ secrets.MIKROE_ACTIONS_KEY }}
# Move the asset we just downloaded to automatization and extract it
- name: Move to the created directory unzip and distribute files
run: |
sudo mv generated_files.zip automatization/
cd automatization
unzip generated_files.zip
mkdir -p ../${{ github.event.inputs.architecture }}/gcc_clang/def/${{ github.event.inputs.vendor }}/MK20DX128VMP5
mkdir -p ../${{ github.event.inputs.architecture }}/gcc_clang/interrupts/include/interrupts_mcu/mk20dx128vmp5
mkdir -p ../${{ github.event.inputs.architecture }}/gcc_clang/system/src/${{ github.event.inputs.vendor }}/doc_ds_1
sudo mv mcu.h ../${{ github.event.inputs.architecture }}/gcc_clang/def/${{ github.event.inputs.vendor }}/MK20DX128VMP5/
sudo mv MK20DX128VMP5.json ../${{ github.event.inputs.architecture }}/gcc_clang/def/
sudo mv interrupts_mcu.h ../${{ github.event.inputs.architecture }}/gcc_clang/interrupts/include/interrupts_mcu/mk20dx128vmp5/
sudo mv init_clock.c ../${{ github.event.inputs.architecture }}/gcc_clang/system/src/${{ github.event.inputs.vendor }}/doc_ds_1/
sudo mv MK20DX128VMP5.ld ../${{ github.event.inputs.architecture }}/gcc_clang/linker_scripts/${{ github.event.inputs.vendor }}/
sudo mv MK20DX128VMP5.s ../${{ github.event.inputs.architecture }}/gcc_clang/cmake/${{ github.event.inputs.vendor }}/