From f5a02581c23e1aec8547f61710a7de8c5fd98346 Mon Sep 17 00:00:00 2001
From: hackercat <me@hackerc.at>
Date: Mon, 29 Mar 2021 16:55:51 +0200
Subject: [PATCH] Add code testing on MacOS (#563)

* feat: add code testing on macos

* change name of test job

Keep the test job named `test` to align with current branch protection checks

Co-authored-by: Casey Lee <cplee@nektos.com>
---
 .github/workflows/push.yml | 133 +++++++++++++++++++++----------------
 1 file changed, 74 insertions(+), 59 deletions(-)

diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml
index 51bf692..e4ac2f7 100644
--- a/.github/workflows/push.yml
+++ b/.github/workflows/push.yml
@@ -6,81 +6,96 @@ jobs:
     name: Lint
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v2
-    - uses: golangci/golangci-lint-action@v2
-      env:
-        CGO_ENABLED: 0
-      with:
-        version: v1.32.2
+      - uses: actions/checkout@v2
+      - uses: golangci/golangci-lint-action@v2
+        env:
+          CGO_ENABLED: 0
+        with:
+          version: v1.32.2
 
   test:
-    name: Test
+    name: Test on Linux
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v2
-    - name: Set up QEMU
-      uses: docker/setup-qemu-action@v1
-    - uses: actions/setup-go@v1
-      with:
-        go-version: 1.14
-    - run: go test -cover -coverprofile=coverage.txt -covermode=atomic ./...
-      env:
+      - uses: actions/checkout@v2
+      - name: Set up QEMU
+        uses: docker/setup-qemu-action@v1
+      - uses: actions/setup-go@v1
+        with:
+          go-version: 1.14
+      - run: go test -cover -coverprofile=coverage.txt -covermode=atomic ./...
+        env:
+          CGO_ENABLED: 0
+      - uses: codecov/codecov-action@v1
+        with:
+          files: coverage.txt
+          fail_ci_if_error: true # optional (default = false)
+
+  test-macos:
+    name: Test on MacOS
+    runs-on: macos-latest
+    continue-on-error: true # Don't let macos test fail whole workflow
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-go@v1
+        with:
+          go-version: 1.14
+      - name: Install MacOS Docker
+        uses: docker-practice/actions-setup-docker@master
+      - run: go test -v -timeout 1h -cover ./...
+        env:
           CGO_ENABLED: 0
-    - uses: codecov/codecov-action@v1
-      with:
-        files: coverage.txt
-        fail_ci_if_error: true # optional (default = false)
 
   snapshot:
     name: Snapshot
     if: ${{ github.event_name == 'pull_request' }}
     needs:
-    - lint
-    - test
+      - lint
+      - test
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v2
-    - name: GoReleaser
-      uses: goreleaser/goreleaser-action@v2
-      with:
-        version: latest
-        args: release --snapshot --rm-dist
-    - name: Capture Linux Binary
-      uses: actions/upload-artifact@v2
-      with:
-        name: act-linux
-        path: dist/act_linux_amd64/act
-    - name: Capture Windows Binary
-      uses: actions/upload-artifact@v2
-      with:
-        name: act-windows
-        path: dist/act_windows_amd64/act.exe
-    - name: Capture MacOS Binary
-      uses: actions/upload-artifact@v2
-      with:
-        name: act-macos
-        path: dist/act_darwin_amd64/act
+      - uses: actions/checkout@v2
+      - name: GoReleaser
+        uses: goreleaser/goreleaser-action@v2
+        with:
+          version: latest
+          args: release --snapshot --rm-dist
+      - name: Capture Linux Binary
+        uses: actions/upload-artifact@v2
+        with:
+          name: act-linux
+          path: dist/act_linux_amd64/act
+      - name: Capture Windows Binary
+        uses: actions/upload-artifact@v2
+        with:
+          name: act-windows
+          path: dist/act_windows_amd64/act.exe
+      - name: Capture MacOS Binary
+        uses: actions/upload-artifact@v2
+        with:
+          name: act-macos
+          path: dist/act_darwin_amd64/act
 
   release:
     name: Release
     if: startsWith(github.ref, 'refs/tags/v')
     needs:
-    - lint
-    - test
+      - lint
+      - test
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v2
-      with:
-        fetch-depth: 0
-    - name: GoReleaser
-      uses: goreleaser/goreleaser-action@v1
-      with:
-        version: latest
-        args: release --rm-dist
-      env:
-        GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
-    - name: Chocolatey
-      uses: ./.github/actions/choco
-      with:
-        version: ${{ github.ref }}
-        apiKey: ${{ secrets.CHOCO_APIKEY }}
+      - uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+      - name: GoReleaser
+        uses: goreleaser/goreleaser-action@v1
+        with:
+          version: latest
+          args: release --rm-dist
+        env:
+          GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
+      - name: Chocolatey
+        uses: ./.github/actions/choco
+        with:
+          version: ${{ github.ref }}
+          apiKey: ${{ secrets.CHOCO_APIKEY }}