From 5f619e4c23e4bb96b972da0456a1d0e940fee46b Mon Sep 17 00:00:00 2001 From: Alexander Meindl Date: Thu, 18 Mar 2021 08:44:37 +0100 Subject: [PATCH] Try to fix mysql for github actions --- .github/workflows/tests.yml | 16 ++++++++-------- test/support/database-mysql.yml | 22 ++-------------------- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dcb8db85..a24e8a5e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,13 +33,12 @@ jobs: --health-retries 5 mysql: - image: mysql:5.7 + image: mysql:8.0 env: - MYSQL_USER: root - MYSQL_PASSWORD: '' - MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_ROOT_PASSWORD: 'BestPasswordEver' ports: - - 3306:3306 + # will assign a random free host port + - 3306/tcp options: >- --health-cmd="mysqladmin ping" --health-interval=10s @@ -49,7 +48,7 @@ jobs: steps: - name: Verify MySQL connection from host run: | - mysql --host 127.0.0.1 --port 3306 -uroot -e "SHOW DATABASES" + mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports[3306] }} -uroot -pBestPasswordEver -e "SHOW DATABASES" if: matrix.db == 'mysql' - name: Checkout Redmine @@ -99,6 +98,7 @@ jobs: - name: Run Redmine rake tasks env: RAILS_ENV: test + MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} working-directory: redmine run: | bundle exec rake generate_secret_token @@ -108,14 +108,14 @@ jobs: - name: Run tests env: RAILS_ENV: test - REDMINE_VERSION: ${{ matrix.redmine }} + MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} working-directory: redmine run: bundle exec rake redmine:plugins:test NAME=additionals RUBYOPT="-W0" - name: Run uninstall test env: RAILS_ENV: test - REDMINE_VERSION: ${{ matrix.redmine }} + MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} working-directory: redmine run: bundle exec rake redmine:plugins:migrate NAME=additionals VERSION=0 diff --git a/test/support/database-mysql.yml b/test/support/database-mysql.yml index 160f66ca..58a0264b 100644 --- a/test/support/database-mysql.yml +++ b/test/support/database-mysql.yml @@ -1,26 +1,8 @@ -production: - adapter: mysql2 - database: redmine - host: 127.0.0.1 - port: 3306 - username: root - password: - encoding: utf8mb4 - -development: - adapter: mysql2 - database: redmine - port: 3306 - host: 127.0.0.1 - username: root - password: - encoding: utf8mb4 - test: adapter: mysql2 database: redmine - port: 3306 + port: <%= ENV["MYSQL_PORT"] %> host: 127.0.0.1 username: root - password: + password: BestPasswordEver encoding: utf8mb4