Skip to content

Update Test and Build workflow #648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ on:
schedule:
- cron: "0 10 * * *" # 10am UTC = 2am PST

pull_request:
types: [ labeled, closed ]

workflow_dispatch:
inputs:
unity_version:
Expand Down
37 changes: 33 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,36 @@ jobs:
echo "include_test_modules=" >> $GITHUB_OUTPUT
echo "exclude_test_modules=" >> $GITHUB_OUTPUT
echo "exclude_tests=" >> $GITHUB_OUTPUT

# This is currently checking for invalid trigger only.
if [[ "${{ github.event_name }}" == "schedule" ]]; then
# Do nothing for now
:
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
if [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" == "tests-requested" ]]; then
# Do nothing for now
:
elif [[ "${{ github.event.action }}" == "closed" && "${{ github.event.pull_request.merged == true}}" == "true" ]]; then
# Do nothing for now
:
else
echo "invalid_trigger=1" >> $GITHUB_OUTPUT
fi
else
echo "invalid_trigger=1" >> $GITHUB_OUTPUT
fi
fi

- name: Cancel workflow
if: ${{ steps.set_outputs.outputs.invalid_trigger }}
uses: andymckay/cancel-action@0.2

- name: Wait for workflow cancellation
if: ${{ steps.set_outputs.outputs.invalid_trigger }}
run: |
sleep 300
exit 1 # fail out if the cancellation above somehow failed.

- name: Print output
run: |
echo outputs.unity_version : ${{ steps.set_outputs.outputs.unity_version }}
Expand Down Expand Up @@ -119,14 +147,15 @@ jobs:
continue-on-error: true
run: cat test_output/test*IntegrationTestsBatchMode/*.log

- name: Obtain Failed tests
- name: Obtain Failed tests from Integration tests and NUnit tests
if: always()
shell: bash
continue-on-error: true
run: |
cat test_output/test*/*_test.log | grep "^Test .* PASSED$"
cat test_output/test*/*_test.log | grep "^Test .* FAILED$"
cat test_output/test*/*_test.log | grep "^Test .* SKIPPED$"
# Quick and dirty way to get all failed tests in granular level.
# TODO: better parser for more information, ex. error message.
{ cat test_output/test*/*_test.log || true; } | { grep "^Test .* FAILED$" || true; }
{ cat test_output/test*/test*/results.xml || true; } | { grep '^ *<test-case.*result="Failed"' || true; } | sed 's/^.* name="\([^\"]*\)".*$/Test \1: FAILED/'

- name: Return Unity license
if: always()
Expand Down