Use MATLAB caching in GitHub Actions #29
Workflow file for this run
This file contains 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 changed applications | |
on: | |
push: | |
branches: | |
- dev | |
- main | |
pull_request: | |
branches: | |
- dev | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
targets: | |
name: Collect folders | |
runs-on: ubuntu-latest | |
outputs: | |
base_ref: ${{ github.base_ref || github.ref_name }} | |
head_ref: ${{ github.head_ref || github.ref_name }} | |
folder: ${{ steps.output.outputs.folder }} | |
include: ${{ steps.output.outputs.include }} | |
products: ${{ steps.output.outputs.products }} | |
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} | |
if: github.event_name != 'repository_dispatch' | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
fetch-depth: 0 | |
- name: Generate git diff | |
uses: GrantBirki/git-diff-action@v2 | |
id: git-diff-action | |
with: | |
json_diff_file_output: diff.json | |
file_output_only: "true" | |
- name: Install MATLAB | |
uses: matlab-actions/setup-matlab@v2 | |
with: | |
release: R2024a | |
cache: true | |
- name: Get test target folder | |
uses: matlab-actions/run-command@v2 | |
with: | |
command: getTestTargets("diff.json") | |
- name: Save output | |
id: output | |
run: | | |
echo "folder=$(cat folder.json | jq -cr)" >> $GITHUB_OUTPUT | |
echo "include=$(cat include.json | jq -cr)" >> $GITHUB_OUTPUT | |
echo "products=$(cat products.txt)" >> $GITHUB_OUTPUT | |
run_tests: | |
name: Run tests | |
needs: targets | |
uses: ./.github/workflows/run-tests-reusable.yml | |
with: | |
base_ref: ${{ needs.targets.outputs.base_ref }} | |
head_ref: ${{ needs.targets.outputs.head_ref }} | |
folder: ${{ needs.targets.outputs.folder }} | |
include: ${{ needs.targets.outputs.include }} | |
products: ${{ needs.targets.outputs.products }} | |
repository: ${{ needs.targets.outputs.repository }} | |
if: ${{ needs.targets.outputs.folder != '[]'}} |