Skip to content

Commit

Permalink
migrate CI to github action
Browse files Browse the repository at this point in the history
Signed-off-by: Woojoong Kim <[email protected]>
  • Loading branch information
woojoong88 committed Jun 30, 2024
1 parent 39f09cc commit 45998c3
Show file tree
Hide file tree
Showing 10 changed files with 353 additions and 69 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2024 Intel Corporation

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "docker"
directory: "docker"
schedule:
interval: "weekly"
25 changes: 25 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2024 Intel Corporation

name: Build and test workflow
on:
pull_request:
branches:
- develop-onf
push:
branches:
- develop-onf

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: build
run: make build
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Unit tests
run: make test
28 changes: 28 additions & 0 deletions .github/workflows/code-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2024 Intel Corporation

name: Code scan workflow

on:
pull_request:
branches:
- develop-onf
push:
branches:
- develop-onf

jobs:
version-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: check version
run: make check-version
fossa-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: FOSSA scan
uses: fossa-contrib/fossa-action@v3
with:
fossa-api-key: 6d304c09a3ec097ba4517724e4a4d17d
133 changes: 133 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2024 Intel Corporation
# Copyright 2024 Kyunghee University
name: Publish image and tag/release code

on:
push:
branches:
- develop-onf

jobs:
version-check:
if: (github.repository_owner == 'onosproject')
runs-on: ubuntu-latest
outputs:
valid_version: ${{ steps.version-check-step.outputs.valid_version }}
dev_version: ${{ steps.dev-version-check-step.outputs.dev_version }}
target_version: ${{ steps.get-target-version-step.outputs.target_version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: check version
id: version-check-step
run: |
make check-version; if [[ $? == 0 ]]; then echo "valid_version=true" >> $GITHUB_OUTPUT; else echo "valid_version=false" >> $GITHUB_OUTPUT; fi
cat $GITHUB_OUTPUT
- name: check dev version
id: dev-version-check-step
run: |
f_dev=$(./build/bin/version_check.sh is_dev)
if [[ $f_dev == "true" ]]; then echo "dev_version=true" >> $GITHUB_OUTPUT; else echo "dev_version=false" >> $GITHUB_OUTPUT; fi
cat $GITHUB_OUTPUT
- name: get target version
id: get-target-version-step
run: |
echo "target_version=$(cat VERSION)" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
tag_versions:
runs-on: ubuntu-latest
needs: version-check
if: (github.repository_owner == 'onosproject') && (needs.version-check.outputs.valid_version == 'true') && (needs.version-check.outputs.dev_version == 'false')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: create release using REST API
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GH_ONOS_PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/releases \
-d '{
"tag_name": "v${{ needs.version-check.outputs.target_version }}",
"target_commitish": "${{ github.event.repository.default_branch }}",
"name": "v${{ needs.version-check.outputs.target_version }}",
"draft": false,
"prerelease": false,
"generate_release_notes": true
}'
publish-images:
runs-on: ubuntu-latest
needs: version-check
if: (github.repository_owner == 'onosproject') && (needs.version-check.outputs.valid_version == 'true')
env:
REGISTRY: docker.io
DOCKER_REPOSITORY: onosproject/
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image with tag latest
env:
DOCKER_TAG: latest
run: |
OAI_ALL_VERSION=${{ env.DOCKER_TAG }} make docker-build
OAI_ALL_VERSION=${{ env.DOCKER_TAG }} make docker-push
- name: Build and push Docker image with tag
if: needs.version-check.outputs.dev_version == 'false'
env:
DOCKER_TAG: v${{ needs.version-check.outputs.target_version }}
run: |
OAI_ALL_VERSION=${{ env.DOCKER_TAG }} make docker-build
OAI_ALL_VERSION=${{ env.DOCKER_TAG }} make docker-push
bump-up-version:
runs-on: ubuntu-latest
needs: version-check
if: (github.repository_owner == 'onosproject') && (needs.version-check.outputs.valid_version == 'true') && (needs.version-check.outputs.dev_version == 'false')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: increment version
run: |
IFS='.' read -r major minor patch <<< ${{ needs.version-check.outputs.target_version }}
patch_update=$((patch+1))
NEW_VERSION="$major.$minor.$patch_update-dev"
echo $NEW_VERSION > VERSION
echo "Updated version: $NEW_VERSION"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GH_ONOS_PAT }}
commit-message: Update version
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
signoff: true
branch: version-update
delete-branch: true
title: Update version
body: |
Update VERSION file
add-paths: |
VERSION
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ targets/bin/
*coverage*.xml
*-output.out

