Skip to content

[No QA] Make schema validations async#9814

Merged
aldo-expensify merged 2 commits into
mainfrom
Rory-AsyncWorkflowValidation
Jul 12, 2022
Merged

[No QA] Make schema validations async#9814
aldo-expensify merged 2 commits into
mainfrom
Rory-AsyncWorkflowValidation

Conversation

@roryabraham

Copy link
Copy Markdown
Contributor

Details

This is just a minor way to speed up PR checks.

Fixed Issues

$ n/a

Tests

  1. Run npm i
  2. Run npm run gh-actions-validate. Verify that the script runs successfully.
  3. Remove a required key from an action metadata file.
  4. Run npm run gh-actions-validate. Verify that the script catches the error, reports it successfully, and exits with a non-zero status code.
  5. Restore the action metadata file.
  6. Remove a required key from a workflow file.
  7. Run npm tun gh-actions-validate. Verify that the script catches the error, reports it successfully, and exists with a non-zero status code.

@roryabraham roryabraham self-assigned this Jul 9, 2022
@roryabraham roryabraham requested a review from a team as a code owner July 9, 2022 08:31
@melvin-bot melvin-bot Bot requested review from aldo-expensify and removed request for a team July 9, 2022 08:31

@aldo-expensify aldo-expensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool update, it runs much faster, but I think there is something to correct.

The exit code is wrong sometimes... if you only remove the "on" and "name" of cla.yml, you can see it detects the invalid file, but the exit code is 0. If you do this same change in main, the exit code is 1.

image

If I mess up even more the file, like removing the jobs key without removing the descendants, then I get an exit code 1

image

Screen Shot 2022-07-11 at 10 37 56 AM

@roryabraham

Copy link
Copy Markdown
Contributor Author

Thanks for testing

@roryabraham

roryabraham commented Jul 12, 2022

Copy link
Copy Markdown
Contributor Author

This is updated now, seems to work as expected

Comment on lines 49 to 55
for PID in ${ASYNC_PROCESSES[*]}; do
if ! wait $PID; then
EXIT_CODE=$?
wait $PID
RESULT=$?
if [[ $RESULT != 0 ]]; then
EXIT_CODE=$RESULT
fi
done

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is what fixed the bug, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. When you have an if statement that in-and-of-itself is a command and so it changes the value of $?.

@aldo-expensify aldo-expensify merged commit 6bed8a3 into main Jul 12, 2022
@aldo-expensify aldo-expensify deleted the Rory-AsyncWorkflowValidation branch July 12, 2022 18:35
@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@roryabraham

Copy link
Copy Markdown
Contributor Author

This is working well

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by @aldo-expensify in version: 1.1.83-1 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by @chiragsalian in version: 1.1.84-13 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants