Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI Pipeline - nf-example

on:
push:
branches: [ "main", "lab7-ci" ]
pull_request:
branches: [ "main" ]

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'

- name: Install dependencies
run: go mod tidy

- name: Run Linter
run: |
go install golang.org/x/lint/golint@latest
golint ./...

- name: Build the application
run: go build -v ./...

- name: Run Unit Tests
run: go test ./... -v
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI Pipeline for nf-example

on:
push:
branches: [ lab7-ci, main ]
pull_request:
branches: [ main ]

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Install dependencies
run: go mod tidy

- name: Lint check
run: |
go fmt ./...
echo "✅ Code formatting checked"

- name: Build project
run: go build -v ./...

- name: Run unit tests
run: go test ./... -v
11 changes: 11 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package main

import "testing"

func TestSum(t *testing.T) {
a, b := 2, 3
result := a + b
if result != 5 {
t.Errorf("Expected 5, got %d", result)
}
}