Skip to content

Commit

Permalink
add mysql 8 to ci
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-rychlewski committed Oct 4, 2023
1 parent e25ea9e commit 552ccac
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
- "1.11.4-erlang-21.3.8.24-alpine-3.13.3"
mysql:
- "5.7"
- "8.0"
steps:
- uses: earthly/actions-setup@v1
- uses: actions/checkout@v3
Expand Down
5 changes: 4 additions & 1 deletion Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ integration-test-mysql:
--pull "mysql:$MYSQL"
RUN set -e; \
timeout=$(expr $(date +%s) + 30); \
docker run --name mysql --network=host -d -e MYSQL_ROOT_PASSWORD=root "mysql:$MYSQL" --sql_mode="ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,ANSI_QUOTES"; \
docker run --name mysql --network=host -d -e MYSQL_ROOT_PASSWORD=root "mysql:$MYSQL" \
--sql_mode="ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,ANSI_QUOTES" \
# the default authentication plugin for MySQL 8 is sha 256 but it doesn't come with the docker image. falling back to the 5.7 way
--default-authentication-plugin=mysql_native_password; \
# wait for mysql to start
while ! mysqladmin ping --host=127.0.0.1 --port=3306 --protocol=TCP --silent; do \
test "$(date +%s)" -le "$timeout" || (echo "timed out waiting for mysql"; exit 1); \
Expand Down
5 changes: 5 additions & 0 deletions integration_test/myxql/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ excludes = [
]

if Version.match?(version, ">= 8.0.0") do
# The default installation of MySQL 8.0 uses utf8mb4_0900_ai_ci as the collation for tables.
# However, it causes a collation error when a table's field is compared to `CAST(field AS char)`. The
# latter is given the collation utf8mb4_general_ci by MySQL and it is not clear how to fix this
# at the moment.
_ = TestRepo.query!("ALTER DATABASE ecto_test CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;", [])
ExUnit.configure(exclude: excludes)
else
ExUnit.configure(exclude: [:values_list, :rename_column | excludes])
Expand Down

0 comments on commit 552ccac

Please sign in to comment.