Skip to content

Commit

Permalink
xApp Docker-CI
Browse files Browse the repository at this point in the history
  • Loading branch information
muriloAvlis committed Jun 11, 2024
1 parent 7c0f7a8 commit 7859db7
Showing 1 changed file with 83 additions and 84 deletions.
167 changes: 83 additions & 84 deletions .github/workflows/docker-CI.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
name: Build xApp Binary

on:
Expand All @@ -18,91 +16,92 @@ env:

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
with:
submodules: 'true'

- name: Setup and install Swig
uses: mmomtchev/setup-swig@v1
with:
version: v4.2.1

- name: Install dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
run: sudo apt install -y libsctp-dev libpcre2-dev ninja-build

- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build \
-GNinja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DE2AP_VERSION=${{env.E2AP_VERSION}} \
-DKPM_VERSION=${{env.KPM_VERSION}} \
-DCMAKE_C_FLAGS_RELEASE="-O3" \
-DCMAKE_CXX_FLAGS_RELEASE="-O3" \
-DCMAKE_C_COMPILER=${{env.C_COMPILER}} \
-DCMAKE_CXX_COMPILER=${{env.CPP_COMPILER}}
- name: Build xApp and service models
working-directory: ${{github.workspace}}/build
run: |
ninja xapp_iqos \
libkpm_sm.so \
librc_sm.so \
libmac_sm.so \
libslice_sm.so \
libpdcp_sm.so \
libgtp_sm.so \
libtc_sm.so \
librlc_sm.so \
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}}

- name: Copy binaries
run: bash scripts/cpRicFiles.sh

- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
muriloavlis/iqos-xapp
# generate Docker tags based on the following events/attributes
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image to Docker Hub
uses: docker/build-push-action@v5
with:
context: .
file: "docker/Dockerfile"
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- uses: actions/checkout@v4
with:
submodules: 'true'

- name: Setup and install Swig
uses: mmomtchev/setup-swig@v1
with:
version: v4.2.1

- name: Install dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: |
libsctp-dev \
libpcre2-dev \
ninja-build
- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build \
-GNinja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DE2AP_VERSION=${{env.E2AP_VERSION}} \
-DKPM_VERSION=${{env.KPM_VERSION}} \
-DCMAKE_C_FLAGS_RELEASE="-O3" \
-DCMAKE_CXX_FLAGS_RELEASE="-O3" \
-DCMAKE_C_COMPILER=${{env.C_COMPILER}} \
-DCMAKE_CXX_COMPILER=${{env.CPP_COMPILER}}
- name: Build xApp and service models
working-directory: ${{github.workspace}}/build
run: |
ninja xapp_iqos \
libkpm_sm.so \
librc_sm.so \
libmac_sm.so \
libslice_sm.so \
libpdcp_sm.so \
libgtp_sm.so \
libtc_sm.so \
librlc_sm.so \
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}}

- name: Copy binaries
run: bash scripts/cpRicFiles.sh

- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
muriloavlis/iqos-xapp
# generate Docker tags based on the following events/attributes
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image to Docker Hub
uses: docker/build-push-action@v5
with:
context: .
file: "docker/Dockerfile"
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}



0 comments on commit 7859db7

Please sign in to comment.