Skip to content

Add SPDX tags

Add SPDX tags #676

# SPDX-FileCopyrightText: 2021 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: Build and Test
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
TOOLCHAIN: arm-none-eabi
TOOLCHAIN_VERSION: 12.3.rel1
RENODE: renode
RENODE_VERSION: 1.14.0
VENV_IREE: venv-iree
VENV_RENODE: venv-renode
IREE_HOST_INSTALL: build-iree-host-install
jobs:
install-toolchain:
name: Install Arm GNU Toolchain
runs-on: ubuntu-20.04
steps:
- name: Cache Toolchain
id: cache-toolchain
uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3
with:
path: ${{ env.TOOLCHAIN }}
key: ${{ runner.os }}-arm-gnu-toolchain-${{ env.TOOLCHAIN_VERSION }}-x86_64-arm-none-eabi
- name: Install GNU Arm Embedded Toolchain
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
wget -q https://developer.arm.com/-/media/Files/downloads/gnu/${{ env.TOOLCHAIN_VERSION }}/binrel/arm-gnu-toolchain-${{ env.TOOLCHAIN_VERSION }}-x86_64-arm-none-eabi.tar.xz
tar xfJ arm-gnu-toolchain-${{ env.TOOLCHAIN_VERSION }}-x86_64-arm-none-eabi.tar.xz
mv arm-gnu-toolchain-${{ env.TOOLCHAIN_VERSION }}-x86_64-arm-none-eabi ${{ env.TOOLCHAIN }}
install-renode:
name: Install Renode
runs-on: ubuntu-20.04
steps:
- name: Cache Renode
id: cache-renode
uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3
with:
path: |
${{ env.VENV_RENODE }}
${{ env.RENODE }}
key: ${{ runner.os }}-${{ env.RENODE }}-${{ env.RENODE_VERSION }}
- name: Install Renode
if: steps.cache-renode.outputs.cache-hit != 'true'
run: |
wget -q https://github.com/renode/renode/releases/download/v${{ env.RENODE_VERSION }}/renode-${{ env.RENODE_VERSION }}.linux-portable.tar.gz
tar xf renode-${{ env.RENODE_VERSION }}.linux-portable.tar.gz
mv renode_${{ env.RENODE_VERSION }}_portable ${{ env.RENODE }}
python3 -m venv ${{ env.VENV_RENODE }}
source ${{ env.VENV_RENODE }}/bin/activate
pip install -r ${{ env.RENODE }}/tests/requirements.txt
install-snapshot:
name: Install IREE snaphot
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
path: ${{ env.REPO }}
- name: Cache IREE Snapshot
id: cache-snapshot
uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3
with:
path: |
${{ env.VENV_IREE }}
${{ env.IREE_HOST_INSTALL }}
key: ${{ runner.os }}-iree-snapshot-${{ hashFiles('iree-release-link.txt') }}
- name: Install IREE Dependencies
if: steps.cache-snapshot.outputs.cache-hit != 'true'
run: |
python3 -m venv ${{ env.VENV_IREE }}
source ${{ env.VENV_IREE }}/bin/activate
pip install -r requirements.txt
- name: Install IREE Tools
if: steps.cache-snapshot.outputs.cache-hit != 'true'
run: |
mkdir ${{ env.IREE_HOST_INSTALL }}
wget -i iree-release-link.txt -O iree-dist-linux-x86_64.tar.xz
tar xvfJ iree-dist-linux-x86_64.tar.xz -C ${{ env.IREE_HOST_INSTALL }}
rm iree-dist-linux-x86_64.tar.xz
build:
name: Build Samples
needs: [install-toolchain, install-snapshot]
runs-on: ubuntu-20.04
steps:
- name: Configure environment
run: echo "${GITHUB_WORKSPACE}/${{ env.TOOLCHAIN }}/bin" >> ${GITHUB_PATH}
- name: Install Dependencies
run: |
sudo apt update
sudo apt install cmake ninja-build
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
path: ${{ env.REPO }}
submodules: 'true'
- name: Initalize submodules
run : |
cd third_party/iree
git submodule update --init -- third_party/googletest
git submodule update --init -- third_party/flatcc
git submodule update --init -- third_party/libyaml
git submodule update --init -- third_party/vulkan_headers
- name: Cache Toolchain
id: cache-toolchain
uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3
with:
path: ${{ env.TOOLCHAIN }}
key: ${{ runner.os }}-arm-gnu-toolchain-${{ env.TOOLCHAIN_VERSION }}-x86_64-arm-none-eabi
- name: Cache IREE Snapshot
id: cache-snapshot
uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3
with:
path: |
${{ env.VENV_IREE }}
${{ env.IREE_HOST_INSTALL }}
key: ${{ runner.os }}-iree-snapshot-${{ hashFiles('iree-release-link.txt') }}
- name: Build with CMSIS for nRF52840
run: |
source ${{ env.VENV_IREE }}/bin/activate
mkdir build-cmsis-nrf52840
cd build-cmsis-nrf52840
export PATH_TO_ARM_TOOLCHAIN="$GITHUB_WORKSPACE/${TOOLCHAIN}"
../build_tools/configure_build.sh cmsis nrf52840
cmake --build . --target all
- name: Upload CMSIS build artifact for nRF52840
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cmsis-nrf52840-build-artifact
path: |
build-cmsis-nrf52840/samples/simple_embedding/sample_vmvx_sync.elf
build-cmsis-nrf52840/samples/simple_embedding/sample_embedded_sync.elf
build-cmsis-nrf52840/samples/simple_vec_mul/simple_vec_mul_int_bytecode_vmvx.elf
build-cmsis-nrf52840/samples/simple_vec_mul/simple_vec_mul_int_bytecode_vmvx_inline.elf
build-cmsis-nrf52840/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static.elf
build-cmsis-nrf52840/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_c.elf
build-cmsis-nrf52840/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_inline.elf
build-cmsis-nrf52840/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_inline_c.elf
build-cmsis-nrf52840/samples/static_library/sample_static_library.elf
build-cmsis-nrf52840/samples/static_library/sample_static_library_c.elf
build-cmsis-nrf52840/samples/vision_inference/mnist_static_library.elf
build-cmsis-nrf52840/samples/vision_inference/mnist_static_library_c.elf
- name: Build with CMSIS for STM32F4xx
run: |
source ${{ env.VENV_IREE }}/bin/activate
mkdir build-cmsis-stm32f4xx
cd build-cmsis-stm32f4xx
export PATH_TO_ARM_TOOLCHAIN="$GITHUB_WORKSPACE/${TOOLCHAIN}"
../build_tools/configure_build.sh cmsis stm32f4xx
cmake --build . --target all
- name: Upload CMSIS build artifact for STM32F4xx
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cmsis-stm32f4xx-build-artifact
path: |
build-cmsis-stm32f4xx/samples/simple_embedding/sample_vmvx_sync.elf
build-cmsis-stm32f4xx/samples/simple_embedding/sample_embedded_sync.elf
build-cmsis-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_vmvx.elf
build-cmsis-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_vmvx_inline.elf
build-cmsis-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static.elf
build-cmsis-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_c.elf
build-cmsis-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_inline.elf
build-cmsis-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_inline_c.elf
build-cmsis-stm32f4xx/samples/static_library/sample_static_library.elf
build-cmsis-stm32f4xx/samples/static_library/sample_static_library_c.elf
build-cmsis-stm32f4xx/samples/vision_inference/mnist_static_library.elf
build-cmsis-stm32f4xx/samples/vision_inference/mnist_static_library_c.elf
- name: Build with libopencm3 for STM32F4xx
run: |
source ${{ env.VENV_IREE }}/bin/activate
mkdir build-libopencm3-stm32f4xx
cd build-libopencm3-stm32f4xx
export PATH_TO_ARM_TOOLCHAIN="$GITHUB_WORKSPACE/${TOOLCHAIN}"
../build_tools/configure_build.sh libopencm3 stm32f4xx
cmake --build . --target all
- name: Upload libopencm3 build artifact for STM32F4xx
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: libopencm3-stm32f4xx-build-artifact
path: |
build-libopencm3-stm32f4xx/samples/simple_embedding/sample_vmvx_sync.elf
build-libopencm3-stm32f4xx/samples/simple_embedding/sample_embedded_sync.elf
build-libopencm3-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_vmvx.elf
build-libopencm3-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_vmvx_inline.elf
build-libopencm3-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static.elf
build-libopencm3-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_c.elf
build-libopencm3-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_inline.elf
build-libopencm3-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_inline_c.elf
build-libopencm3-stm32f4xx/samples/static_library/sample_static_library.elf
build-libopencm3-stm32f4xx/samples/static_library/sample_static_library_c.elf
build-libopencm3-stm32f4xx/samples/vision_inference/mnist_static_library.elf
build-libopencm3-stm32f4xx/samples/vision_inference/mnist_static_library_c.elf
- name: Build with CMSIS for STM32L4R5
run: |
source ${{ env.VENV_IREE }}/bin/activate
mkdir build-cmsis-stm32l4r5
cd build-cmsis-stm32l4r5
export PATH_TO_ARM_TOOLCHAIN="$GITHUB_WORKSPACE/${TOOLCHAIN}"
../build_tools/configure_build.sh cmsis stm32l4r5
cmake --build . --target all
- name: Upload CMSIS build artifact for STM32L4R5
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cmsis-stm32l4r5-build-artifact
path: |
build-cmsis-stm32l4r5/samples/simple_embedding/sample_vmvx_sync.elf
build-cmsis-stm32l4r5/samples/simple_embedding/sample_embedded_sync.elf
build-cmsis-stm32l4r5/samples/simple_vec_mul/simple_vec_mul_int_bytecode_vmvx.elf
build-cmsis-stm32l4r5/samples/simple_vec_mul/simple_vec_mul_int_bytecode_vmvx_inline.elf
build-cmsis-stm32l4r5/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static.elf
build-cmsis-stm32l4r5/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_c.elf
build-cmsis-stm32l4r5/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_inline.elf
build-cmsis-stm32l4r5/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_inline_c.elf
build-cmsis-stm32l4r5/samples/static_library/sample_static_library.elf
build-cmsis-stm32l4r5/samples/static_library/sample_static_library_c.elf
build-cmsis-stm32l4r5/samples/vision_inference/mnist_static_library.elf
build-cmsis-stm32l4r5/samples/vision_inference/mnist_static_library_c.elf
test-nrf52840:
name: Test Samples (nRF52840)
needs: [install-renode, build]
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
path: ${{ env.REPO }}
- name: Cache Renode
id: cache-renode
uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3
with:
path: |
${{ env.VENV_RENODE }}
${{ env.RENODE }}
key: ${{ runner.os }}-${{ env.RENODE }}-${{ env.RENODE_VERSION }}
- name: Download CMSIS build artifact for nRF52840
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: cmsis-nrf52840-build-artifact
path: build-cmsis-nrf52840/samples
- name: Run Renode tests
run: |
source ${{ env.VENV_RENODE }}/bin/activate
${{ env.RENODE }}/renode-test --variable BASE_DIR:$GITHUB_WORKSPACE --variable TARGET:nrf52840 --exclude NoCI --exclude libopencm3 tests/*.robot
- name: Delete CMSIS build artifact for nRF52840
uses: geekyeggo/delete-artifact@54ab544f12cdb7b71613a16a2b5a37a9ade990af # v2.0.0
with:
name: cmsis-nrf52840-build-artifact
test-stm32f4:
name: Test Samples (STM32F4xx)
needs: [install-renode, build]
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
path: ${{ env.REPO }}
- name: Cache Renode
id: cache-renode
uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3
with:
path: |
${{ env.VENV_RENODE }}
${{ env.RENODE }}
key: ${{ runner.os }}-${{ env.RENODE }}-${{ env.RENODE_VERSION }}
- name: Download CMSIS build artifact for STM32F4xx
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: cmsis-stm32f4xx-build-artifact
path: build-cmsis-stm32f4xx/samples
- name: Download libopencm3 build artifact for STM32F4xx
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: libopencm3-stm32f4xx-build-artifact
path: build-libopencm3-stm32f4xx/samples
- name: Run Renode tests
run: |
source ${{ env.VENV_RENODE }}/bin/activate
${{ env.RENODE }}/renode-test --variable BASE_DIR:$GITHUB_WORKSPACE --variable TARGET:stm32f4xx --exclude NoCI tests/*.robot
- name: Delete CMSIS build artifact for STM32F4xx
uses: geekyeggo/delete-artifact@54ab544f12cdb7b71613a16a2b5a37a9ade990af # v2.0.0
with:
name: cmsis-stm32f4xx-build-artifact
- name: Delete libopencm3 build artifact for STM32F4xx
uses: geekyeggo/delete-artifact@54ab544f12cdb7b71613a16a2b5a37a9ade990af # v2.0.0
with:
name: libopencm3-stm32f4xx-build-artifact
test-stm32l4r5:
name: Test Samples (STM32L4R5)
needs: [install-renode, build]
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
path: ${{ env.REPO }}
- name: Cache Renode
id: cache-renode
uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3
with:
path: |
${{ env.VENV_RENODE }}
${{ env.RENODE }}
key: ${{ runner.os }}-${{ env.RENODE }}-${{ env.RENODE_VERSION }}
- name: Download CMSIS build artifact for STM32L4R5
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: cmsis-stm32l4r5-build-artifact
path: build-cmsis-stm32l4r5/samples
- name: Run Renode tests
run: |
source ${{ env.VENV_RENODE }}/bin/activate
${{ env.RENODE }}/renode-test --variable BASE_DIR:$GITHUB_WORKSPACE --variable TARGET:stm32l4r5 --exclude NoCI --exclude libopencm3 tests/*.robot
- name: Delete CMSIS build artifact for STM32L4R5
uses: geekyeggo/delete-artifact@54ab544f12cdb7b71613a16a2b5a37a9ade990af # v2.0.0
with:
name: cmsis-stm32l4r5-build-artifact