Skip to content

Commit

Permalink
github action support
Browse files Browse the repository at this point in the history
  • Loading branch information
badhrinathpa committed Nov 25, 2022
1 parent a0f0671 commit be60da4
Show file tree
Hide file tree
Showing 11 changed files with 210 additions and 16 deletions.
21 changes: 21 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2022 Intel Corporation

# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:

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

- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
45 changes: 45 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2022 Intel Corporation
name: Docker image

on:
push:
branches:
- master
tags:
- v*

jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout and build
- uses: actions/checkout@v3
- name: Build and push Docker image
run: |
make docker-build
# push-dockerhub:
# env:
# DOCKER_REGISTRY: "docker.io/"
# DOCKER_REPOSITORY: "badhrinathpa/"
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
#
# - run: echo GIT_SHA_SHORT=$(git rev-parse --short HEAD) >> $GITHUB_ENV
#
# - id: docker-login
# uses: docker/login-action@v2.1.0
# with:
# registry: docker.io
# username: ${{ secrets.DOCKER_HUB_LOGIN }}
# password: ${{ secrets.DOCKER_HUB_PASSWORD }}
#
# - name: Build and push "master-latest" Docker images
# env:
# DOCKER_TAG: master-${{ env.GIT_SHA_SHORT }
# run: |
# make docker-build
# make docker-push

21 changes: 21 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2022 Intel Corporation
name: golangci-lint
on:
push:
tags:
- v*
branches:
- master
pull_request:
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.2.0
with:
version: latest
args: -v --config ./.golangci.yml
48 changes: 48 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2022 Intel Corporation
name: Pull Request

on: [pull_request]

concurrency:
group: ${{ github.event.pull_request.number }}
cancel-in-progress: true


jobs:
build:
#env:
# DOCKER_REGISTRY: "docker.io/"
# DOCKER_REPOSITORY: "badhrinathpa/"
# VERSION: "PR-${{ github.event.pull_request.number }}"
runs-on: ubuntu-latest
steps:
# Checkout and build
- uses: actions/checkout@v3

- name: Build Docker image
run: |
make docker-build
# Format the code
- name: Go Format
run: |
make fmt
- name: Show all CI changes
run: |
git --no-pager diff
# Build again and commit
- name: Build Docker image after format
run: |
make docker-build
- name: Update PR with changes
uses: gr2m/create-or-update-pull-request-action@v1.x
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: |
Updated with changes from CI
branch: ${{ github.event.pull_request.head.ref }}
author: "Github Actions <actions@github>"
commit-message: "Actions: Updated with changes from CI"
18 changes: 18 additions & 0 deletions .github/workflows/reuse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2022 Intel Corporation
---
name: REUSE

on:
push:
branches:
- master
pull_request:

jobs:
license-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: reuse lint
run: make check-reuse
21 changes: 21 additions & 0 deletions .github/workflows/run-udm-unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2022 Intel Corporation

name: Unit tests

on:
push:
branches:
- master
pull_request:

jobs:
unit-test-pfcpiface:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3

- name: Run unit tests for UDM
run: |
make test
3 changes: 0 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,7 @@ linters:
- staticcheck
- unused
- gosimple
- structcheck
- varcheck
- ineffassign
- deadcode
- typecheck
# Additional
- lll
Expand Down
30 changes: 27 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright 2019 free5GC.org
#
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2019 free5GC.org
# Copyright 2022 Intel Corporation
#

PROJECT_NAME := sdcore
Expand Down Expand Up @@ -81,3 +80,28 @@ docker-push:
for target in $(DOCKER_TARGETS); do \
docker push ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}5gc-$$target:${DOCKER_TAG}; \
done

.coverage:
rm -rf $(CURDIR)/.coverage
mkdir -p $(CURDIR)/.coverage

test: .coverage
docker run --rm -v $(CURDIR):/udm -w /udm golang:latest \
go test \
-race \
-failfast \
-coverprofile=.coverage/coverage-unit.txt \
-covermode=atomic \
-v \
./ ./...


fmt:
@go fmt ./...

golint:
@docker run --rm -v $(CURDIR):/app -w /app golangci/golangci-lint:latest golangci-lint run -v --config /app/.golangci.yml

check-reuse:
@docker run --rm -v $(CURDIR):/udm -w /udm omecproject/reuse-verify:latest reuse lint

4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
github.com/omec-project/UeauCommon v1.1.0 h1:ynW22r/Xx/z6saviuzUeNjYlqdJfiMNtNwlv6Ot76Wk=
github.com/omec-project/UeauCommon v1.1.0/go.mod h1:brKbJNGvDPgHcubWt6G45hVuxZ2Crdp/1tKXWw6zTCY=
github.com/omec-project/config5g v1.1.0 h1:NwXNSmy08xHBY5uF4iA3cEUVJRw2wKSxwc641FgCz20=
github.com/omec-project/config5g v1.1.0/go.mod h1:AWFzCbbgCBx/iJwt+zWbpDGLHRpFzg24OYHqIkdcMVA=
github.com/omec-project/config5g v1.2.0 h1:fyIg+1LZ9jn8DTkVUbD4jyxA4FgMICdIBwZVnzCyMd4=
github.com/omec-project/config5g v1.2.0/go.mod h1:AWFzCbbgCBx/iJwt+zWbpDGLHRpFzg24OYHqIkdcMVA=
github.com/omec-project/http2_util v1.1.0 h1:8H2NME/V8iONth8TlyK/3w4pguAzaeUnEv9pmeAocwQ=
github.com/omec-project/http2_util v1.1.0/go.mod h1:QwoZRaUyhEp/kTEqXvf0gCYtfQrNHBdkVw939vsMjZY=
github.com/omec-project/http_wrapper v1.1.0 h1:2hD8RUaR/VVg3tUUfuxsuo1/JNpZLiAE8IvATGqDME4=
Expand Down
8 changes: 4 additions & 4 deletions service/init.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2021 Open Networking Foundation <info@opennetworking.org>
// Copyright 2019 free5GC.org
//
// SPDX-License-Identifier: Apache-2.0
// Copyright 2019 free5GC.org
// Copyright 2021 Open Networking Foundation <info@opennetworking.org>
// Copyright 2022 Intel Corporation
//

package service
Expand Down Expand Up @@ -378,7 +378,7 @@ func (udm *UDM) BuildAndSendRegisterNFInstance() (models.NfProfile, error) {
self := context.UDM_Self()
profile, err := consumer.BuildNFInstance(self)
if err != nil {
initLog.Error("Build UDM Profile Error: %v", err)
initLog.Error("Build UDM Profile Error: ", err)
return profile, err
}
initLog.Infof("Pcf Profile Registering to NRF: %v", profile)
Expand Down
7 changes: 3 additions & 4 deletions udm.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2019 free5GC.org
//
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2022 Intel Corporation
// Copyright 2019 free5GC.org

package main

Expand All @@ -26,7 +25,7 @@ func init() {

func main() {
app := cli.NewApp()
app.Name = "udm"
app.Name = "udm"
fmt.Print(app.Name, "\n")
app.Usage = "-free5gccfg common configuration file -udmcfg udm configuration file"
app.Action = action
Expand Down

0 comments on commit be60da4

Please sign in to comment.