44on :
55 workflow_call :
66 workflow_dispatch :
7+
8+
9+ permissions :
10+ contents : read
11+
712jobs :
813 test :
914 name : Unit testing
@@ -19,11 +24,18 @@ jobs:
1924 go-version-file : ' go.mod'
2025 - name : Set up helm (test dependency)
2126 uses : azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4.3.1
22- # Install gotestfmt on the VM running the action.
27+ # Install gotestfmt and go-junit-report on the VM running the action.
2328 - name : Set up gotestfmt
2429 uses : GoTestTools/gotestfmt-action@8b4478c7019be847373babde9300210e7de34bfb # v2.2.0
2530 with :
2631 token : ${{ secrets.GITHUB_TOKEN }}
32+ - name : Install go-junit-report
33+ run : |
34+ ARCH=$(echo "${{ runner.arch }}" | tr '[:upper:]' '[:lower:]' | sed 's/x64/amd64/')
35+ OS=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]' | sed 's/macos/darwin/')
36+ gh release download -R gotestyourself/gotestsum -p "gotestsum_1.13.0_${OS}_${ARCH}.tar.gz" -O - | tar -xzf - gotestsum
37+ env :
38+ GITHUB_TOKEN : ${{ github.token }}
2739 # copy config file into place
2840 - name : Copy config file
2941 run : cp config/server-config.yaml.example ./server-config.yaml
@@ -40,10 +52,22 @@ jobs:
4052 env :
4153 MINDER_TEST_REGISTRY : " localhost:5000"
4254 run : make test-cover-silent
43- - name : Try converting to LCOV
55+ - name : Generate JUnit report
56+ run : |
57+ gotestsum --junitfile test-results.xml --junitfile-hide-empty-pkg --raw-command -- cat test-results.json
58+ - name : Upload test results
59+ uses : actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
60+ with :
61+ name : test-results
62+ path : test-results.*
63+ - name : Convert go coverage to LCOV
4464 run : go run github.com/jandelgado/gcov2lcov@latest -infile=./coverage.out -outfile=./coverage.lcov
4565 - name : Coveralls GitHub Action
4666 uses : coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
67+ - name : Add top-level report from JUnit XML
68+ if : ${{ !cancelled() }}
69+ run : |
70+ go run github.com/kitproj/[email protected] < test-results.xml > "$GITHUB_STEP_SUMMARY" 4771 authz :
4872 name : Authz tests
4973 runs-on : ubuntu-latest
0 commit comments