.vscode
28 changes: 0 additions & 28 deletions .vscode/launch.json

This file was deleted.

88 changes: 57 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,67 +1,93 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2019 Open Networking Foundation
# Copyright 2024 Intel Corporation

BUILD_BASE_VERSION := latest
OAI_ALL_VERSION := latest
OAI_ALL_VERSION ?= latest

all: images test
all: build docker-build

build: # @HELP build all OAI code
build: docker-build-oai-all docker-build-oai-ue docker-build-oai-enb docker-build-oai-enb-cu docker-build-oai-enb-du

test:
$(info No tests exist yet)

images: oai-all oai-ue oai-enb oai-enb-cu oai-enb-du

.PHONY: oai-build-base oai-ue oai-enb oai-enb-cu oai-enb-du

oai-build-base:
docker-build-oai-build-base: # @HELP build oai build base image
docker build . -f docker/oai-build-base/Dockerfile \
-t onosproject/oai-build-base:${BUILD_BASE_VERSION}
-t onosproject/oai-build-base:${OAI_ALL_VERSION}

oai-all:
docker-build-oai-all: # @HELP build oai all image
docker build . -f docker/oai-all/Dockerfile \
--build-arg BUILD_BASE_VERSION=${BUILD_BASE_VERSION} \
--build-arg OAI_ALL_VERSION=${OAI_ALL_VERSION} \
-t onosproject/oai-all:${OAI_ALL_VERSION}

oai-ue:
docker-build-oai-ue: # @HELP build oai ue image
docker build . -f docker/oai-ue/Dockerfile \
--build-arg OAI_ALL_VERSION=${OAI_ALL_VERSION} \
-t onosproject/oai-ue:${OAI_ALL_VERSION}
-docker rmi $$(docker images -q -f "dangling=true" -f "label=autodelete=true")

oai-enb:
docker-build-oai-enb: # @HELP build oai enb image
docker build . -f docker/oai-enb/Dockerfile \
--build-arg BUILD_BASE_VERSION=${BUILD_BASE_VERSION} \
--build-arg OAI_ALL_VERSION=${OAI_ALL_VERSION} \
-t onosproject/oai-enb:${OAI_ALL_VERSION}
-docker rmi $$(docker images -q -f "dangling=true" -f "label=autodelete=true")

oai-enb-cu:
docker-build-oai-enb-cu: # @HELP build oai enb cu image
docker build . -f docker/oai-enb-cu/Dockerfile \
--build-arg BUILD_BASE_VERSION=${BUILD_BASE_VERSION} \
--build-arg OAI_ALL_VERSION=${OAI_ALL_VERSION} \
-t onosproject/oai-enb-cu:${OAI_ALL_VERSION}
-docker rmi $$(docker images -q -f "dangling=true" -f "label=autodelete=true")

oai-enb-du:
docker-build-oai-enb-du: # @HELP build oai enb du image
docker build . -f docker/oai-enb-du/Dockerfile \
--build-arg BUILD_BASE_VERSION=${BUILD_BASE_VERSION} \
--build-arg OAI_ALL_VERSION=${OAI_ALL_VERSION} \
-t onosproject/oai-enb-du:${OAI_ALL_VERSION}
-docker rmi $$(docker images -q -f "dangling=true" -f "label=autodelete=true")

dev-base:
docker build . -f docker/dev/base/Dockerfile -t oai-enb-cu-base:latest --rm=false
docker-build: # @HELP build all Docker images
docker-build: build

