build-LmP-builds #106
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build LmP builds | |
name: build-LmP-builds | |
on: | |
workflow_dispatch: | |
inputs: | |
target: | |
type: choice | |
required: true | |
description: "MACHINE=<target machine name>" | |
default: "raspberrypi3-64" | |
options: | |
- raspberrypi3-64 | |
- raspberrypi4-64 | |
- uz3eg-iocc | |
- imx8mmevk | |
- intel-corei7-64 | |
image-type: | |
type: choice | |
required: true | |
description: "bitbake <build-type>" | |
default: "lmp-base-console-image" | |
options: | |
- lmp-mini-image | |
- lmp-base-console-image | |
- lmp-gateway-image | |
branch-manifest: | |
required: true | |
default: 'main' | |
branch-meta-edge: | |
required: true | |
default: 'main' | |
# This allows a subsequently queued workflow run to interrupt previous runs | |
concurrency: | |
group: meta-edge-${{ inputs.target || inputs.branch-manifest || inputs.meta-edge || inputs.image-type }} | |
cancel-in-progress: true | |
jobs: | |
build-lmp: | |
runs-on: [self-hosted, edge-builder] | |
steps: | |
- name: Build info | |
run: | | |
echo "Greetings $USER, build LmP for target is ${{ inputs.target }}" | |
echo " with manifest branch: ${{ inputs.branch-manifest }}" | |
echo " with meta-edge branch: ${{ inputs.branch-meta-edge }}" | |
echo " ${{ inputs.image-type }} image." | |
WORKDIR=$(pwd) | |
echo "HOME=$HOME, workdir=$WORKDIR" | |
- name: Install dependencies | |
run: | | |
# These have been pre-installed to ed-dev2 machine. | |
#sudo apt-get update; sudo apt-get upgrade -y | |
#sudo apt-get install -y coreutils curl gawk wget git diffstat unzip | |
#sudo apt-get install -y texinfo g++ gcc-multilib build-essential chrpath socat | |
#sudo apt-get install -y cpio openjdk-11-jre python3 python3-pip python3-venv | |
#sudo apt-get install -y python3-pexpect xz-utils debianutils iputils-ping | |
#sudo apt-get install -y libsdl1.2-dev xterm libssl-dev libelf-dev ca-certificates | |
#sudo apt-get install -y whiptail xxd libtinfo5 | |
#sudo apt-get install libncurses5-dev virtualenv | |
#sudo apt-get install -y liblz4-tool zstd | |
- name: Init & sync manifest | |
run: | | |
mkdir -p ~/bin && PATH=~/bin:$PATH && curl -s -S https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo | |
mkdir -p build | |
cd build | |
virtualenv ~/repo-venv | |
source ~/repo-venv/bin/activate | |
repo --version | |
# Is it a version string vN.N.N or vN.N.N-RCN | |
if [[ ${{ inputs.branch-manifest }} =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*$ ]]; | |
then | |
echo "${{ inputs.branch-manifest }} is a tag, using refs/tags/${{ inputs.branch-manifest }}" | |
repo init -u https://github.com/PelionIoT/manifest-edge.git -m edge.xml -b refs/tags/${{ inputs.branch-manifest }} | |
else | |
echo "${{ inputs.branch-manifest }} is a branch, using refs/heads/${{ inputs.branch-manifest }}" | |
repo init -u https://github.com/PelionIoT/manifest-edge.git -m edge.xml -b refs/heads/${{ inputs.branch-manifest }} | |
fi | |
repo sync -j"$(nproc)" --force-sync meta-edge | |
echo "repo info" >>$GITHUB_STEP_SUMMARY | |
repo info >>$GITHUB_STEP_SUMMARY | |
cd layers/meta-edge | |
git fetch --all | |
git checkout ${{ inputs.branch-meta-edge }} | |
- name: Get dev credentials | |
env: | |
MBED_CLOUD_DEV_CREDENTIALS: ${{ secrets.META_EDGE_DEVELOPER_CERTIFICATE }} | |
UPDATE_DEFAULT_RESOURCES: ${{ secrets.UPDATE_DEFAULT_RESOURCE_C }} | |
# US Prod, account: ARM-Edge-Gateway, accountID: 016aa245a97c6a01c5a5670000000000 | |
# Secrets in PelionIoT domain level. | |
run: | | |
echo "$MBED_CLOUD_DEV_CREDENTIALS" >build/layers/meta-edge/recipes-edge/edge-core/files/mbed_cloud_dev_credentials.c | |
echo "$UPDATE_DEFAULT_RESOURCES" >build/layers/meta-edge/recipes-edge/edge-core/files/update_default_resources.c | |
- name: Build-dev ${{ inputs.target }} | |
run: | | |
pwd | |
cd build | |
MACHINE=${{ inputs.target }} source setup-environment | |
export LOCALCONF="conf/local.conf" | |
# Copy over clean local.conf | |
cp ../.repo/manifests/conf/local.conf "$LOCALCONF" | |
echo -e "\n" >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_DEVELOPER_MODE = "ON"' >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_FACTORY_MODE = "OFF"' >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_FIRMWARE_UPDATE = "ON"' >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_FOTA_ENABLE = "ON"' >> "$LOCALCONF" | |
#echo 'SSTATE_DIR = "/home/ubuntu/Projects/CACHE/SSTATE_CACHE"' >> "$LOCALCONF" | |
#echo 'DL_DIR = "/home/ubuntu/Projects/CACHE/DL_DIR"' >> "$LOCALCONF" | |
tail -n 14 "$LOCALCONF" | |
time bitbake ${{ inputs.image-type }} | |
# Move the image_license.manifest to image folder so that we can archive in 1 step | |
mv deploy/licenses/${{ inputs.image-type }}-${{ inputs.target }}/license.manifest deploy/images/${{ inputs.target }}/ | |
- name: Archive the developer cert wic-file & license manifest for ${{ inputs.target }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: WIC-dev-US-PROD-Account-016aa245a97c6a01c5a5670000000000-${{ inputs.target }} | |
path: | | |
build/build-lmp/deploy/images/${{ inputs.target }}/${{ inputs.image-type }}-${{ inputs.target }}.wic.bmap | |
build/build-lmp/deploy/images/${{ inputs.target }}/${{ inputs.image-type }}-${{ inputs.target }}.wic.gz | |
build/build-lmp/deploy/images/${{ inputs.target }}/license.manifest | |
if-no-files-found: error | |
- name: Build-BYOC ${{ inputs.target }} | |
run: | | |
cd build | |
# Delete the dev cert files | |
rm layers/meta-edge/recipes-edge/edge-core/files/mbed_cloud_dev_credentials.c | |
rm layers/meta-edge/recipes-edge/edge-core/files/update_default_resources.c | |
MACHINE=${{ inputs.target }} source setup-environment | |
export LOCALCONF="conf/local.conf" | |
cp ../.repo/manifests/conf/local.conf "$LOCALCONF" | |
# Inject BYOC config | |
echo -e "\n" >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_BYOC_MODE = "ON"' >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_FACTORY_MODE = "OFF"' >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_DEVELOPER_MODE = "OFF"' >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_FIRMWARE_UPDATE = "ON"' >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_FOTA_ENABLE = "ON"' >> "$LOCALCONF" | |
tail -n 14 "$LOCALCONF" | |
time bitbake ${{ inputs.image-type }} | |
# Move the image_license.manifest to image folder so that we can archive in 1 step | |
mv deploy/licenses/${{ inputs.image-type }}-${{ inputs.target }}/license.manifest deploy/images/${{ inputs.target }} | |
- name: Archive the BYOC WIC-file & license manifest for ${{ inputs.target }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: WIC-BYOC-${{ inputs.target }} | |
path: | | |
build/build-lmp/deploy/images/${{ inputs.target }}/${{ inputs.image-type }}-${{ inputs.target }}.wic.bmap | |
build/build-lmp/deploy/images/${{ inputs.target }}/${{ inputs.image-type }}-${{ inputs.target }}.wic.gz | |
build/build-lmp/deploy/images/${{ inputs.target }}/license.manifest | |
if-no-files-found: error | |
- name: Build-Factory ${{ inputs.target }} | |
run: | | |
cd build | |
MACHINE=${{ inputs.target }} source setup-environment | |
# Inject Factory config | |
export LOCALCONF="conf/local.conf" | |
# Copy over clean local.conf | |
cp ../.repo/manifests/conf/local.conf "$LOCALCONF" | |
echo -e "\n" >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_FACTORY_MODE = "ON"' >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_BYOC_MODE = "OFF"' >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_DEVELOPER_MODE = "OFF"' >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_FIRMWARE_UPDATE = "ON"' >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_FOTA_ENABLE = "ON"' >> "$LOCALCONF" | |
tail -n 14 "$LOCALCONF" | |
time bitbake ${{ inputs.image-type }} | |
# Move the image_license.manifest to image folder so that we can archive in 1 step | |
mv deploy/licenses/${{ inputs.image-type }}-${{ inputs.target }}/license.manifest deploy/images/${{ inputs.target }} | |
- name: Archive the Factory WIC-file & license manifest for ${{ inputs.target }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: WIC-Factory-${{ inputs.target }} | |
path: | | |
build/build-lmp/deploy/images/${{ inputs.target }}/${{ inputs.image-type }}-${{ inputs.target }}.wic.bmap | |
build/build-lmp/deploy/images/${{ inputs.target }}/${{ inputs.image-type }}-${{ inputs.target }}.wic.gz | |
build/build-lmp/deploy/images/${{ inputs.target }}/license.manifest | |
if-no-files-found: error | |
- name: Build-PARSEC-Factory ${{ inputs.target }} | |
run: | | |
cd build | |
MACHINE=${{ inputs.target }} source setup-environment | |
# Inject Factory config | |
export LOCALCONF="conf/local.conf" | |
# Copy over clean local.conf | |
cp ../.repo/manifests/conf/local.conf "$LOCALCONF" | |
echo -e "\n" >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_FACTORY_MODE = "ON"' >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_BYOC_MODE = "OFF"' >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_DEVELOPER_MODE = "OFF"' >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_FIRMWARE_UPDATE = "ON"' >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_FOTA_ENABLE = "ON"' >> "$LOCALCONF" | |
echo 'MBED_EDGE_CORE_CONFIG_PARSEC_TPM_SE_SUPPORT = "ON"' >> "$LOCALCONF" | |
tail -n 14 "$LOCALCONF" | |
time bitbake ${{ inputs.image-type }} | |
# Move the image_license.manifest to image folder so that we can archive in 1 step | |
mv deploy/licenses/${{ inputs.image-type }}-${{ inputs.target }}/license.manifest deploy/images/${{ inputs.target }} | |
- name: Archive the PARSEC Factory WIC-file & license manifest for ${{ inputs.target }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: WIC-PARSEC-Factory-${{ inputs.target }} | |
path: | | |
build/build-lmp/deploy/images/${{ inputs.target }}/${{ inputs.image-type }}-${{ inputs.target }}.wic.bmap | |
build/build-lmp/deploy/images/${{ inputs.target }}/${{ inputs.image-type }}-${{ inputs.target }}.wic.gz | |
build/build-lmp/deploy/images/${{ inputs.target }}/license.manifest | |
if-no-files-found: error | |