Skip to content

Commit

Permalink
slight modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
aasimsyed committed May 18, 2024
1 parent 26a2a3a commit 6904995
Showing 1 changed file with 33 additions and 24 deletions.
57 changes: 33 additions & 24 deletions .github/workflows/pr_ci_playwright_e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@ jobs:
environment: dev

steps:
- name: cleanup old checkout
run: chmod +w -R ${GITHUB_WORKSPACE}; rm -rf ${GITHUB_WORKSPACE}/*;
- name: Cleanup old checkout
run: chmod +w -R ${GITHUB_WORKSPACE}; rm -rf ${GITHUB_WORKSPACE}/*

- name: Checkout
uses: actions/checkout@v4

- name: Ensure .env.dev file exists
run: |
if [ ! -f .env.dev ]; then
echo "Creating .env.dev file"
echo "REACT_APP_API_URL=http://localhost:3000" > .env.dev
fi
- name: Clean up any existing containers
run: |
docker stop $(docker ps -aq) || true
Expand All @@ -39,13 +46,16 @@ jobs:

- name: Clean Yarn cache
working-directory: ./frontend
run: |
sudo yarn cache clean
run: sudo yarn cache clean

- name: Install dependencies via Yarn
working-directory: ./frontend
run: sudo yarn install

- name: Verify wait-on installation
run: |
sudo yarn install
yarn --version
yarn list wait-on
- name: Cache Playwright browsers
uses: actions/cache@v3
Expand All @@ -61,6 +71,21 @@ jobs:
working-directory: ./frontend
run: sudo yarn playwright install --with-deps

- name: Ensure gh-pages branch exists
if: always()
run: |
git fetch origin gh-pages
if git rev-parse --verify origin/gh-pages; then
git checkout gh-pages
git reset --hard origin/gh-pages
else
git checkout --orphan gh-pages
git rm -rf .
echo "# GitHub Pages" > index.html
git add index.html
git -c user.name='github-actions[bot]' -c user.email='github-actions[bot]@users.noreply.github.com' commit -m "Initial commit"
git push origin gh-pages
- name: Wait for web server to be ready with retry
run: |
MAX_ATTEMPTS=3
Expand All @@ -69,7 +94,8 @@ jobs:
while [[ $ATTEMPT -le $MAX_ATTEMPTS ]]
do
echo "Attempt $ATTEMPT of $MAX_ATTEMPTS"
if yarn wait-on http://localhost:3000 --timeout ${WAIT_TIME}000; then
echo "Waiting for server for $WAIT_TIME seconds"
if yarn wait-on http://localhost:3000 --timeout ${WAIT_TIME}000 --verbose; then
echo "Server is ready!"
break
else
Expand All @@ -85,26 +111,9 @@ jobs:
fi
done
- name: Ensure gh-pages branch exists
if: always()
run: |
git fetch origin gh-pages
if git rev-parse --verify origin/gh-pages; then
git checkout gh-pages
git reset --hard origin/gh-pages
else
git checkout --orphan gh-pages
git rm -rf .
echo "# GitHub Pages" > index.html
git add index.html
git -c user.name='github-actions[bot]' -c user.email='github-actions[bot]@users.noreply.github.com' commit -m "Initial commit"
git push origin gh-pages
fi
- name: Run Playwright tests
working-directory: ./frontend
run: |
sudo yarn playwright test --reporter=html
run: sudo yarn playwright test --reporter=html

- name: Upload Playwright report
if: always()
Expand Down

0 comments on commit 6904995

Please sign in to comment.