Skip to content

Test

Test #3731

Workflow file for this run

name: Test
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
merge_group:
jobs:
test:
strategy:
fail-fast: false
matrix:
test_type:
- collections
- topics
- all
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
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@v1
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 }}