Merge pull request #4629 from github/dependabot/github_actions/action… #4520
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: Test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| merge_group: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| test_type: | |
| - collections | |
| - topics | |
| - all | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/[email protected] | |
| with: | |
| fetch-depth: 0 | |
| - name: Get non-topic and non-collection changed files | |
| id: all | |
| if: matrix.test_type == 'all' | |
| run: echo "changed=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -ve '^topics\/' -ve '^collections\/' | xargs)" >> $GITHUB_OUTPUT | |
| - name: Get changed topic files | |
| id: topics | |
| if: matrix.test_type == 'topics' | |
| run: echo "changed=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep ^topics\/ | xargs)" >> $GITHUB_OUTPUT | |
| - name: Get changed collection files | |
| id: collections | |
| if: matrix.test_type == 'collections' | |
| run: echo "changed=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep ^collections\/ | xargs)" >> $GITHUB_OUTPUT | |
| - name: Setup Ruby | |
| if: ${{ steps.topics.outputs.changed || steps.collections.outputs.changed || steps.all.outputs.changed }} | |
| uses: ruby/setup-ruby@d781c1b4ed31764801bfae177617bb0446f5ef8d # v1.218.0 | |
| with: | |
| bundler-cache: true | |
| - name: Build and test with Rake | |
| if: | | |
| (matrix.test_type == 'topics' && steps.topics.outputs.changed) || | |
| (matrix.test_type == 'collections' && steps.collections.outputs.changed) || | |
| (matrix.test_type == 'all' && steps.all.outputs.changed) | |
| run: bundle exec rake ${{ matrix.test_type }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TOPIC_FILES: ${{ steps.topics.outputs.changed }} | |
| COLLECTION_FILES: ${{ steps.collections.outputs.changed }} | |
| TEST_ALL_FILES: ${{ steps.all.outputs.changed }} |