Skip to content

ci: setup playwright #466

ci: setup playwright

ci: setup playwright #466

Workflow file for this run

name: Build, Test, and Deploy
on:
pull_request:
types:
- opened
- synchronize
- reopened
push:
branches:
- master
jobs:
check-rebase:
runs-on: ubuntu-latest
steps:

Check failure on line 17 in .github/workflows/test_and_deploy.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/test_and_deploy.yml

Invalid workflow file

You have an error in your yaml syntax on line 17
- name: Checkout
uses: actions/checkout@v4
- name: Attach to PR Branch
run: |
git checkout -B ${{ github.head_ref }} origin/${{ github.head_ref }}
echo "Checked out branch: ${{ github.head_ref }}"
- name: Fetch Master Branch
run: |
git fetch --verbose origin master || (echo "Git fetch failed"; exit 1)
- name: Check Rebase Status
run: |
UPSTREAM=master # Replace with `main` if needed
CURRENT=$(git rev-parse HEAD)
MERGED=$(git merge-base HEAD origin/$UPSTREAM)
echo "UPSTREAM branch: $UPSTREAM"
echo "CURRENT commit hash: $CURRENT"
echo "MERGED commit hash: $MERGED"
if [ "$MERGED" != "$CURRENT" ]; then
echo "Branch is not rebased with $UPSTREAM."
echo "CURRENT: $CURRENT"
echo "MERGED: $MERGED"
echo "Rebase your branch onto the latest $UPSTREAM."
exit 1
else
echo "Branch is up-to-date with $UPSTREAM."
fi
build:
needs: check-rebase
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Node Version
uses: actions/setup-node@v4
with:
node-version: lts/iron
- name: Set the branch name
id: set_branch
run: |
BRANCH_NAME=${{ github.head_ref }}
echo "Branch name is: $BRANCH_NAME"
# Check for remote branch
REMOTE_BRANCH=$(git ls-remote --heads https://[email protected]/chintankavathia/ngx-datatable-snapshots.git $BRANCH_NAME)
echo "Remote branch lookup result: $REMOTE_BRANCH"
if [ -n "$REMOTE_BRANCH" ]; then
echo "Branch $BRANCH_NAME exists"
echo "branch=$BRANCH_NAME" >> $GITHUB_ENV
else
echo "Branch $BRANCH_NAME does not exist, defaulting to main"
echo "branch=main" >> $GITHUB_ENV
fi
- name: Clone Snapshot Repository
run: |
git clone https://[email protected]/chintankavathia/ngx-datatable-snapshots.git temp_snapshots
cd temp_snapshots
git checkout ${{ env.branch }}
env:
SNAPSHOT_REPO_TOKEN: ${{ secrets.SNAPSHOT_REPO_TOKEN }}
- name: Copy Snapshots to Playwright Folder
run: |
mkdir -p playwright/snapshots
cp -r temp_snapshots/snapshots/e2e playwright/snapshots/
rm -rf temp_snapshots
- name: Install
uses: bahmutov/npm-install@v1
- name: Build and package library
run: |
npm run package --if-present
env:
CI: true
- name: Format
run: |
npm run format:check --if-present
env:
CI: true
- name: Build
run: |
npm run build --if-present
env:
CI: true
- name: Test
run: |
npm run ci --if-present
env:
CI: true
- name: E2E Prepare
run: |
npm run e2e:prepare --if-present
env:
CI: true
- name: E2E
run: |
npm run vrt --if-present
env:
CI: true
- name: Build Docs
run: |
npm run build-docs --if-present
env:
CI: true
- name: Deploy Docs
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: dist/ngx-datatable
if: ${{ github.ref == 'refs/heads/master' }}