Test on push to main by akarsh #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test-on-push | |
run-name: Test on push to ${{ github.ref_name }} by ${{ github.actor }} | |
on: push | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
selenium: | |
image: selenium/standalone-chrome:latest | |
ports: | |
- 4444:4444 | |
strategy: | |
matrix: | |
node-version: [20.x, 21.x, 22.x] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Cache Node.js modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
run: npm install | |
- name: Wait for Selenium | |
run: | | |
while ! nc -z localhost 4444; do | |
echo "Waiting for Selenium to be ready..." | |
sleep 1 | |
done | |
echo "Selenium is ready!" | |
- name: Run tests | |
run: npm run test |