-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds test workflows with automatic folder discovery
- Loading branch information
Showing
36 changed files
with
453 additions
and
290 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: Run MATLAB tests | ||
on: | ||
# Trigger the workflow on push or pull requests and on pushes to WEC-Sim | ||
push: | ||
branches: | ||
- dev | ||
- main | ||
pull_request: | ||
branches: | ||
- dev | ||
- main | ||
repository_dispatch: | ||
types: | ||
- wecsim-dev | ||
- wecsim-main | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
jobs: | ||
dispatch_event: | ||
name: Process dispatch event | ||
runs-on: ubuntu-latest | ||
outputs: | ||
base_ref: ${{ github.event.client_payload.branch }} | ||
folder: ${{ steps.output.outputs.folder }} | ||
head_ref: ${{ github.event.client_payload.branch }} | ||
include: ${{ steps.output.outputs.include }} | ||
repository: ${{ github.repository }} | ||
if: github.event_name == 'repository_dispatch' | ||
steps: | ||
- run: echo "Triggered by WEC-Sim commit ${{ github.event.client_payload.sha }}" | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
with: | ||
lfs: true | ||
ref: ${{ github.event.client_payload.branch }} | ||
- name: Install MATLAB | ||
uses: matlab-actions/setup-matlab@v2 | ||
with: | ||
release: R2024a | ||
- name: Get test target folder | ||
uses: matlab-actions/run-command@v2 | ||
with: | ||
command: getTestTargets | ||
- name: Save output | ||
id: output | ||
run: | | ||
echo "folder=$(cat folder.json | jq -cr)" >> $GITHUB_OUTPUT | ||
echo "include=$(cat include.json | jq -cr)" >> $GITHUB_OUTPUT | ||
other_event: | ||
name: Process other events | ||
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 }} | ||
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 | ||
- 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 | ||
run_dispatch_event_tests: | ||
needs: dispatch_event | ||
uses: ./.github/workflows/run-tests-reusable.yml | ||
with: | ||
base_ref: ${{ needs.dispatch_event.outputs.base_ref }} | ||
folder: ${{ needs.dispatch_event.outputs.folder }} | ||
head_ref: ${{ needs.dispatch_event.outputs.head_ref }} | ||
include: ${{ needs.dispatch_event.outputs.include }} | ||
repository: ${{ needs.dispatch_event.outputs.repository }} | ||
run_other_event_tests: | ||
needs: other_event | ||
uses: ./.github/workflows/run-tests-reusable.yml | ||
with: | ||
base_ref: ${{ needs.other_event.outputs.base_ref }} | ||
head_ref: ${{ needs.other_event.outputs.head_ref }} | ||
folder: ${{ needs.other_event.outputs.folder }} | ||
include: ${{ needs.other_event.outputs.include }} | ||
repository: ${{ needs.other_event.outputs.repository }} | ||
if: ${{ needs.other_event.outputs.folder != '[]'}} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.