Workflow Container wrong mysql version even though image is 8

I’m trying, really really hard, to make my first CI workflow.

It’s for Laravel with php7.4 & mysql 8 (I need LOAD DATA LOCAL INFILE, that’s why I’m trying to use an image that has it enabled).

The workflow so far, has two issues:

The main issue is, the test that needs load data enabled, always fails (no mysql error, but just the test expectation Failed asserting that null is not null.
In my local environment all tests are passing though… It almost seems as if the code that triggers the csv import, just doesn’t run, so nothing is created and my test gets null back, where it shouldn’t.

Now I have created a mysql docker image, from the container I am using in my local environment, pushed it to Docker Hub and then use it in my workflow.
But when I check the version, I get 5.7 back… I’m at my wits end now.

image: https://hub.docker.com/repository/docker/madsem/mysql

Run mysql --host mysql --port 3306 -uroot -p -e "SELECT @@global.secure_file_priv"
2
  mysql --host mysql --port 3306 -uroot -p -e "SELECT @@global.secure_file_priv"
3
  mysql -V
4
  shell: sh -e {0}
5
@@global.secure_file_priv
6
NULL
7
mysql  Ver 14.14 Distrib 5.7.30, for Linux (x86_64) using  EditLine wrapper
8
Enter password: 

And here is my workflow:

name: Testing Laravel with MySQL 8
on: [ push, pull_request ]
jobs:
  laravel:
    name: Laravel Testsuite
    runs-on: ubuntu-latest
    container:
      image: kirschbaumdevelopment/laravel-test-runner:7.4

    services:
      mysql:
        image: madsem/mysql:8.0.20
        env:
          MYSQL_ALLOW_EMPTY_PASSWORD: yes
          MYSQL_DATABASE: laravel
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: mysql check
        run: |
          mysql --host mysql --port 3306 -uroot -p -e "SELECT @@global.secure_file_priv"
          mysql -V


      - name: Get Composer Cache Directory
        id: get-composer-cache
        run: |
          echo "::set-output name=dir::$(composer config cache-files-dir)"

      - name: Cache Composer
        uses: actions/cache@v1
        id: composer-cache
        with:
          path: ${{ steps.get-composer-cache.outputs.dir }}
          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
          restore-keys: |
            ${{ runner.os }}-composer-

      - name: Configure composer for Laravel Nova
        run: composer config "http-basic.nova.laravel.com" "${{ secrets.NOVA_USERNAME }}" "${{ secrets.NOVA_PASSWORD }}"

      - name: Install composer dependencies
        run: composer install --no-progress --prefer-dist --no-interaction --no-suggest --optimize-autoloader --no-scripts

      - name: Clear Config
        run: |
          php artisan config:clear
          php artisan cache:clear

      - name: Prepare the application
        run: |
          cp .env.ci .env
          php artisan key:generate

      - name: Run Migration
        run: php artisan migrate --force -v

      - name: Test with phpunit
        run: vendor/bin/phpunit

      - name: Run Sensiolabs security checks
        run: |
          test -d security-checker || git clone https://github.com/sensiolabs/security-checker.git
          cd security-checker
          composer install
          php security-checker security:check ../composer.lock


Can anybody tell me what I do wrong? :blush:

@madsem,

Maybe you can try to use the “FROM” instruction in the Dockerfile of your image to set the public image “mysql:8.0.20” as the the Base Image.

@brightran, thanks! But I ended up using the Ubuntu 20.04 image Github provides and then configure and restart it there. That works perfectly. :slight_smile: