Skip to content

Commit 9e58371

Browse files
Dev-Feature: Improve Unit test output and address go-lang dependency cache misses on build (#1750)
* fixed non release cache misses * Added in better test formatting and install of open tofu to stop test errors. * oopsy on copy paste from local repo
1 parent 55068d3 commit 9e58371

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

.github/workflows/cli_test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ jobs:
3434
run: |
3535
go build -v ./cmd/digger
3636
working-directory: cli
37-
37+
3838
- name: Test
39-
run: go test -v ./...
39+
shell: bash
40+
run: |
41+
go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
42+
go test -json ./... | gotestfmt
4043
working-directory: cli

.github/workflows/libs_test.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,17 @@ jobs:
4747
echo "is_external=true" >> $GITHUB_OUTPUT
4848
fi
4949
50+
- uses: opentofu/setup-opentofu@v1
51+
with:
52+
tofu_version: 1.6.0
53+
5054
- name: Test
5155
run: |
56+
go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
5257
if [ "${{ steps.pr_check.outputs.is_external }}" = "true" ]; then
53-
go test -v -tags=external ./...
58+
go test -json -tags=external ./... | gotestfmt
5459
else
55-
go test -v ./...
60+
go test -json ./... | gotestfmt
5661
fi
5762
env:
5863
DIGGER_LICENSE_KEY: ${{ secrets.TEST_DIGGER_LICENSE_KEY}}

action.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,12 @@ runs:
426426
427427
- uses: actions/cache/save@v4
428428
name: cache-save
429-
if: ${{ inputs.cache-dependencies == 'true' }}
429+
if: ${{ always() && inputs.cache-dependencies == 'true' && steps.restore_cache.outputs.cache-hit != 'true' }}
430430
with:
431-
path: ${{ github.workspace }}/cache
432-
key: digger-cache-${{ hashFiles('**/cache') }}
431+
path: |
432+
${{ steps.golang-env.outputs.build-cache-path }}
433+
${{ steps.golang-env.outputs.module-cache-path }}
434+
key: digger-cli-cache-${{ hashFiles('.digger.go.sum') }}
433435

434436
branding:
435437
icon: globe

0 commit comments

Comments
 (0)