Skip to content

ci: add test

ci: add test #2

Workflow file for this run

name: Tests
on:
push:
pull_request:
env:
IMAGE_NAME: mysql-bkup
jobs:
test:
runs-on: ubuntu-latest
services:
mysql8:
image: mysql:8
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: testdb
MYSQL_USER: user
MYSQL_PASSWORD: password
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h 127.0.0.1 -uuser -ppassword"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Build the Docker image
- name: Build Docker Image
run: |

Check failure on line 35 in .github/workflows/tests.yaml

View workflow run for this annotation

GitHub Actions / Tests

Invalid workflow file

The workflow is not valid. .github/workflows/tests.yaml (Line: 35, Col: 14): Unrecognized named-value: 'IMAGE_NAME'. Located at position 1 within expression: IMAGE_NAME .github/workflows/tests.yaml (Line: 41, Col: 14): Unrecognized named-value: 'IMAGE_NAME'. Located at position 1 within expression: IMAGE_NAME
docker buildx build -t ${{IMAGE_NAME}} .
- name: Create docker network
run: |
docker network create web
- name: Test restore
run: |
docker run -d --name ${{IMAGE_NAME}} \
-v migrations/:/backup/ \
--network web \
-e DB_HOST=mysql \
-e DB_USERNAME=user \
-e DB_PASSWORD=password \
-e DB_NAME=testdb \
${{IMAGE_NAME}} restore -f init.sql
echo "Database restore completed"
- name: Test backup
run: |
docker run -d --name ${{IMAGE_NAME}} \
-v migrations/:/backup/ \
--network web \
-e DB_HOST=mysql \
-e DB_USERNAME=user \
-e DB_PASSWORD=password \
-e DB_NAME=testdb \
${{IMAGE_NAME}} backup
echo "Database backup completed"