Skip to content

Commit

Permalink
chore: moved GH action script to the yaml file (#3119)
Browse files Browse the repository at this point in the history
## About the changes
- Actions are not counting successfully:
https://github.com/Unleash/unleash/actions/runs/4181713524/jobs/7243938807#step:5:17
- This should fix an issue with running yarn concurrently (which might
be leading to the zero counts)
- Move the code to a GH action so it's easier to debug 
- Added a diff of the reported errors to help the PR author identify the
potential cause
  • Loading branch information
Gastón Fournier committed Feb 16, 2023
1 parent e7606e3 commit 95d3003
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
28 changes: 21 additions & 7 deletions .github/workflows/gradual-strict-null-checks.yml
Expand Up @@ -34,16 +34,30 @@ jobs:
current/yarn.lock
main/yarn.lock
# intentionally use the same script from current branch against both repositories
- run: |
./current/scripts/gradual-strict-null-checks.sh ./current > ./current-count &
- name: Compare errors if enabling strictNullChecks
run: |
set -x
sed -i 's/\/\/\s*"strictNullChecks":\s*true,/"strictNullChecks": true,/' "current/tsconfig.json"
sed -i 's/\/\/\s*"strictNullChecks":\s*true,/"strictNullChecks": true,/' "main/tsconfig.json"
yarn --mutex network --cwd ./current 2> .stderr-current > .out-current &
pid1=$!
./current/scripts/gradual-strict-null-checks.sh ./main > ./main-count &
yarn --mutex network --cwd ./main 2> .stderr-main > .out-main &
pid2=$!
wait $pid1 && wait $pid2
MAIN=$(cat ./main-count)
CURRENT=$(cat ./current-count)
# wait for the processes that are expected to fail
set +e
wait $pid1
wait $pid2
set -e
CURRENT=$(grep "Found [0-9]* errors" .out-current | sed 's/Found \(.*\) errors in .* files./\1/')
MAIN=$(grep "Found [0-9]* errors" .out-main | sed 's/Found \(.*\) errors in .* files./\1/')
if [ $CURRENT -gt $MAIN ]; then
echo "The PR is increasing the number of null check errors from ${MAIN} to ${CURRENT}. Check if your branch is up-to-date and consider fixing them before merging"
diff .out-current .out-main
echo "The PR is increasing the number of null check errors from ${MAIN} to ${CURRENT}. Check if your branch is up-to-date and consider fixing them before merging. The diff above should give you some details"
exit 1
else
echo "The PR has $CURRENT null check errors against $MAIN in main. You're good to go!"
Expand Down
13 changes: 0 additions & 13 deletions scripts/gradual-strict-null-checks.sh

This file was deleted.

0 comments on commit 95d3003

Please sign in to comment.