Nadro/4012/ci cd update (#4062)
* chore: saving off package.json progress unit tests fail in main * fix: implementing a one liner for unit tests * fix: renaming test:unit:local * chore: adding playwright tests * fix: making package.json not destructive to keep same pipeline commands for now * fix: reordering * fix: added tags for OS tests, moved kill-port to dev depen * fix: OS skipping at tag level * fix: lint, fmt, tsc, etc... * Look at this (photo)Graph *in the voice of Nickelback* * fix: new formatting * fix: removing the ci copy, do not like it * Look at this (photo)Graph *in the voice of Nickelback* * chore: updating readme with explanation on the commands for CI CD simulation locally * fix: package.json command for unit test, removing cached breaking cache in unit tests * fix: fixing copy and typos in README.md for CI CD section * fix: adding a duplicate command for a better name. CI CD will use it in a future PR * chore: trying to clean up the copy and commands for CI CD tests * chore: porting the bash code in the YAML to a bash script then using matrix permutations to control the runtime * fix: typos * fix: another typo, missed these went porting to the bash script logic * fix: I think I need the checkout action since it has the repo code? * fix: wrote absolute path not the relative hidden path, ope * fix: does this cache give me the yarn install of playwright? * fix: yarn cannot find the binary, use the yarn command * fix: remove all uses...? * chore: adding bash script for electron runtimes * fix: copy cleanup * fix: typo when copy and pasting the exclude logic, ope * fix: this is wrong * fix: build:wasm is a requirement for yarn tsc * fix: reorder? * fix: renaming integrations to e2e * fix: windows is complaining about a pipe issue in the bash script? * fix: escaping double quotes in windows? * chore: consolidating commands into 1 file and easier YAML configuation for electron * chore: mapped multiple OS playwright browser into a single bash script * fix: removing old bash scripts, renaming matrix jobs * fix: missed deleting this when I added the if statements. * chore: removing unused job, xstate typegen more more since v5 * fix: trying to get these two tests to pass on first try * fix: auto fixes * fix: removing old unit test command --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
63
.github/ci-cd-scripts/playwright-electron.sh
vendored
Executable file
63
.github/ci-cd-scripts/playwright-electron.sh
vendored
Executable file
@ -0,0 +1,63 @@
|
||||
# bash strict mode
|
||||
set -euo pipefail
|
||||
|
||||
if [[ ! -f "test-results/.last-run.json" ]]; then
|
||||
# if no last run artifact, than run plawright normally
|
||||
echo "run playwright normally"
|
||||
if [[ "$1" == "ubuntu-latest" ]]; then
|
||||
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:playwright:electron:ubuntu || true
|
||||
elif [[ "$1" == "windows-latest" ]]; then
|
||||
yarn test:playwright:electron:windows || true
|
||||
elif [[ "$1" == "macos-14" ]]; then
|
||||
yarn test:playwright:electron:macos || true
|
||||
else
|
||||
echo "Do not run playwright. Unable to detect os runtime."
|
||||
exit 1
|
||||
fi
|
||||
# # send to axiom
|
||||
node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
retry=1
|
||||
max_retrys=2
|
||||
|
||||
# retry failed tests, doing our own retries because using inbuilt playwright retries causes connection issues
|
||||
while [[ $retry -le $max_retrys ]]; do
|
||||
if [[ -f "test-results/.last-run.json" ]]; then
|
||||
failed_tests=$(jq '.failedTests | length' test-results/.last-run.json)
|
||||
if [[ $failed_tests -gt 0 ]]; then
|
||||
echo "retried=true" >>$GITHUB_OUTPUT
|
||||
echo "run playwright with last failed tests and retry $retry"
|
||||
if [[ "$1" == "ubuntu-latest" ]]; then
|
||||
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:playwright:electron:ubuntu -- --last-failed || true
|
||||
elif [[ "$1" == "windows-latest" ]]; then
|
||||
yarn test:playwright:electron:windows -- --last-failed || true
|
||||
elif [[ "$1" == "macos-14" ]]; then
|
||||
yarn test:playwright:electron:macos -- --last-failed || true
|
||||
else
|
||||
echo "Do not run playwright. Unable to detect os runtime."
|
||||
exit 1
|
||||
fi
|
||||
# send to axiom
|
||||
node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1
|
||||
retry=$((retry + 1))
|
||||
else
|
||||
echo "retried=false" >>$GITHUB_OUTPUT
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
echo "retried=false" >>$GITHUB_OUTPUT
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
echo "retried=false" >>$GITHUB_OUTPUT
|
||||
|
||||
if [[ -f "test-results/.last-run.json" ]]; then
|
||||
failed_tests=$(jq '.failedTests | length' test-results/.last-run.json)
|
||||
if [[ $failed_tests -gt 0 ]]; then
|
||||
# if it still fails after 3 retrys, then fail the job
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
exit 0
|
Reference in New Issue
Block a user