From 39e51a0047ff0c501cfd9e7654ca064919c0e67e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?=
 <charles.edouard@nirmata.com>
Date: Thu, 13 Apr 2023 15:47:34 +0200
Subject: [PATCH] chore: split unit tests and linter jobs (#6901)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
---
 .github/workflows/lint.yaml  | 41 ++++++++++++++++++++++++++++++++++++
 .github/workflows/tests.yaml | 15 +------------
 2 files changed, 42 insertions(+), 14 deletions(-)
 create mode 100644 .github/workflows/lint.yaml

diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml
new file mode 100644
index 0000000000..a700c789c5
--- /dev/null
+++ b/.github/workflows/lint.yaml
@@ -0,0 +1,41 @@
+name: Lint
+
+on:
+  push:
+    branches:
+      - '*'
+  pull_request:
+    branches:
+      - 'main'
+      - 'release*'
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
+permissions:
+  contents: read
+
+jobs:
+  tests:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
+      - name: Setup build env
+        uses: ./.github/actions/setup-build-env
+        with:
+          build-cache-key: lint
+      - name: golangci-lint
+        uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
+        with:
+          version: v1.52.2
+          skip-cache: true
+      - name: go fmt check
+        run: make fmt-check
+      - name: goimports check
+        run: make imports-check
+      - name: Checking unused pkgs using go mod tidy
+        run: make unused-package-check
+      - name: Go vet
+        run: make vet
diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
index 552cdf1b26..43dbe6b5eb 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -25,19 +25,6 @@ jobs:
       - name: Setup build env
         uses: ./.github/actions/setup-build-env
         with:
-          build-cache-key: pre-checks
-      - name: golangci-lint
-        uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
-        with:
-          version: v1.52.2
-          skip-cache: true
-      - name: go fmt check
-        run: make fmt-check
-      - name: goimports check
-        run: make imports-check
-      - name: Checking unused pkgs using go mod tidy
-        run: make unused-package-check
-      - name: Go vet
-        run: make vet
+          build-cache-key: tests
       - name: Unit test
         run: make test-unit