Skip to content

Commit 95acfbd

Browse files
authored
Merge pull request #2 from GoLinks/mysql-5.6
Update action.yaml
2 parents 5f189f9 + 6337f49 commit 95acfbd

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

.github/workflows/databases.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,23 @@ jobs:
1818
# This workflow contains a single job called "build"
1919
build:
2020
# The type of runner that the job will run on
21-
runs-on: ubuntu-latest
21+
runs-on: macos-latest
2222

2323
# Steps represent a sequence of tasks that will be executed as part of the job
2424
steps:
2525
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2626
- uses: actions/checkout@v2
27-
27+
28+
- name: Install MySQL 5.7
29+
shell: bash
30+
run: |
31+
brew install mysql
32+
brew install mysql@5.7
33+
brew unlink mysql && brew link mysql@5.7
34+
echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> /Users/runner/.bash_profile
35+
bash
36+
mysql --version
37+
mysqldump --version
2838
# Runs a single command using the runners shell
2939
- name: Check MySQL schemas
3040
uses: ./

action.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,19 @@ runs:
4444
pwd1=${{ inputs.password1 }};
4545
db1=${{ inputs.database1 }};
4646
echo "Connecting to DB1"
47-
mysqldump --defaults-extra-file=<(printf '[client]\nuser = %s\npassword = %s\nhost = %s' $user1 $pwd1 $host1) -d --column-statistics=0 --no-tablespaces --skip-add-drop-table --skip-add-drop-database --single-transaction $db1 | sed -e 's/AUTO_INCREMENT=[[:digit:]]* //' | sed -e 's/Host: .* //' | sed -e 's/-- Dump completed on .*//' > db1.sql
47+
mysqldump --defaults-extra-file=<(printf '[client]\nuser = %s\npassword = %s\nhost = %s' $user1 $pwd1 $host1) -d --skip-add-drop-table --skip-add-drop-database --single-transaction $db1 | sed -e 's/AUTO_INCREMENT=[[:digit:]]* //' | sed -e 's/Host: .* //' | sed -e 's/-- Dump completed on .*//' > db1.sql
48+
if [[ $? -ne 0 ]]; then
49+
echo >&2 "SQL error"
50+
exit 1
51+
fi
4852
echo "db1.sql created"
4953
# Use details to connect to dev and mysqldump the tables without data
5054
user2=${{ inputs.username2 }}
5155
host2=${{ inputs.hostname2 }}
5256
pwd2=${{ inputs.password2 }}
5357
db2=${{ inputs.database2 }}
5458
echo "Connecting to DB2"
55-
mysqldump --defaults-extra-file=<(printf '[client]\nuser = %s\npassword = %s\nhost = %s' $user2 $pwd2 $host2) -d --column-statistics=0 --no-tablespaces --skip-add-drop-table --skip-add-drop-database --single-transaction $db2 | sed -e 's/AUTO_INCREMENT=[[:digit:]]* //' | sed -e 's/Host: .* //' | sed -e 's/-- Dump completed on .*//' > db2.sql
56-
echo "db2.sql created"
59+
mysqldump --defaults-extra-file=<(printf '[client]\nuser = %s\npassword = %s\nhost = %s' $user2 $pwd2 $host2) -d --skip-add-drop-table --skip-add-drop-database --single-transaction $db2 | sed -e 's/AUTO_INCREMENT=[[:digit:]]* //' | sed -e 's/Host: .* //' | sed -e 's/-- Dump completed on .*//' > db2.sql
5760
if [[ $? -ne 0 ]]; then
5861
echo >&2 "SQL error"
5962
exit 1

0 commit comments

Comments
 (0)