Duck 🦆 season #21510
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: GoLang Tests | |
| on: | |
| schedule: | |
| - cron: 0 */6 * * * | |
| pull_request: {} | |
| jobs: | |
| go_test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Go Action | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.22.5 | |
| - name: Install dependencies | |
| run: | | |
| go install github.com/jstemmer/go-junit-report/v2@latest | |
| go install gotest.tools/gotestsum@latest | |
| - name: Run tests with go-junit-report | |
| shell: bash | |
| run: GORUNNER=NONE go test -v 2>&1 | go-junit-report -out go-junit-report_test.xml | |
| working-directory: go/src | |
| continue-on-error: true | |
| - name: Run tests with gotestsum | |
| id: run_tests | |
| if: ${{ always() }} | |
| shell: bash | |
| env: | |
| GORUNNER: GOTESTSUM | |
| # we pass in env GORUNNER so that a unique retry file will be created | |
| run: gotestsum --rerun-fails=3 --junitfile go-gotestsum_test.xml | |
| working-directory: go/src | |
| continue-on-error: true | |
| - name: Process test results | |
| # Run this step even if the test step ahead fails | |
| if: ${{ always() }} | |
| uses: trunk-io/analytics-uploader@main | |
| env: | |
| TRUNK_PUBLIC_API_ADDRESS: ${{ vars.TRUNK_API_ENDPOINT }} | |
| with: | |
| # Path to your test results. | |
| junit-paths: "**/go-*_test.xml" | |
| # Provide your Trunk organization slug. | |
| org-slug: ${{ vars.ORG_SLUG }} | |
| # Provide your Trunk API token as a GitHub secret. | |
| token: ${{ secrets.TRUNK_TOKEN }} | |
| # Pass the test outcome for quarantining support | |
| previous-step-outcome: ${{ steps.run_tests.outcome }} | |
| - name: Upload JUnit XML artifacts | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: go-junit-results | |
| path: "**/go-*_test.xml" | |
| retention-days: 7 |