dev:
docker build . -f docker/dev/Dockerfile -t onosproject/oai-enb-cu:latest --rm=false
docker-push-oai-build-base: # @HELP push oai build base image
docker build . -f docker/oai-build-base/Dockerfile \
-t onosproject/oai-build-base:${OAI_ALL_VERSION}

build-tools: # @HELP install the ONOS build tools if needed
@if [ ! -d "../build-tools" ]; then cd .. && git clone https://github.com/onosproject/build-tools.git; fi
docker-push-oai-all: # @HELP push oai all image
docker build . -f docker/oai-all/Dockerfile \
--build-arg OAI_ALL_VERSION=${OAI_ALL_VERSION} \
-t onosproject/oai-all:${OAI_ALL_VERSION}

jenkins-tools: # @HELP installs tooling needed for Jenkins
cd .. && go get -u github.com/jstemmer/go-junit-report && go get github.com/t-yuki/gocover-cobertura
docker-push-oai-ue: # @HELP push oai ue image
docker build . -f docker/oai-ue/Dockerfile \
--build-arg OAI_ALL_VERSION=${OAI_ALL_VERSION} \
-t onosproject/oai-ue:${OAI_ALL_VERSION}
-docker rmi $$(docker images -q -f "dangling=true" -f "label=autodelete=true")

jenkins-test: images build-tools jenkins-tools
TEST_PACKAGES=NONE ./../build-tools/build/jenkins/make-unit
docker-push-oai-enb: # @HELP push oai enb image
docker build . -f docker/oai-enb/Dockerfile \
--build-arg OAI_ALL_VERSION=${OAI_ALL_VERSION} \
-t onosproject/oai-enb:${OAI_ALL_VERSION}
-docker rmi $$(docker images -q -f "dangling=true" -f "label=autodelete=true")

docker-push-oai-enb-cu: # @HELP push oai enb cu image
docker build . -f docker/oai-enb-cu/Dockerfile \
--build-arg OAI_ALL_VERSION=${OAI_ALL_VERSION} \
-t onosproject/oai-enb-cu:${OAI_ALL_VERSION}
-docker rmi $$(docker images -q -f "dangling=true" -f "label=autodelete=true")

docker-push-oai-enb-du: # @HELP push oai enb du image
docker build . -f docker/oai-enb-du/Dockerfile \
--build-arg OAI_ALL_VERSION=${OAI_ALL_VERSION} \
-t onosproject/oai-enb-du:${OAI_ALL_VERSION}
-docker rmi $$(docker images -q -f "dangling=true" -f "label=autodelete=true")

publish: # @HELP publish version on github and dockerhub
./../build-tools/publish-version ${VERSION} onosproject/oai-ue onosproject/oai-enb onosproject/oai-enb-cu onosproject/oai-enb-du
docker-push: # @HELP push docker images
docker-push: docker-push-oai-all docker-push-oai-ue docker-push-oai-enb docker-push-oai-enb-cu docker-push-oai-enb-du

jenkins-publish: build-tools jenkins-tools
./build/bin/push-images
BASE_BRANCH=develop-onf ../build-tools/release-merge-commit
dev-base:
docker build . -f docker/dev/base/Dockerfile -t oai-enb-cu-base:latest --rm=false

dev:
docker build . -f docker/dev/Dockerfile -t onosproject/oai-enb-cu:latest --rm=false
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The RIC Agent is an ONF addition to OAI that adds support for interfacing the OA
$ cd openairinterface5g
$ source oaienv
$ cd cmake_targets
$ ./build_oai -c -I --eNB --UE -w USRP -g --build-ric-agent
$ ./build_oai -c -I --eNB --UE -w USRP -g --build-ric-agent --build-ran-slicing
```

The top-level *Makefile* builds docker images that include the RIC Agent:
Expand Down
9 changes: 0 additions & 9 deletions build/bin/push-images

This file was deleted.

Loading

0 comments on commit 45998c3

Please sign in to comment.