From 9de4115e4c411dd80defc82141954e819ffdcff8 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Tue, 6 Aug 2024 10:51:32 +0200 Subject: [PATCH] Fix: don't clone with .git directory ending. --- .github/workflows/build-yocto.yml | 46 +++++++++++++--------- .gitignore | 1 + README.md | 10 +++++ portenta-x8_build.sh | 65 +++++++++++++++++++++++++++++++ 4 files changed, 104 insertions(+), 18 deletions(-) create mode 100644 .gitignore create mode 100644 README.md create mode 100755 portenta-x8_build.sh diff --git a/.github/workflows/build-yocto.yml b/.github/workflows/build-yocto.yml index b32ee72..bbc020b 100644 --- a/.github/workflows/build-yocto.yml +++ b/.github/workflows/build-yocto.yml @@ -20,29 +20,39 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - - name: Set up latest Python - uses: actions/setup-python@v5 + - name: Checkout pika-spark/lmp-manifest + uses: actions/checkout@v4 with: - python-version: "*" + repository: pika-spark/lmp-manifest + path: 'lmp-manifest' + ref: pika-spark + + - name: Create a new user + run: | + sudo useradd -m myuser --uid 1000 --gid 1000 + echo "myuser:password" | sudo chpasswd + sudo usermod -aG sudo myuser + + - name: Get UID and GID of the new user and store in environment + id: ids + run: | + echo "UID=$(id -u myuser)" >> $GITHUB_ENV + echo "GID=$(id -g myuser)" >> $GITHUB_ENV - name: Build Docker image run: | - git clone https://github.com/pika-spark/lmp-manifest.git - cd lmp-manifest docker build -t yocto-build ./lmp-manifest + - name: Check out this repository containing build script + uses: actions/checkout@v4 + - name: Build Yocto image run: | - docker run -v $(pwd):/dockerVolume -it yocto-build bash - su builder - git config --global user.email "you@example.com" - git config --global user.name "Your Name" - cd /dockerVolume - repo init -u https://github.com/pika-spark/lmp-manifest.git -m arduino.xml -b pika-spark - repo sync - DISTRO=lmp-base-xwayland MACHINE=portenta-x8 . setup-environment - echo "ACCEPT_FSL_EULA = \"1\"" >> conf/local.conf - bitbake lmp-devel-arduino-image - + whoami + id -u + id -g + docker run --rm \ + -v ${{ github.workspace }}:/workdir \ + -u ${{ env.UID }}:${{ env.GID }} \ + yocto-build \ + /bin/bash -c "cd /workdir && bash portenta-x8_build.sh" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f11b75 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..52ee23b --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ + +:sparkles: `pika-spark-yocto-ci` +================================ + +This repository contains a GitHub action script for building the Pika Spark Yocto image. + +

+ +

+ diff --git a/portenta-x8_build.sh b/portenta-x8_build.sh new file mode 100755 index 0000000..cd4fc8c --- /dev/null +++ b/portenta-x8_build.sh @@ -0,0 +1,65 @@ +# Script to install and build the image for the Arduino Portenta X8 +# More info at https://docs.arduino.cc/hardware/portenta-x8 +# Script by Massimo Pennazio and Pablo Marquínez (@Arduino) + +echo -------------------------------------------------------------------------- +echo Starting wrapper script to setup and build an Image and the Flashing tools +echo @arduino Portenta-X8 +echo 17 Oct 2023 +echo + +echo "User" $(whoami) + +# Make sure its on the home directory +echo Changing directory to home +cd /workdir + +# Git config +echo Git config to example credentials +git config --global user.email "you@example.com" +git config --global user.name "Your Name" + +# Initialize the git-repo and pull all the repos +echo Starting git-repo initialization +repo init -u https://github.com/pika-spark/lmp-manifest.git -m arduino.xml -b pika-spark +echo Pulling git-repo files +repo sync + +# Build 'lmp-partner-arduino-image' image +echo Building Portenta-X8 image +DISTRO=lmp-base-xwayland MACHINE=portenta-x8 . setup-environment +echo "ACCEPT_FSL_EULA = \"1\"" >> conf/local.conf +bitbake lmp-devel-arduino-image + +echo Exit X8 folder +cd .. + +# Build flashing tools +echo Building tools +DISTRO=lmp-mfgtool MACHINE=portenta-x8 . setup-environment +echo "ACCEPT_FSL_EULA = \"1\"" >> conf/local.conf +echo "MFGTOOL_FLASH_IMAGE = \"lmp-partner-arduino-image\"" >> conf/local.conf +bitbake mfgtool-files + +echo Exit tools folder +cd .. + +# Copy files to the deploy folder +todaysDate=$(date +%d-%b-%H_%M) +echo copying files +DEPLOY_FOLDER=/workdir/$todaysDate +mkdir $DEPLOY_FOLDER + +cp -L build-lmp-mfgtool/deploy/images/portenta-x8/mfgtool-files-portenta-x8.tar.gz $DEPLOY_FOLDER +cp -L build-lmp-xwayland/deploy/images/portenta-x8/imx-boot-portenta-x8 $DEPLOY_FOLDER +cp -L build-lmp-xwayland/deploy/images/portenta-x8/u-boot-portenta-x8.itb $DEPLOY_FOLDER +cp -L build-lmp-xwayland/deploy/images/portenta-x8/sit-portenta-x8.bin $DEPLOY_FOLDER +cp -L build-lmp-xwayland/deploy/images/portenta-x8/lmp-partner-arduino-image-portenta-x8.wic $DEPLOY_FOLDER + +cd $DEPLOY_FOLDER +tar xvf mfgtool-files-portenta-x8.tar.gz + +echo finished +echo Output folder called $todaysDate +echo +echo Read more at https://docs.arduino.cc/hardware/portenta-x8