Skip to content

Commit

Permalink
Arrange github workflows
Browse files Browse the repository at this point in the history
Signed-off-by: gatici <[email protected]>
  • Loading branch information
gatici committed Jan 17, 2024
1 parent 5c30540 commit fbfe3a9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ jobs:
with:
go-version-file: 'go.mod'

- name: Build and push Docker image
- name: Build Docker image
run: |
cd mongoapi/dbtestapp
make docker-build
make docker-push
build:
runs-on: ubuntu-latest
Expand All @@ -56,6 +55,9 @@ jobs:
lint:
name: lint
runs-on: ubuntu-latest
strategy:
matrix:
directory: [drsm, flowdesc, fsm, httpwrapper, idgenerator, logger, mapstruct, milenage, mongoapi, mongoapi/dbtestapp, ueauth, version]
steps:
- uses: actions/checkout@v4

Expand All @@ -67,7 +69,8 @@ jobs:
uses: golangci/[email protected]
with:
version: latest
args: -v --config ./.golangci.yml
args: -v --config ../.golangci.yml
working-directory: ${{ matrix.directory }}

license-check:
runs-on: ubuntu-latest
Expand Down
8 changes: 4 additions & 4 deletions mongoapi/dbtestapp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
# SPDX-License-Identifier: Apache-2.0
#

FROM golang:1.21.3-bookworm AS test
FROM golang:1.21.6-bookworm AS test

LABEL maintainer="ONF <[email protected]>"

RUN apt-get update && apt-get -y install vim

RUN cd $GOPATH/src && mkdir -p dbtestapp
COPY . $GOPATH/src/dbtestapp
RUN cd $GOPATH/src/dbtestapp && go install
WORKDIR $GOPATH/src/dbtestapp
COPY . .
RUN go install

FROM alpine:3.16 AS dbtestapp
RUN apk update && apk add -U gcompat vim strace net-tools curl netcat-openbsd bind-tools bash
Expand Down
8 changes: 4 additions & 4 deletions mongoapi/dbtestapp/student.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ func StudentRecordTest(c *gin.Context) {
if err == nil {
log.Printf("Retrieved student %v ", student)
} else {
log.Printf("Failed to retrieve student %v. Error - ", student, err)
log.Printf("Failed to retrieve student %v. Error - %+v", student, err)
}

insertStudentInDB(collName, "John Smith", 25)

// test document fetch from student that doesn't exist.
qName := "Nerf Doodle"
student, err = getStudentFromDB(collName, qName)
_, err = getStudentFromDB(collName, qName)
if err == nil {
log.Printf("Retrieved student %v ", qName)
} else {
log.Printf("Failed to retrieve student %v. Error - ", qName, err)
log.Printf("Failed to retrieve student %v. Error - %+v ", qName, err)
}
c.JSON(http.StatusOK, gin.H{})
}
Expand All @@ -65,7 +65,7 @@ func insertStudentInDB(collName string, name string, age int) {
filter := bson.M{}
_, err := mongoHndl.PutOneCustomDataStructure(collName, filter, student)
if err != nil {
log.Printf("Inserting student %v failed with error ", student, err)
log.Printf("Inserting student %v failed with error %+v ", student, err)
return
}
log.Printf("Inserting student %v successful ", student)
Expand Down

0 comments on commit fbfe3a9

Please sign in to comment.