Skip to content

Commit

Permalink
fix: Continuous integration improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Axeloooo committed Nov 19, 2023
1 parent 9c928c7 commit 2472e59
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,39 @@ on:
- dev

jobs:

testing:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: techstart-fashion
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h localhost -uroot -proot"
--health-interval=10s
--health-timeout=5s
--health-retries=5
env:
DATABASE_URL: mysql://root:root@localhost:3306/techstart-fashion

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install dependencies
run: cd backend && npm install

- name: Start volume
run: docker volume create db

- name: Start database
run: |
docker run -d \
--name db \
-e MYSQL_ROOT_PASSWORD=root \
-e MYSQL_DATABASE=techstart-fashion \
-p 3306:3306 \
-v db:/var/lib/mysql \
--restart always \
mysql
- name: Wait for database
run: docker exec db mysqladmin --silent --wait=30 -uroot -proot ping || exit 1
run: |
until nc -z localhost 3306; do
echo "Waiting for MySQL to be ready..."
sleep 2
done
echo "MySQL is ready."
- name: Test
run: cd backend && npm run test

0 comments on commit 2472e59

Please sign in to comment.