Repository: kubernetes-sigs/security-profiles-operator (c)

Issue:
go lint failures on macos
#### What happened:
The `make verify-go-lint` fails on macos.
`ERRO Running error: buildir: failed to load package : could not load export data: no export data for "github.com/seccomp/libseccomp-golang"`

#### What you expected to happen:
Should not fail on macos.

#### How to reproduce it (as minimally and precisely as possible):
`make verify-go-lint`
https://github.com/naveensrinivasan/security-profiles-operator/runs/1765263186?check_suite_focus=true

#### Anything else we need to know?:

#### Environment:

- Cloud provider or hardware configuration:
- OS (e.g: `cat /etc/os-release`):
- Kernel (e.g. `uname -a`):
- Others:


Pull request:
Fix - fixed the golanglintci issues for macos


#### What type of PR is this?
Ensures that golang-lint works on macos 

/kind cleanup


#### What this PR does / why we need it:
If not the golang-lint is broken on macos

#### Which issue(s) this PR fixes:
Fixes #235  


#### Does this PR have test?
N/A


#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?

NONE

```release-note
NONE
```


Patch:
diff --git a/.codecov.yml b/.codecov.yml
new file mode 100644
index 000000000..df2db6cb5
--- /dev/null
+++ b/.codecov.yml
@@ -0,0 +1,33 @@
+---
+codecov:
+  notify:
+    after_n_builds: 1
+    require_ci_to_pass: false
+
+coverage:
+  precision: 2
+  round: down
+  range: 50..75
+
+  status:
+    project:
+      default:
+        enabled: true
+        # allowed to drop coverage and still result in a "success" commit status
+        threshold: null
+        if_not_found: success
+        if_no_uploads: success
+        if_ci_failed: error
+    patch:
+      default:
+        enabled: true
+        threshold: null
+        if_not_found: success
+        if_no_uploads: success
+        if_ci_failed: error
+    changes: false
+
+comment:
+  layout: "header, diff"
+  behavior: default
+  require_changes: false
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 32d65f323..dee7fcf9a 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,4 +1,4 @@
-name: build
+name: macosbuild
 on: [push, pull_request]
 jobs:
   validate:
@@ -15,3 +15,5 @@ jobs:
           go-version: '^1.15'
       - name: unit test
         run: make test-unit
+      - name: verify
+        run: make verify-go-lint
diff --git a/.golangci.yml b/.golangci.yml
index c3a24f1e1..5b0f8270f 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -1,10 +1,5 @@
 ---
 run:
-  build-tags:
-    - e2e
-    - netgo
-    - osusergo
-    - seccomp
   concurrency: 6
   deadline: 5m
 linters:
diff --git a/Makefile b/Makefile
index ac117b3ba..a220d352e 100644
--- a/Makefile
+++ b/Makefile
@@ -33,6 +33,14 @@ BUILDTAGS := netgo osusergo seccomp
 else
 BUILDTAGS := netgo osusergo
 endif
+
+ifneq ($(shell uname -s), Darwin)
+LINT_BUILDTAGS := e2e,netgo,osusergo,seccomp
+else
+LINT_BUILDTAGS := e2e,netgo,osusergo
+endif
+
+
 BUILD_FILES := $(shell find . -type f -name '*.go' -or -name '*.mod' -or -name '*.sum' -not -name '*_test.go')
 export GOFLAGS?=-mod=mod
 GO_PROJECT := sigs.k8s.io/$(PROJECT)
@@ -139,7 +147,7 @@ verify-deployments: deployments ## Verify the generated deployments
 
 .PHONY: verify-go-lint
 verify-go-lint: $(BUILD_DIR)/golangci-lint ## Verify the golang code by linting
-	$(BUILD_DIR)/golangci-lint run
+	$(BUILD_DIR)/golangci-lint run --build-tags $(LINT_BUILDTAGS)
 
 $(BUILD_DIR)/golangci-lint:
 	export \
@@ -154,6 +162,9 @@ $(BUILD_DIR)/golangci-lint:
 
 .PHONY: test-unit
 test-unit: $(BUILD_DIR) ## Run the unit tests
+	# remove all coverage files if exists
+	rm -rf *.out
+	# run the go tests and gen the file coverage-all used to do the integration with coverrals.io
 	$(GO) test -ldflags '$(LDVARS)' -tags '$(BUILDTAGS)' -race -v -test.coverprofile=$(BUILD_DIR)/coverage.out ./internal/...
 	$(GO) tool cover -html $(BUILD_DIR)/coverage.out -o $(BUILD_DIR)/coverage.html
 


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 000000000..c90a77ce7
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,28 @@
+# Inlcuding the tests with ubuntu to get actual test coverage. The OSX builds skip seccomp tests.
+name: test-coverage
+on:
+  push:
+    branches:
+      - master
+  pull_request:
+jobs:
+  validate:
+    name: Validate 
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - name: Setup Go
+        uses: actions/setup-go@v2
+        with:
+          go-version: '1.15'
+      - name: Install libseccomp-dev
+        run: |
+          sudo apt update
+          sudo apt install -y libseccomp-dev
+      - name: unit test
+        run: make test-unit
+      - uses: codecov/codecov-action@v1
+        with:
+          files: build/coverage.out
+          flags: unittests 
+          verbose: true