From aaa904a380445e458b03793b7bea362b43acb1d8 Mon Sep 17 00:00:00 2001 From: Pavan Nikhilesh Date: Tue, 6 Aug 2024 17:46:24 +0530 Subject: [PATCH] ci: add github workflow Add github workflow for building cn10k ubuntu 22.04 package. Signed-off-by: Pavan Nikhilesh --- .github/workflows/build-cn10k.yml | 142 ++++++++++++++++++++++++++++++ VERSION | 1 + 2 files changed, 143 insertions(+) create mode 100644 .github/workflows/build-cn10k.yml create mode 100644 VERSION diff --git a/.github/workflows/build-cn10k.yml b/.github/workflows/build-cn10k.yml new file mode 100644 index 0000000..267a6c1 --- /dev/null +++ b/.github/workflows/build-cn10k.yml @@ -0,0 +1,142 @@ +name: build-cn10k + +on: + push: + schedule: + - cron: "0 0 * * 1" + pull_request: + +permissions: + contents: write + pages: write + id-token: write + packages: write + +jobs: + ubuntu-cn10k-build: + name: ubuntu-cn10k-arm64 + runs-on: ubuntu-latest + + strategy: + fail-fast: true + matrix: + include: + - arch: aarch64 + distro: ubuntu22.04 + compiler: gcc + library: static + + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - name: Generate cache keys + id: get_ref_keys + run: | + echo 'ccache=ccache-${{ matrix.distro }}-${{ matrix.compiler }}-${{ matrix.arch }}-'$(date -u +%Y-w%W) >> $GITHUB_OUTPUT + - name: Retrieve ccache cache + uses: actions/cache@v4 + with: + path: ~/.ccache + key: ${{ steps.get_ref_keys.outputs.ccache }}-${{ github.ref }} + restore-keys: | + ${{ steps.get_ref_keys.outputs.ccache }}-refs/heads/main + - 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" + [[ "$PKG_POSTFIX" == "-devel" ]] && TAG=devel || TAG=${PKG_VERSION_NAME} + echo "TAG=${TAG}" >> "${PWD}/artifacts/env" + source "${PWD}/artifacts/env" + echo "TAG=${TAG}" >> "$GITHUB_OUTPUT" + - uses: uraimo/run-on-arch-action@v2.7.2 + name: Build OCTEON-EP and generate package + id: build + with: + arch: ${{ matrix.arch }} + distro: ${{ matrix.distro }} + githubToken: ${{ github.token }} + setup: | + mkdir -p ~/.ccache + dockerRunArgs: | + --volume "${PWD}/artifacts:/artifacts" + --volume "${HOME}/.ccache:/root/.ccache" + shell: /bin/bash + install: | + apt-get update -q -y + apt-get install -y build-essential gcc meson ccache git doxygen apt-utils dialog + apt-get install -y ccache git software-properties-common wget libconfig-dev + run: | + source /artifacts/env + git config --global --add safe.directory "${PWD}" + DISTRO=ubuntu-`lsb_release -rs` + echo "DISTRO=${DISTRO}" >> /artifacts/env + export CC='ccache gcc' + export AR='ar' + export LD='ld' + export CFLAGS="-DUSE_PEM_AND_DPI_PF=1" + export INSTALL_PATH=$PWD/install/usr + cd target/libs/octep_cp_lib + echo "cache_dir = /root/.ccache" > /root/.ccache/ccache.conf + ccache -p + make install + cd - + cd target/apps/octep_cp_agent/ + CFLAGS="-I$INSTALL_PATH/include" LDFLAGS="-L$INSTALL_PATH/lib" make install + cp cn103-102.cfg $INSTALL_PATH/bin/. + cp cn106xx.cfg $INSTALL_PATH/bin/. + cd - + mkdir -p "${PWD}/install/debian" + mkdir -p "${PWD}/install/DEBIAN" + cd "${PWD}/install" + echo 'Source: OCTEON-EP' > debian/control + echo 'Package: oct-ep-target-cn10k'$PKG_POSTFIX >> DEBIAN/control + echo 'Version: '$PKG_VERSION_NAME >> DEBIAN/control + echo "Depends: `dpkg-shlibdeps -O usr/bin/octep_cp_agent | awk -F'Depends=' '{print $2}'`" >> DEBIAN/control + echo "Maintainer: Jerin Jacob (jerinj@marvell.com)" >> DEBIAN/control + echo "Architecture: arm64" >> DEBIAN/control + echo "Description: Octeon-ep agent for Marvell Octeon 10" >> DEBIAN/control + rm -rf debian + cd - + mv "${PWD}/install" "${PWD}/oct-ep-target-cn10k${PKG_POSTFIX}_${PKG_VERSION_NAME}_arm64" + dpkg --build "${PWD}/oct-ep-target-cn10k${PKG_POSTFIX}_${PKG_VERSION_NAME}_arm64" + cp "${PWD}/oct-ep-target-cn10k${PKG_POSTFIX}_${PKG_VERSION_NAME}_arm64.deb" /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 $PKG_POSTFIX + echo "PKG_POSTFIX=${PKG_POSTFIX}" >> "$GITHUB_OUTPUT" + echo $DISTRO + echo "DISTRO=${DISTRO}" >> "$GITHUB_OUTPUT" + - name: Delete existing release + if: ${{ github.event_name == 'push' }} + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release delete oct-ep-target-cn10k-${{ steps.artifacts.outputs.PKG_VERSION_NAME }}-ubuntu-${{ steps.artifacts.outputs.DISTRO }}-${{ steps.version.outputs.TAG }} --cleanup-tag -y + continue-on-error: true + - name: Release octeon ep cn10k package + uses: softprops/action-gh-release@v2.0.4 + if: ${{ github.event_name == 'push' }} + with: + tag_name: oct-ep-target-cn10k-${{ steps.artifacts.outputs.PKG_VERSION_NAME }}-ubuntu-${{ steps.artifacts.outputs.DISTRO }}-${{ steps.version.outputs.TAG }} + files: | + ${{ github.workspace }}/artifacts/oct-ep-target-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" : "octeon-ep", + "tag": "oct-ep-target-cn10k-${{ steps.artifacts.outputs.PKG_VERSION_NAME }}-ubuntu-${{ steps.artifacts.outputs.DISTRO }}-${{ steps.version.outputs.TAG }}", + "has_dpdk" : "false", "distro" : "${{ steps.artifacts.outputs.DISTRO }}"}}' diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..7af777b --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +24.07.0