Skip to content

Commit 8fca381

Browse files
authored
Merge pull request #3153 from github/mbg/ci/improve-unit-tests
Improve `pr-checks` workflow
2 parents 5235174 + 4e65cda commit 8fca381

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

.github/workflows/pr-checks.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,20 @@ jobs:
5555
run: .github/workflows/script/check-js.sh
5656

5757
- name: Verify PR checks up to date
58+
if: always()
5859
run: .github/workflows/script/verify-pr-checks.sh
5960

6061
- name: Run unit tests
62+
if: always()
6163
run: npm test
6264

6365
- name: Run pr-checks tests
66+
if: always()
6467
working-directory: pr-checks
6568
run: python -m unittest discover
6669

6770
- name: Lint
68-
if: matrix.os != 'windows-latest'
71+
if: always() && matrix.os != 'windows-latest'
6972
run: npm run lint-ci
7073

7174
- name: Upload sarif

.github/workflows/script/check-js.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ if [ ! -z "$(git status --porcelain)" ]; then
1616
# If we get a fail here then the PR needs attention
1717
>&2 echo "Failed: JavaScript files are not up to date. Run 'rm -rf lib && npm run-script build' to update"
1818
git status
19+
20+
echo "### Transpiled JS diff" >> $GITHUB_STEP_SUMMARY
21+
echo "" >> $GITHUB_STEP_SUMMARY
22+
echo '```diff' >> $GITHUB_STEP_SUMMARY
23+
git diff --output="$RUNNER_TEMP/js.diff"
24+
cat "$RUNNER_TEMP/js.diff" >> $GITHUB_STEP_SUMMARY
25+
echo '```' >> $GITHUB_STEP_SUMMARY
26+
27+
# Reset bundled files to allow other checks to test for changes
28+
git checkout lib
29+
30+
# Fail this check
1931
exit 1
2032
fi
2133
echo "Success: JavaScript files are up to date"

.github/workflows/script/verify-pr-checks.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ if [ ! -z "$(git status --porcelain)" ]; then
2020
git diff
2121
git status
2222
>&2 echo "Failed: PR checks are not up to date. Run 'cd pr-checks && python3 sync.py' to update"
23+
24+
echo "### Generated workflows diff" >> $GITHUB_STEP_SUMMARY
25+
echo "" >> $GITHUB_STEP_SUMMARY
26+
echo '```diff' >> $GITHUB_STEP_SUMMARY
27+
git diff --output="$RUNNER_TEMP/workflows.diff"
28+
cat "$RUNNER_TEMP/workflows.diff" >> $GITHUB_STEP_SUMMARY
29+
echo '```' >> $GITHUB_STEP_SUMMARY
30+
2331
exit 1
2432
fi
25-
echo "Success: PR checks are up to date"
33+
echo "Success: PR checks are up to date"

0 commit comments

Comments
 (0)