Skip to content

Add a REUSE badge (#329) #755

Add a REUSE badge (#329)

Add a REUSE badge (#329) #755

# 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
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
TOOLCHAIN: arm-none-eabi
TOOLCHAIN_VERSION: 13.2.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@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
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
mkdir ${{ env.TOOLCHAIN }}
tar xfJ arm-gnu-toolchain-${{ env.TOOLCHAIN_VERSION }}-x86_64-arm-none-eabi.tar.xz -C ${{ env.TOOLCHAIN }} --strip-components=1
install-renode:
name: Install Renode
runs-on: ubuntu-20.04
steps:
- name: Cache Renode
id: cache-renode
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: ${{ env.REPO }}
- name: Cache IREE Snapshot
id: cache-snapshot
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: ${{ env.REPO }}
submodules: 'false'
- name: Initalize submodules
run : |
git submodule update --init third_party/CMSIS_5
git submodule update --init third_party/cmsis_device_f4
git submodule update --init third_party/cmsis_device_l4
git submodule update --init third_party/iree
git submodule update --init third_party/libopencm3
git submodule update --init third_party/nrfx
- name: Initalize IREE submodules
run : |
cd third_party/iree
git submodule update --init -- third_party/googletest
git submodule update --init -- third_party/flatcc
- name: Cache Toolchain
id: cache-toolchain
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
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@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
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@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
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
retention-days: 1
- 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@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
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
retention-days: 1
- 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@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
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
retention-days: 1
- 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@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
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
retention-days: 1
test-nrf52840:
name: Test Samples (nRF52840)
needs: [install-renode, build]
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: ${{ env.REPO }}
- name: Cache Renode
id: cache-renode
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
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@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.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 --exclude xfail-nrf52840 tests/*.robot
test-stm32f4:
name: Test Samples (STM32F4xx)
needs: [install-renode, build]
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: ${{ env.REPO }}
- name: Cache Renode
id: cache-renode
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
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@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
with:
name: cmsis-stm32f4xx-build-artifact
path: build-cmsis-stm32f4xx/samples
- name: Download libopencm3 build artifact for STM32F4xx
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.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
test-stm32l4r5:
name: Test Samples (STM32L4R5)
needs: [install-renode, build]
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: ${{ env.REPO }}
- name: Cache Renode
id: cache-renode
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
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@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.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