From f9fec4828a02531a54a73d12a8da04df35133c44 Mon Sep 17 00:00:00 2001
From: Maksym Trofimenko <maksym@container-registry.com>
Date: Sun, 28 Apr 2024 14:24:57 +0100
Subject: [PATCH] restructures gh actions

---
 ...build-and-push.yaml => build-release.yaml} |  7 +---
 .github/workflows/test-pr.yaml                | 36 +++++++++++++++++++
 2 files changed, 37 insertions(+), 6 deletions(-)
 rename .github/workflows/{build-and-push.yaml => build-release.yaml} (96%)
 create mode 100644 .github/workflows/test-pr.yaml

diff --git a/.github/workflows/build-and-push.yaml b/.github/workflows/build-release.yaml
similarity index 96%
rename from .github/workflows/build-and-push.yaml
rename to .github/workflows/build-release.yaml
index 05252a5..af6f91f 100644
--- a/.github/workflows/build-and-push.yaml
+++ b/.github/workflows/build-release.yaml
@@ -1,10 +1,5 @@
-name: "Build container images"
+name: "Build Release"
 on:
-  pull_request:
-    branches:
-      - main
-    paths-ignore:
-      - 'docs/**'
   push:
     tags:
       - 'v*.*.*'
diff --git a/.github/workflows/test-pr.yaml b/.github/workflows/test-pr.yaml
new file mode 100644
index 0000000..44a3650
--- /dev/null
+++ b/.github/workflows/test-pr.yaml
@@ -0,0 +1,36 @@
+name: "Test PR"
+on:
+  pull_request:
+    branches:
+      - main
+    paths-ignore:
+      - 'docs/**'
+jobs:
+  tests:
+    name: Unit Tests
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+      - uses: actions/setup-go@v3
+        with:
+          go-version: '1.20'
+      - name: Setup Go Cache Paths
+        id: go-cache-paths
+        run: |
+          echo "go-build=$(go env GOCACHE)" >>$GITHUB_OUTPUT
+          echo "go-mod=$(go env GOMODCACHE)" >>$GITHUB_OUTPUT
+      - name: Go Build Cache
+        uses: actions/cache@v3
+        with:
+          path: ${{ steps.go-cache-paths.outputs.go-build }}
+          key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
+      - name: Go Mod Cache
+        uses: actions/cache@v3
+        with:
+          path: ${{ steps.go-cache-paths.outputs.go-mod }}
+          key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
+      - name: Run Unit Tests
+        id: run-tests
+        run: |
+          ./do.sh tests
-- 
GitLab