diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..9e1eef61 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,103 @@ +name: CI + +on: + push: + branches: [ "main", "develop" ] + pull_request: + branches: [ "main", "develop" ] + +env: + GOFLAGS: "-mod=mod" + CONTAINER_ENGINE: docker + +jobs: + # ========================= + # Build + Generate + Manifests + # ========================= + build: + name: Build & Generate + runs-on: ubuntu-22.04 + + steps: + - name: Generate code + run: make generate + + - name: Build manager binary + run: make manager + + - name: Generate manifests + run: make manifests + + # ========================= + # Unit tests + # ========================= + unit-test: + name: Unit Tests + runs-on: ubuntu-22.04 + needs: build + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Run unit tests + run: make unit-test + + # ========================= + # Helm build (k8s) + # ========================= + helm-build: + name: Helm Build (k8s) + runs-on: ubuntu-22.04 + needs: build + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y make curl + + - name: Install Helm + uses: azure/setup-helm@v4 + with: + version: v3.14.4 + + - name: Generate Helm charts (k8s) + run: make helm-k8s + + # ========================= + # Docker image build + # ========================= + docker-build: + name: Docker Build + runs-on: ubuntu-22.04 + needs: build + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Build Docker image + run: make docker-build + diff --git a/internal/controllers/network_config_reconciler_test.go b/internal/controllers/network_config_reconciler_test.go index c49dfe74..c903eb0b 100644 --- a/internal/controllers/network_config_reconciler_test.go +++ b/internal/controllers/network_config_reconciler_test.go @@ -94,7 +94,7 @@ var _ = Describe("getLabelsPerModules", func() { BeforeEach(func() { ctrl := gomock.NewController(GinkgoT()) kubeClient = mock_client.NewMockClient(ctrl) - dcrh = newNetworkConfigReconcilerHelper(kubeClient, nil, nil, nil, nil, nil, nil, nil, nil) + dcrh = newNetworkConfigReconcilerHelper(kubeClient, nil, nil, nil, nil, nil, nil, nil) }) ctx := context.Background() @@ -139,7 +139,7 @@ var _ = Describe("setFinalizer", func() { BeforeEach(func() { ctrl := gomock.NewController(GinkgoT()) kubeClient = mock_client.NewMockClient(ctrl) - dcrh = newNetworkConfigReconcilerHelper(kubeClient, nil, nil, nil, nil, nil, nil, nil, nil) + dcrh = newNetworkConfigReconcilerHelper(kubeClient, nil, nil, nil, nil, nil, nil, nil) }) ctx := context.Background() @@ -175,7 +175,7 @@ var _ = PDescribe("finalizeNetworkConfig", func() { BeforeEach(func() { ctrl := gomock.NewController(GinkgoT()) kubeClient = mock_client.NewMockClient(ctrl) - dcrh = newNetworkConfigReconcilerHelper(kubeClient, nil, nil, nil, nil, nil, nil, nil, nil) + dcrh = newNetworkConfigReconcilerHelper(kubeClient, nil, nil, nil, nil, nil, nil, nil) }) ctx := context.Background() @@ -345,7 +345,7 @@ var _ = PDescribe("handleKMMModule", func() { ctrl := gomock.NewController(GinkgoT()) kubeClient = mock_client.NewMockClient(ctrl) kmmHelper = kmmmodule.NewMockKMMModuleAPI(ctrl) - dcrh = newNetworkConfigReconcilerHelper(kubeClient, kmmHelper, nil, nil, nil, nil, nil, nil, nil) + dcrh = newNetworkConfigReconcilerHelper(kubeClient, kmmHelper, nil, nil, nil, nil, nil, nil) }) ctx := context.Background() @@ -413,7 +413,7 @@ var _ = Describe("handleBuildConfigMap", func() { ctrl := gomock.NewController(GinkgoT()) kubeClient = mock_client.NewMockClient(ctrl) kmmHelper = kmmmodule.NewMockKMMModuleAPI(ctrl) - dcrh = newNetworkConfigReconcilerHelper(kubeClient, kmmHelper, nil, nil, nil, nil, nil, nil, nil) + dcrh = newNetworkConfigReconcilerHelper(kubeClient, kmmHelper, nil, nil, nil, nil, nil, nil) }) ctx := context.Background()