Skip to content

Commit

Permalink
Improve documentations
Browse files Browse the repository at this point in the history
Add description for the Default MySQL, and shutdown the Default MySQL before running test.
  • Loading branch information
mirromutth committed Oct 10, 2019
1 parent c2f734e commit 700bd56
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:

steps:
- uses: actions/checkout@v1
- name: Shutdown Ubuntu MySQL (SUDO)
run: sudo service mysql stop
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
Expand Down
46 changes: 43 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# MySQL GitHub Action
# MySQL GitHub Action [![Test status](https://github.com/mirromutth/mysql-action/workflows/test/badge.svg)](https://github.com/mirromutth/mysql-action/actions)

This [GitHub Action](https://github.com/features/actions) sets up a MySQL database.
This [GitHub Action](https://github.com/features/actions) sets up a MySQL database in Docker.

It supports various MySQL options to accurately configure and execute MySQL. So it may not be your best choice when you just want to run a simple MySQL, see [The Default MySQL](#the-default-mysql).

It is based on the Docker container and is limited by Github Actions, which contains only Linux now. Therefore it does not work in Mac OS and Windows environment.

## Usage

Expand All @@ -19,10 +23,46 @@ steps:
mysql password: ${{ secrets.DatabasePassword }} # Required if "mysql user" exists. The password for the "mysql user"
```
See [Docker Hub](https://hub.docker.com/_/mysql) for available versions.
If want bind MySQL host port to 3306, please see [The Default MySQL](#the-default-mysql).
See [Docker Hub](https://hub.docker.com/_/mysql) for available MySQL versions.
See [Creating and using secrets (encrypted variables)](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) for hiding database password.
## The Default MySQL
MySQL *may* be installed and started by Github Actions (aka. the Default MySQL), that version is 5.7 generally, root superuser password is "root" and port is 3306. See [Software in virtual environments for GitHub Actions](https://help.github.com/en/articles/software-in-virtual-environments-for-github-actions).
So before set-up a MySQL which host port is 3306 in Docker, please make sure the Default MySQL has been shutted-down. Otherwise, action will fail and print an error log that looks like: `Error starting userland proxy: listen tcp 0.0.0.0:3306: bind: address already in use.` (See [#2](https://github.com/mirromutth/mysql-action/issues/2))

Sure, if you do not care about MySQL options, such as version, bound port, character set, character collation, root password, etc., you can use the Default MySQL instead of this Action.

### Shutdown the Default MySQL

```yaml
jobs:
build:
runs-on: ubuntu-${{ ubuntu-version }} # is Ubuntu environment
# ... some other config ...
steps:
- # ... some prepare steps, like action/checkout, run some script without MySQL, etc.
- name: Shutdown Ubuntu MySQL (SUDO)
run: sudo service mysql stop # Shutdown the Default MySQL, "sudo" is necessary, please not remove it
- # ... some steps before set-up MySQL ...
- name: Set up MySQL
uses: mirromutth/[email protected]
with:
# ... Set-up MySQL configuration, see Usage
- # ... some steps after set-up MySQL ...
# ... some another config ...
```

## License

This project is released under the [MIT License](LICENSE).
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if [ -n "$INPUT_MYSQL_DATABASE" ]; then
docker_run="$docker_run -e MYSQL_DATABASE=$INPUT_MYSQL_DATABASE"
fi

docker_run="$docker_run --restart always -d -p $INPUT_HOST_PORT:$INPUT_CONTAINER_PORT mysql:$INPUT_MYSQL_VERSION --port=$INPUT_CONTAINER_PORT"
docker_run="$docker_run -d -p $INPUT_HOST_PORT:$INPUT_CONTAINER_PORT mysql:$INPUT_MYSQL_VERSION --port=$INPUT_CONTAINER_PORT"
docker_run="$docker_run --character-set-server=$INPUT_CHARACTER_SET_SERVER --collation-server=$INPUT_COLLATION_SERVER"

sh -c "$docker_run"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mysql-action",
"version": "1.1.1",
"version": "1.1.0",
"description": "MySQL Github Action",
"main": "build/app.js",
"directories": {
Expand Down

0 comments on commit 700bd56

Please sign in to comment.