Skip to content

Commit

Permalink
Updates to retailor for arm-software and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasHertel80 committed Sep 7, 2023
1 parent a42ba0b commit 354da6b
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 70 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/base_image_build.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,44 @@
name: Build and Push Base Docker Image
# This YAML file is used to build and push a base Docker image with the necessary tools and dependencies for an ML project
# It contains a job that builds the Docker image and pushes it to GitHub Container Registry

name: Base Docker Image - Build and Push

on:
push:
branches:
- main
# Trigger the workflow manually
workflow_dispatch:

jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
# Check out the repository containing the Dockerfile and other necessary files
uses: actions/checkout@v2

- name: Log in to GitHub Container Registry
# Log in to GitHub Container Registry using the actor and a GitHub token
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
# Set up Docker Buildx for building multi-architecture images
uses: docker/setup-buildx-action@v2

- name: Format repo slug
# Format the repository slug to lowercase for use in the Docker image tags
id: repo_slug
run: echo "REPO_SLUG=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

- name: Build and push Docker image
# Build the Docker image using the Dockerfile in the `docker_base` directory and push it to GitHub Container Registry
uses: docker/build-push-action@v4
with:
context: ./docker_base
push: true
tags: ghcr.io/${{ env.REPO_SLUG }}/arm-mlops-docker-base:latest
# Use GitHub Actions cache to speed up the build process
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha,mode=max
54 changes: 42 additions & 12 deletions .github/workflows/build_ml_library.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,57 @@
name: Build ML Library project
# This YAML file is used to build and run an ML project on Arm Virtual Hardware FVP
# It contains a job that runs tests on a Ubuntu machine using a custom Docker image

name: ML Project - Build and Run on Arm Virtual Hardware FVP

on:
# Trigger the workflow when a workflow run is completed
workflow_run:
workflows: ["Build and Push Docker Image"]
workflows: ["Licensed Docker Image - Build and Push"]
types:
- completed
# Trigger the workflow manually
workflow_dispatch:

jobs:
run_test:
runs-on: ubuntu-latest
container:
# Use a custom Docker image with the necessary tools and dependencies
image: ghcr.io/matthiashertel80/avh-mlops/arm-mlops-docker-licensed:latest
credentials:
# Set the Docker image credentials using the actor and a GitHub token
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout repository
# Check out the repository containing the ML project
uses: actions/checkout@v2

- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set permissions for working directory __w
# Set permissions for the working directory to avoid permission errors
run: chmod 777 -R /__w

- name: Install custom CMSIS packs
# Install custom CMSIS packs required for the ML project
run: |
wget -P /home/arm_mlops_docker https://github.com/ARM-software/CMSIS-DFP/releases/download/dev%2Fv1.0.0-dev12/ARM.CMSIS_DFP.1.0.0-dev12+g285da21.pack -nv
su -l arm_mlops_docker -c "/home/arm_mlops_docker/cmsis-toolbox-linux-amd64/bin/cpackget add ARM.CMSIS_DFP.1.0.0-dev12+g285da21.pack --agree-embedded-license"
- name: Build Model for Cortex-M55 with AC6 (size)
# Build the ML model for Cortex-M55 using AC6 toolchain and size optimization
run: |
su - arm_mlops_docker -c "/home/arm_mlops_docker/cmsis-toolbox-linux-amd64/bin/cbuild /__w/AVH-MLOps/AVH-MLOps/Project/TFLmicrospeech/MLOps.csolution.yml --packs --context ML_Model.size+CM55 --toolchain AC6"
- name: Pull Docker image
run: docker pull ghcr.io/${{ github.repository }}/arm-mlops-docker-licensed:latest
- name: Build Test Project for Cortex-M55 with AC6 (size)
# Build the test project for Cortex-M55 using AC6 toolchain and size optimization
run: |
su - arm_mlops_docker -c "/home/arm_mlops_docker/cmsis-toolbox-linux-amd64/bin/cbuild /__w/AVH-MLOps/AVH-MLOps/Project/TFLmicrospeech/MLOps.csolution.yml --packs --context ML_Test.size+CM55 --update-rte --toolchain AC6"
- name: Run test command in Docker container
run: docker run --rm ghcr.io/${{ github.repository }}/arm-mlops-docker-licensed:latest armclang --version
- name: Execute Test Project on Cortex-M55 Arm Virtual Hardware FVP
# Execute the test project on Cortex-M55 Arm Virtual Hardware FVP
run: |
su - arm_mlops_docker -c "LD_LIBRARY_PATH=/home/arm_mlops_docker/avh-fvp-11.21.15/avh-fvp-cortex-m-linux-amd64/bin/ \
/home/arm_mlops_docker/avh-fvp-11.21.15/avh-fvp-cortex-m-linux-amd64/bin/VHT_Corstone_SSE-300_Ethos-U55 \
-f /__w/AVH-MLOps/AVH-MLOps/Target/CM55_Ethos/fvp_config.txt \
/__w/AVH-MLOps/AVH-MLOps/Project/TFLmicrospeech/out/ML_Test/CM55/size/ML_Test.axf --simlimit 22"
27 changes: 0 additions & 27 deletions .github/workflows/build_ml_test_project.yml

This file was deleted.

