diff --git a/.github/actions/install_db/actions.yml b/.github/actions/install_db/actions.yml new file mode 100644 index 0000000..a3fdb7e --- /dev/null +++ b/.github/actions/install_db/actions.yml @@ -0,0 +1,30 @@ +runs: + using: "composite" + steps: + - name: Setup MySQL Tuner repository + uses: actions/checkout@v3 + + - name: Set up MySQL + uses: mirromutth/mysql-action@v1.1 + with: + mysql root password: "root" + mysql version: "${{ inputs.MYSQL_VERSION }}" + + - name: Injecting credentials + run: | + echo -e "[client]\nuser=root\npassword=root\nhost=127.0.0.1\nprotocol=TCP" > $HOME/.my.cnf + + - name: Cloning test_db dataset + run: | + git clone https://github.com/datacharmer/test_db.git + + - name: Injecting test_db dataset + run: | + sleep 5s + cd test_db + netstat -ltpn + mysql -e 'select version();' + mysql -e 'CREATE DATABASE data;' + mysql data< ./employees.sql + cd - + rm -rf test_db \ No newline at end of file diff --git a/.github/actions/pull_and_mysql/actions.yml b/.github/actions/pull_and_mysql/actions.yml new file mode 100644 index 0000000..a3171ea --- /dev/null +++ b/.github/actions/pull_and_mysql/actions.yml @@ -0,0 +1,11 @@ +runs: + using: "composite" + steps: + - name: Setup MySQL Tuner repository + uses: actions/checkout@v3 + + - name: Set up MySQL + uses: mirromutth/mysql-action@v1.1 + with: + mysql root password: "root" + mysql version: "${{ inputs.MYSQL_VERSION }}" \ No newline at end of file diff --git a/.github/workflows/generate_examples.yml b/.github/workflows/generate_examples.yml index 96f4eee..68901d3 100644 --- a/.github/workflows/generate_examples.yml +++ b/.github/workflows/generate_examples.yml @@ -16,33 +16,10 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Setup MySQL Tuner repository - uses: actions/checkout@v3 - - - name: Set up MySQL - uses: mirromutth/mysql-action@v1.1 + - uses: .github/actions/install_db with: - mysql root password: "root" - mysql version: "8.0" - - name: Injecting credentials - run: | - echo -e "[client]\nuser=root\npassword=root\nhost=127.0.0.1\nprotocol=TCP" > $HOME/.my.cnf - - - name: Cloning test_db dataset - run: | - git clone https://github.com/datacharmer/test_db.git + MYSQL_VERSION: "8.0" - - name: Injecting test_db dataset - run: | - sleep 5s - cd test_db - netstat -ltpn - mysql -e 'select version();' - mysql -e 'CREATE DATABASE data;' - mysql data< ./employees.sql - cd - - rm -rf test_db # Runs a single command using the runners shell - name: Run verbose mode with dumpdir result run: | @@ -50,10 +27,12 @@ jobs: sudo perl ./mysqltuner.pl --user=root --pass=root --protocol tcp --verbose --dumpdir=./examples/github/result --json | tee -a ./examples/github/result/result.json # Runs a single command using the runners shell - - name: Commit example result to repo - run: | - git config --global user.name "Jean-Marie Renouard" - git config --global user.email "jmrenouard@gmail.com" - git add . - git commit -m "Commit example result for employees database for Actions" - git push \ No newline at end of file + - name: Run the Action + uses: devops-infra/action-commit-push@master + with: + github_token: "${{ secrets.GITHUB_TOKEN }}" + add_timestamp: true + commit_prefix: "[AUTO]" + commit_message: "Updates result examples (via Actions)" + force: false + target_branch: update/version \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 5519c37..cd0759c 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -23,14 +23,9 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Setup MySQL Tuner repository - uses: actions/checkout@v3 - - - name: Set up MySQL - uses: mirromutth/mysql-action@v1.1 + - uses: .github/actions/pull_and_mysql with: - mysql root password: "root" - mysql version: "8.0" + MYSQL_VERSION: "8.0" - name: Run help mode run: | diff --git a/.github/workflows/run_mt_with_db.yml b/.github/workflows/run_mt_with_db.yml index f6a556f..4ba87cd 100644 --- a/.github/workflows/run_mt_with_db.yml +++ b/.github/workflows/run_mt_with_db.yml @@ -16,33 +16,10 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Setup MySQL Tuner repository - uses: actions/checkout@v3 - - - name: Set up MySQL - uses: mirromutth/mysql-action@v1.1 + - uses: .github/actions/install_db with: - mysql root password: "root" - mysql version: "8.0" - - name: Injecting credentials - run: | - echo -e "[client]\nuser=root\npassword=root\nhost=127.0.0.1\nprotocol=TCP" > $HOME/.my.cnf - - - name: Cloning test_db dataset - run: | - git clone https://github.com/datacharmer/test_db.git + MYSQL_VERSION: "8.0" - - name: Injecting test_db dataset - run: | - sleep 5s - cd test_db - netstat -ltpn - mysql -e 'select version();' - mysql -e 'CREATE DATABASE data;' - mysql data< ./employees.sql - cd - - rm -rf test_db # Runs a single command using the runners shell - name: Run help mode run: perl ./mysqltuner.pl --help diff --git a/.github/workflows/update_cve_and_docs.yml b/.github/workflows/update_cve_and_docs.yml index 34cf8c0..3a46543 100644 --- a/.github/workflows/update_cve_and_docs.yml +++ b/.github/workflows/update_cve_and_docs.yml @@ -20,7 +20,6 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Setup MySQL Tuner repository uses: actions/checkout@v3