Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,31 @@ on:


jobs:
test:
name: Test conversion utility
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: example
MYSQL_USER: root
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Install DB Into MySQL
run: mysql -u root -p password example < sample.sql
- name: Convert MySQL to SQLite
run: echo "todo"
- name: Verify conversion
run: echo "todo"

deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/gitflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Dockerhub Deploy

on:
push:
branches:
- feature/*


jobs:
test:
name: Test conversion utility
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_PASSWORD: password
MYSQL_USER: user
MYSQL_DATABASE: example
ports:
- 32574:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install DB Into MySQL
env:
PORT: ${{ job.services.mysql.ports['3306'] }}
run: mysql --host 127.0.0.1 --port 32574 -uuser -ppassword example < example.sql
- name: Convert MySQL to SQLite
uses: ./
with:
host: 127.0.0.1
port: 32574
username: user
password: password
database: example
output: tmp.sqlite
- name: Verify conversion
run: echo "todo"

4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
FROM python:alpine3.9

RUN pip install mysql-to-sqlite3 && mkdir -p /output && touch /output/export.sqlite3
RUN pip install mysql-to-sqlite3 && mkdir -p /output

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

VOLUME [ "/output" ]

ENTRYPOINT [ "/entrypoint.sh" ]
Expand Down
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ inputs:
username:
description: mysql username
required: true
port:
description: mysql port
required: true
password:
description: mysql password
required: true
Expand All @@ -28,11 +31,11 @@ runs:
image: Dockerfile
args:
- ${{ inputs.host }}
- ${{ inputs.port }}
- ${{ inputs.database }}
- ${{ inputs.username }}
- ${{ inputs.password }}
- ${{ inputs.output }}
post-entrypoint: gh-output.sh

branding:
icon: "filter"
Expand Down
15 changes: 9 additions & 6 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#!/bin/bash
#!/bin/sh

HOST=$1
DATABASE=$2
USERNAME=$3
PASSWORD=$4
OUTPUT=$5
PORT=$2
DATABASE=$3
USERNAME=$4
PASSWORD=$5
OUTPUT=$6

mysql2sqlite -f /output/export/ -d $DATABASE -u $USERNAME -h $HOST -p $PASSWORD -f $OUTPUT
touch /output/$OUTPUT

mysql2sqlite -f /output/$OUTPUT -d $DATABASE -u $USERNAME -h $HOST -P $PORT -p $PASSWORD
10 changes: 10 additions & 0 deletions example.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CREATE TABLE `example_data` (
`id` INT (11) AUTO_INCREMENT PRIMARY KEY,
`label` VARCHAR (25) DEFAULT NULL
);

INSERT INTO `example_data` (`label`) VALUES
('example a'),
('example b'),
('example c'),
('example d');