26 changes: 17 additions & 9 deletions .github/workflows/licensed_image_build.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,52 @@
name: Build and Push Licensed Docker Image
# This YAML file is used to build and push a custom Docker image with the necessary tools and dependencies for an ML project
# It contains a job that builds the Docker image and pushes it to GitHub Container Registry

name: Licensed Docker Image - Build and Push

on:
# Trigger the workflow when a workflow run is completed
workflow_run:
workflows: ["Build and Push Base Docker Image"]
workflows: ["Base Docker Image - Build and Push"]
types:
- completed
# Trigger the workflow manually
workflow_dispatch:

jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
# Check out the repository containing the Dockerfile and other necessary files
uses: actions/checkout@v2

- name: Log in to GitHub Container Registry
# Log in to GitHub Container Registry using the actor and a GitHub token
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Format repo slug
# Format the repository slug to lowercase for use in the Docker image tags
id: repo_slug
run: echo "REPO_SLUG=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

- name: Pull Base Docker image
# Pull the base Docker image from GitHub Container Registry
run: docker pull ghcr.io/${{ env.REPO_SLUG }}/arm-mlops-docker-base:latest

- name: Setup tmate session
uses: mxschmitt/action-tmate@v3


- name: Create license file (stub)
# Create a license file for the Docker image using the ARM UBL license identifier
run: |
docker run --rm ghcr.io/${{ env.REPO_SLUG }}/arm-mlops-docker-base:latest -v ${{ github.workspace }}:/var/host /home/arm_mlops_docker/ArmCompilerforEmbedded6.20/bin/armlm activate --code ${{ secrets.ARM_UBL_LICENSE_IDENTIFIER }} --as-user arm_mlops_docker --to-file /var/host/arm_mlops_docker_license
docker run -d --name build_container -u root -v ${{ github.workspace }}:/workspace ghcr.io/${{ env.REPO_SLUG }}/arm-mlops-docker-base:latest sleep infinity
docker exec build_container /home/arm_mlops_docker/ArmCompilerforEmbedded6.20/bin/armlm activate --code ${{ secrets.ARM_UBL_LICENSE_IDENTIFIER }} --as-user arm_mlops_docker --to-file /workspace/arm_mlops_docker_license
cp ./arm_mlops_docker_license ./docker_licensed/arm_mlops_docker_license
cat ./docker_licensed/arm_mlops_docker_license
docker run --rm ghcr.io/${{ env.REPO_SLUG }}/arm-mlops-docker-base:latest -v ${{ github.workspace }}:/var/host /home/arm_mlops_docker/ArmCompilerforEmbedded6.20/bin/armlm deactivate --code ${{ secrets.ARM_UBL_LICENSE_IDENTIFIER }} --as-user arm_mlops_docker
- name: Build and push Docker image
# Build the Docker image using the Dockerfile in the `docker_licensed` directory and push it to GitHub Container Registry
uses: docker/build-push-action@v2
with:
context: ./docker_licensed
Expand Down
37 changes: 21 additions & 16 deletions .github/workflows/test_licensed_image.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
name: Run Test in Docker Container
# This YAML file is used to test a custom Docker image with the necessary tools and dependencies for an ML project
# It contains a job that runs tests on a Ubuntu machine using the custom Docker image

name: Licensed Docker Image - Test

on:
# Trigger the workflow when a workflow run is completed
workflow_run:
workflows: ["Build and Push Licensed Docker Image"]
workflows: ["Licensed Docker Image - Build and Push"]
types:
- completed
# Trigger the workflow manually
workflow_dispatch:

jobs:
run_test:
runs-on: ubuntu-latest
container:
# Use the custom Docker image with the necessary tools and dependencies
image: ghcr.io/arm-software/avh-mlops/arm-mlops-docker-licensed:latest
credentials:
# Set the Docker image credentials using the actor and a GitHub token
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repository
# Check out the repository containing the ML project
uses: actions/checkout@v2

- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Format repo slug
id: repo_slug
run: echo "REPO_SLUG=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

- name: Pull Docker image
run: docker pull ghcr.io/${{ env.REPO_SLUG }}/arm-mlops-docker-licensed:latest
- name: Try to execute cbuild
# Test if the cbuild command is working in the Docker container
run: su -l arm_mlops_docker -c "/home/arm_mlops_docker/cmsis-toolbox-linux-amd64/bin/cbuild --version"

- name: Run test command in Docker container
run: docker run --rm ghcr.io/${{ env.REPO_SLUG }}/arm-mlops-docker-licensed:latest /home/arm_mlops_docker/ArmCompilerforEmbedded6.20/bin/armclang --version
# Test if the armclang command is working in the Docker container
run: su -l arm_mlops_docker -c"/home/arm_mlops_docker/ArmCompilerforEmbedded6.20/bin/armclang --version"
2 changes: 1 addition & 1 deletion docker_licensed/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/matthiashertel80/avh-mlops/arm-mlops-docker-base:latest as base
FROM ghcr.io/arm-software/avh-mlops/arm-mlops-docker-base:latest as base

ADD arm_mlops_docker_license /arm_mlops_docker_license
RUN su -l arm_mlops_docker -c "/home/arm_mlops_docker/ArmCompilerforEmbedded6.20/bin/armlm import --file /arm_mlops_docker_license"
Expand Down

0 comments on commit 354da6b

Please sign in to comment.