Skip to content

finish pipeline

finish pipeline #8

name: Functional Test
on:
pull_request:
branches: [ main ]
push:
branches: [ provider-model ]
jobs:
setup-mysql:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: '1.21'
- name: Start MySQL
run: sudo /etc/init.d/mysql start
- name: Create Database
run: mysql -e 'CREATE DATABASE test_db;' -uroot -proot
- name: Set up MySQL
run: |
sudo /etc/init.d/mysql start
mysql -e 'CREATE DATABASE test_db;' -uroot -proot
- name: Import database
run: mysql -uroot -proot test_db < .github/workflows/functional-test.sql
- name: Verify database import
run: mysql -uroot -proot -e 'USE test_db; SHOW TABLES;'
- name: Build MTK
run: make build
- name: Dump database
run: bin/mtk-linux-amd64 dump test_db --port=3306 --user=root --password=root --host=127.0.0.1 > mtk-dump.sql
- name: Drop Database
run: mysql -e 'DROP DATABASE test_db;' -uroot -proot
- name: Clean database file
run: |
sed '$d' mtk-dump.sql > mtk-dump-clean.sql
- name: Import database
run: mysql -uroot -proot test_db < mtk-dump-clean.sql
- name: Generate diff
run: diff -q .github/workflows/functional-test.sql mtk-dump-clean.sql