Merge pull request #5036 from deluan/topic/navidrome #5588
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/checkout@v6.0.1 | |
| 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@80740b3b13bf9857e28854481ca95a84e78a2bdf # v1.284.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 }} |