Browse Source

feat: add cache for github action

* only 1.17 for now
sdsadfaf 3 years ago
parent
commit
a35e19404f
1 changed files with 22 additions and 13 deletions
  1. 22 13
      .github/workflows/build-test.yml

+ 22 - 13
.github/workflows/build-test.yml

@@ -7,25 +7,34 @@ on:
 # for cache
 # checkout https://github.com/magnetikonline/action-golang-cache
 # https://www.lorenzobettini.it/2020/12/caching-dependencies-in-github-actions/
+# https://github.com/mongodb/mongocli/actions/runs/1637632940/workflow
 
-name: Test
+name: GO tests
 
 jobs:
-  test:
+  tests:
     strategy:
       matrix:
         go-version: [1.17]
         os: [ubuntu-latest, macos-latest, windows-latest]
     runs-on: ${{ matrix.os }}
     steps:
-    - name: Install Go
-      uses: actions/setup-go@v2
-      with:
-        go-version: ${{ matrix.go-version }}
-    - name: Checkout code
-      uses: actions/checkout@v2
-    - name: Test
-      # only test gss for now
-      # go test ./... for all
-      # after the testdata problems resolved
-      run: go test ./internal/pkg/gss/
+      - name: Checkout repository
+        uses: actions/checkout@v2
+      - name: Install Go
+        uses: actions/setup-go@v2
+        with:
+          go-version: ${{ matrix.golang }}
+      - name: Cache Dependencies
+        uses: actions/cache@v2
+        with:
+          path: ~/go/pkg/mod # not sure if this part needs editing
+          key: ${{ runner.os }}-go-${{ matrix.golang }}-${{ hashFiles('**/go.sum') }}
+          restore-keys: |
+            ${{ runner.os }}-go-${{ matrix.golang }}-
+      - name: Test
+        # only test gss for now
+        # go test ./... for all
+        # after the testdata problems resolved
+        # TODO: add makefile for testing
+        run: go test ./internal/pkg/gss/