[CI/CD;DevEx]: Scope sample and source-change workflows to skip unnecessary jobs #180
Workflow file for this run
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: Go Client (Echo API) | |
| on: | |
| pull_request: | |
| # Determines whether this workflow fires at all. Keep in sync with all_samples: in the setup job below. | |
| paths: | |
| - samples/client/echo_api/go/** | |
| - .github/workflows/samples-go-client-echo-api.yaml | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.filter.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - id: filter | |
| uses: ./.github/actions/compute-matrix | |
| with: | |
| # List of sample directories to consider building (one per line). | |
| # Action inputs don't support arrays, so this is a newline-delimited string parsed in the action script. | |
| # To add a new sample: add it here AND add a matching entry to the paths: trigger above. | |
| all_samples: | | |
| samples/client/echo_api/go | |
| build: | |
| name: Test Go client | |
| needs: setup | |
| if: ${{ needs.setup.outputs.matrix != '[]' }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.setup.outputs.matrix) }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: "stable" | |
| - name: Setup node.js | |
| uses: actions/setup-node@v5 | |
| - name: Run echo server | |
| run: | | |
| git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server | |
| (cd http-echo-server && npm install && npm start &) | |
| - run: go version | |
| - name: Run test | |
| working-directory: ${{ matrix.sample }} | |
| run: go test -mod=mod -v |