Merge pull request #40 from the-dev-tools/feat/new-feature #954
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: Check | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| check: | |
| name: Check | |
| runs-on: ubuntu-latest | |
| outputs: | |
| go-test-modules: ${{ steps.go-test-modules.outputs.value }} | |
| go-test-upload: ${{ steps.go-test-upload.outcome }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup runner environment | |
| uses: ./.github/actions/setup | |
| - name: Lint | |
| run: task lint | |
| - id: test | |
| name: Test | |
| run: task test:ci | |
| - id: go-test-modules | |
| name: Find modules with Go test results | |
| if: steps.test.outcome == 'success' || steps.test.outcome == 'failure' | |
| run: | | |
| shopt -s nullglob | |
| jq --null-input --raw-output \ | |
| '$ARGS.positional | |
| | map(capture("(?<_>.*)\/dist")._) as $mods | |
| | ["value=\($mods)", "length=\($mods | length)"] | |
| | join("\n")' \ | |
| --args */*/dist/go-test.json | tee $GITHUB_OUTPUT | |
| - id: go-test-upload | |
| name: Upload Go test results | |
| uses: actions/upload-artifact@v4 | |
| if: steps.go-test-modules.outputs.length > 0 | |
| with: | |
| name: go-test | |
| path: '*/*/dist/go-test.json' | |
| retention-days: 1 | |
| go-test-summary: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| needs: check | |
| if: needs.check.outputs.go-test-upload == 'success' | |
| strategy: | |
| matrix: | |
| value: ${{ fromJSON(needs.check.outputs.go-test-modules) }} | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: go-test | |
| - uses: robherley/go-test-action@v0 | |
| with: | |
| moduleDirectory: ${{ matrix.value }} | |
| fromJSONFile: ${{ matrix.value }}/dist/go-test.json |