Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7782c4c

Browse files
Update Test and Build workflow (#648)
- Prevent unintended labels from triggering test workflow - Prevent pull request from triggering build workflows since test workflow would build EDM4U. - Prevent test workflow from emitting error message just because `grep` command did not get any failed tests.
1 parent 2e7948c commit 7782c4c

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

‎.github/workflows/build.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ on:
1919
schedule:
2020
- cron: "0 10 * * *" # 10am UTC = 2am PST
2121

22-
pull_request:
23-
types: [ labeled, closed ]
24-
2522
workflow_dispatch:
2623
inputs:
2724
unity_version:

‎.github/workflows/test.yaml

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,36 @@ jobs:
6666
echo "include_test_modules=" >> $GITHUB_OUTPUT
6767
echo "exclude_test_modules=" >> $GITHUB_OUTPUT
6868
echo "exclude_tests=" >> $GITHUB_OUTPUT
69+
70+
# This is currently checking for invalid trigger only.
71+
if [[ "${{ github.event_name }}" == "schedule" ]]; then
72+
# Do nothing for now
73+
:
74+
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
75+
if [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" == "tests-requested" ]]; then
76+
# Do nothing for now
77+
:
78+
elif [[ "${{ github.event.action }}" == "closed" && "${{ github.event.pull_request.merged == true}}" == "true" ]]; then
79+
# Do nothing for now
80+
:
81+
else
82+
echo "invalid_trigger=1" >> $GITHUB_OUTPUT
83+
fi
84+
else
85+
echo "invalid_trigger=1" >> $GITHUB_OUTPUT
86+
fi
6987
fi
7088
89+
- name: Cancel workflow
90+
if: ${{ steps.set_outputs.outputs.invalid_trigger }}
91+
uses: andymckay/cancel-action@0.2
92+
93+
- name: Wait for workflow cancellation
94+
if: ${{ steps.set_outputs.outputs.invalid_trigger }}
95+
run: |
96+
sleep 300
97+
exit 1 # fail out if the cancellation above somehow failed.
98+
7199
- name: Print output
72100
run: |
73101
echo outputs.unity_version : ${{ steps.set_outputs.outputs.unity_version }}
@@ -119,14 +147,15 @@ jobs:
119147
continue-on-error: true
120148
run: cat test_output/test*IntegrationTestsBatchMode/*.log
121149

122-
- name: Obtain Failed tests
150+
- name: Obtain Failed tests from Integration tests and NUnit tests
123151
if: always()
124152
shell: bash
125153
continue-on-error: true
126154
run: |
127-
cat test_output/test*/*_test.log | grep "^Test .* PASSED$"
128-
cat test_output/test*/*_test.log | grep "^Test .* FAILED$"
129-
cat test_output/test*/*_test.log | grep "^Test .* SKIPPED$"
155+
# Quick and dirty way to get all failed tests in granular level.
156+
# TODO: better parser for more information, ex. error message.
157+
{ cat test_output/test*/*_test.log || true; } | { grep "^Test .* FAILED$" || true; }
158+
{ cat test_output/test*/test*/results.xml || true; } | { grep '^ *<test-case.*result="Failed"' || true; } | sed 's/^.* name="\([^\"]*\)".*$/Test 1円: FAILED/'
130159
131160
- name: Return Unity license
132161
if: always()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /