|
| 1 | +name: Test changed applications |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - dev |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - dev |
| 10 | + - main |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 13 | + cancel-in-progress: true |
| 14 | +jobs: |
| 15 | + targets: |
| 16 | + name: Collect folders |
| 17 | + runs-on: ubuntu-latest |
| 18 | + outputs: |
| 19 | + base_ref: ${{ github.base_ref || github.ref_name }} |
| 20 | + head_ref: ${{ github.head_ref || github.ref_name }} |
| 21 | + folder: ${{ steps.output.outputs.folder }} |
| 22 | + include: ${{ steps.output.outputs.include }} |
| 23 | + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} |
| 24 | + if: github.event_name != 'repository_dispatch' |
| 25 | + steps: |
| 26 | + - name: Check out repository |
| 27 | + uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + lfs: true |
| 30 | + fetch-depth: 0 |
| 31 | + - name: Generate git diff |
| 32 | + uses: GrantBirki/git-diff-action@v2 |
| 33 | + id: git-diff-action |
| 34 | + with: |
| 35 | + json_diff_file_output: diff.json |
| 36 | + file_output_only: "true" |
| 37 | + - name: Install MATLAB |
| 38 | + uses: matlab-actions/setup-matlab@v2 |
| 39 | + with: |
| 40 | + release: R2024a |
| 41 | + - name: Get test target folder |
| 42 | + uses: matlab-actions/run-command@v2 |
| 43 | + with: |
| 44 | + command: getTestTargets("diff.json") |
| 45 | + - name: Save output |
| 46 | + id: output |
| 47 | + run: | |
| 48 | + echo "folder=$(cat folder.json | jq -cr)" >> $GITHUB_OUTPUT |
| 49 | + echo "include=$(cat include.json | jq -cr)" >> $GITHUB_OUTPUT |
| 50 | + run_tests: |
| 51 | + name: Run tests |
| 52 | + needs: targets |
| 53 | + uses: ./.github/workflows/run-tests-reusable.yml |
| 54 | + with: |
| 55 | + base_ref: ${{ needs.targets.outputs.base_ref }} |
| 56 | + head_ref: ${{ needs.targets.outputs.head_ref }} |
| 57 | + folder: ${{ needs.targets.outputs.folder }} |
| 58 | + include: ${{ needs.targets.outputs.include }} |
| 59 | + repository: ${{ needs.targets.outputs.repository }} |
| 60 | + if: ${{ needs.targets.outputs.folder != '[]'}} |
0 commit comments