mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
chore: moved GH action script to the yaml file (#3119)
## 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
This commit is contained in:
parent
e7606e3f7d
commit
95d300379a
28
.github/workflows/gradual-strict-null-checks.yml
vendored
28
.github/workflows/gradual-strict-null-checks.yml
vendored
@ -34,16 +34,30 @@ jobs:
|
|||||||
current/yarn.lock
|
current/yarn.lock
|
||||||
main/yarn.lock
|
main/yarn.lock
|
||||||
# intentionally use the same script from current branch against both repositories
|
# intentionally use the same script from current branch against both repositories
|
||||||
- run: |
|
- name: Compare errors if enabling strictNullChecks
|
||||||
./current/scripts/gradual-strict-null-checks.sh ./current > ./current-count &
|
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=$!
|
pid1=$!
|
||||||
./current/scripts/gradual-strict-null-checks.sh ./main > ./main-count &
|
|
||||||
|
yarn --mutex network --cwd ./main 2> .stderr-main > .out-main &
|
||||||
pid2=$!
|
pid2=$!
|
||||||
wait $pid1 && wait $pid2
|
|
||||||
MAIN=$(cat ./main-count)
|
# wait for the processes that are expected to fail
|
||||||
CURRENT=$(cat ./current-count)
|
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
|
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
|
exit 1
|
||||||
else
|
else
|
||||||
echo "The PR has $CURRENT null check errors against $MAIN in main. You're good to go!"
|
echo "The PR has $CURRENT null check errors against $MAIN in main. You're good to go!"
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
FOLDER="${1:-.}"
|
|
||||||
|
|
||||||
cd "${FOLDER}"
|
|
||||||
|
|
||||||
# update strictNullChecks
|
|
||||||
sed -i 's/\/\/\s*"strictNullChecks":\s*true,/"strictNullChecks": true,/' "./tsconfig.json"
|
|
||||||
|
|
||||||
# count errors
|
|
||||||
ERRORS=$(yarn 2> /dev/null | grep "Found [0-9]* errors" | sed 's/Found \(.*\) errors in .* files./\1/')
|
|
||||||
|
|
||||||
echo ${ERRORS:-0}
|
|
Loading…
Reference in New Issue
Block a user