config: add config to cross compile 9k #55
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
name: package-cn10k-ml | |
on: | |
push: | |
schedule: | |
- cron: "0 0 * * 1" | |
pull_request: | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
packages: write | |
jobs: | |
ubuntu-cn10k-package: | |
name: ubuntu-cn10k-arm64 | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Extract version details | |
id: version | |
run: | | |
mkdir -p "${PWD}/artifacts" | |
git tag --points-at HEAD > /tmp/tags | |
[ -s /tmp/tags ] && PKG_POSTFIX= || PKG_POSTFIX=-devel | |
echo "PKG_VERSION_NAME=`cat VERSION`" >> "${PWD}/artifacts/env" | |
echo "PKG_POSTFIX=${PKG_POSTFIX}" >> "${PWD}/artifacts/env" | |
- name: Generate ML models package | |
run: | | |
source ${PWD}/artifacts/env | |
BASE_DIR=${PWD} | |
DISTRO=ubuntu-`lsb_release -rs` | |
echo "DISTRO=${DISTRO}" >> ${PWD}/artifacts/env | |
git clone -b ml-models "https://github.com/MarvellEmbeddedProcessors/MarvellMLTools.git" | |
cd "${PWD}/MarvellMLTools/" | |
ML_FW_VERSION=`cat ML_FW_VERSION` | |
FW_PKG_POSTFIX="" | |
mkdir -p "${PWD}"/install/lib/firmware/ml_models | |
cp -r "${PWD}"/models "${PWD}"/install/lib/firmware/ml_models/ | |
mkdir -p "${PWD}"/install/usr/local/bin | |
cp -r "${PWD}"/utils "${PWD}"/install/usr/local/bin | |
mkdir -p "${PWD}/install/DEBIAN" | |
cd "${PWD}/install/" | |
echo 'Package: ml-models-cn10k'${PKG_POSTFIX} >> DEBIAN/control | |
echo 'Version: '${PKG_VERSION_NAME} >> DEBIAN/control | |
echo "Maintainer: Jerin Jacob (jerinj@marvell.com)" >> DEBIAN/control | |
echo 'Depends: ml-firmware-cn10k'${FW_PKG_POSTFIX}' (= '$ML_FW_VERSION')' >> DEBIAN/control | |
echo "Architecture: arm64" >> DEBIAN/control | |
echo "Description: Machine learning inference engine for Marvell Octeon 10" >> DEBIAN/control | |
cd - | |
mv "${PWD}/install" "${PWD}/ml-models-cn10k${PKG_POSTFIX}_${PKG_VERSION_NAME}_arm64" | |
dpkg --build "${PWD}/ml-models-cn10k${PKG_POSTFIX}_${PKG_VERSION_NAME}_arm64" | |
cp -r "${PWD}/ml-models-cn10k${PKG_POSTFIX}_${PKG_VERSION_NAME}_arm64.deb" ${BASE_DIR}/artifacts/. | |
- name: Export version name | |
id: artifacts | |
run: | | |
source "${PWD}/artifacts/env" | |
echo $PKG_VERSION_NAME | |
echo "PKG_VERSION_NAME=${PKG_VERSION_NAME}" >> "$GITHUB_OUTPUT" | |
echo $DISTRO | |
echo "DISTRO=${DISTRO}" >> "$GITHUB_OUTPUT" | |
[[ "$PKG_POSTFIX" == "-devel" ]] && TAG=devel || TAG=${PKG_VERSION_NAME} | |
[[ "$PKG_POSTFIX" == "-devel" ]] && IS_DEVEL="true" || IS_DEVEL="false" | |
echo "PKG_POSTFIX=${PKG_POSTFIX}" >> "$GITHUB_OUTPUT" | |
echo "TAG=${TAG}" >> "$GITHUB_OUTPUT" | |
echo "IS_DEVEL=${IS_DEVEL}" >> "$GITHUB_OUTPUT" | |
- name: Delete existing ML models release | |
if: ${{ github.event_name == 'push' }} | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
if gh release view ml-models-cn10k-${{ steps.artifacts.outputs.PKG_VERSION_NAME }}-${{ steps.artifacts.outputs.DISTRO }}-${{ steps.artifacts.outputs.TAG }}; then | |
gh release delete ml-models-cn10k-${{ steps.artifacts.outputs.PKG_VERSION_NAME }}-${{ steps.artifacts.outputs.DISTRO }}-${{ steps.artifacts.outputs.TAG }} --cleanup-tag -y | |
else | |
echo "Release not found" | |
fi | |
- name: Release ML models cn10k package | |
uses: softprops/action-gh-release@v2.0.4 | |
if: ${{ github.event_name == 'push' }} | |
with: | |
tag_name: ml-models-cn10k-${{ steps.artifacts.outputs.PKG_VERSION_NAME }}-${{ steps.artifacts.outputs.DISTRO }}-${{ steps.artifacts.outputs.TAG }} | |
files: | | |
${{ github.workspace }}/artifacts/ml-models-cn10k${{ steps.artifacts.outputs.PKG_POSTFIX }}_${{ steps.artifacts.outputs.PKG_VERSION_NAME }}_arm64.deb | |
- name: Dispatch package update event | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.PPA_REPO_SECRET }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/marvellembeddedprocessors/packages/dispatches \ | |
-d '{"event_type":"dispatch-event", "client_payload": {"package" : "ml-models", | |
"tag": "ml-models-cn10k-${{ steps.artifacts.outputs.PKG_VERSION_NAME }}-${{ steps.artifacts.outputs.DISTRO }}-${{ steps.artifacts.outputs.TAG }}", | |
"distro" : "${{ steps.artifacts.outputs.DISTRO }}", | |
"platform" : "cn10k", | |
"devel" : "${{ steps.artifacts.outputs.IS_DEVEL }}"}}' |