Skip to content

Create initalSetup.yml #6

Create initalSetup.yml

Create initalSetup.yml #6

Workflow file for this run

name: Node.js CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: ${{ secrets.DB_PASSWORD }}
MYSQL_DATABASE: ${{ secrets.DB_NAME }}
ports:
- 3306:3306
options: >
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=3
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
# Wait for the MySQL service to be ready
- name: Wait for MySQL to be ready
run: |
for i in {1..30}; do
if mysqladmin ping -h "127.0.0.1" --silent; then
break
fi
sleep 1
done
- name: Run tests
env:
DB_NAME: ${{ secrets.DB_NAME }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_HOST: 127.0.0.1
DB_PORT: 3306
run: npm test
- name: Upload Jest Test Report
if: always()
uses: actions/upload-artifact@v3
with:
name: jest-test-report
path: ./coverage/