Skip to content

Update main.yml

Update main.yml #38

Workflow file for this run

name: Yocto Build
on:
push:
branches:
- '**' # Matches all branches
jobs:
build:
runs-on: self-hosted
steps:
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y gawk wget git diffstat unzip texinfo gcc build-essential \
chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils \
iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \
python3-subunit mesa-common-dev zstd liblz4-tool file locales libacl1 \
curl python-is-python3 bmap-tools
sudo locale-gen en_US.UTF-8
- name: Install repo tool
run: |
mkdir -p ~/bin
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
echo "${HOME}/bin" >> $GITHUB_PATH
- name: Initialize Yocto Environment
run: |
mkdir -p yocto-astrial
cd yocto-astrial
repo init -u https://github.com/nxp-imx/imx-manifest -b imx-linux-kirkstone -m imx-5.15.71-2.2.0.xml
mkdir -p .repo/local_manifests
wget --directory-prefix .repo/local_manifests https://raw.githubusercontent.com/System-Electronics/meta-sysele-nxp-5.15.71/main/manifest/astrial-5.15.71.xml
CURRENT_REPO="https://github.com/${GITHUB_REPOSITORY}"
CURRENT_BRANCH="${GITHUB_REF#refs/heads/}"
# Replace only the URL for projects with remote="system"
sed -i '/remote="system"/s|https://github.com/System-Electronics|'"${CURRENT_REPO}"'|g' .repo/local_manifests/astrial-5.15.71.xml
# Replace the revision only for the `meta-sysele-nxp-5.15.71` project
sed -i '/name="meta-sysele-nxp-5.15.71"/s|revision="[^"]*"|revision="'"${CURRENT_BRANCH}"'"|' .repo/local_manifests/astrial-5.15.71.xml
repo sync
- name: Generate Build Signature
run: |
# Generate build signature using GitHub secret
if [ "${{ secrets.BUILD_SIGNING_KEY }}" != "" ]; then
# Create a unique signature combining various elements
SIGNATURE_INPUT="${GITHUB_SHA}|${GITHUB_REPOSITORY}|${GITHUB_RUN_ID}|${{ secrets.BUILD_SIGNING_KEY }}"
BUILD_SIGNATURE=$(echo -n "$SIGNATURE_INPUT" | openssl dgst -sha256 -hmac "${{ secrets.BUILD_SIGNING_KEY }}" -hex | cut -d' ' -f2)
else
BUILD_SIGNATURE="unofficial"
fi
echo "BUILD_SIGNATURE=${BUILD_SIGNATURE}" >> $GITHUB_ENV
- name: Build Image
run: |
cd yocto-astrial
source astrial-setup-env -b build
# Pass the signature to bitbake
export BB_ENV_PASSTHROUGH_ADDITIONS="GITHUB_SHA GITHUB_REPOSITORY GITHUB_RUN_ID BUILD_SIGNATURE"
bitbake -c cleanall nnshark
bitbake nnshark
bitbake system-astrial-image
- name: Archive Build Artifacts
uses: actions/upload-artifact@v4
with:
name: yocto-build
path: |
yocto-astrial/build/tmp/deploy/images/astrial-imx8mp/imx-boot-astrial-imx8mp-sd.bin-flash_evk
yocto-astrial/build/tmp/deploy/images/astrial-imx8mp/system-astrial-image-astrial-imx8mp-*.rootfs.wic.zst