Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mysql to github actions #117

Open
darcys22 opened this issue Dec 30, 2020 · 0 comments
Open

Add mysql to github actions #117

darcys22 opened this issue Dec 30, 2020 · 0 comments

Comments

@darcys22
Copy link
Owner

The next step in #49 is to run all the tests a second time using the mysql database rather than just a sqlite in memory database.

It appears possible and relatively straightforward to include mysql to a github action workflow.

Found this blog post on the process:
https://freek.dev/1590-how-to-use-a-mysql-database-on-github-actions

Appears you add a 'service' to a github action job which in this case is mysql. Then you define the credentials and config. This repo appears to be an official github example page:
https://github.com/actions/virtual-environments

In particular this template for postgres looks helpful:
https://github.com/actions/example-services/blob/main/.github/workflows/postgres-service.yml

it appears we would do something like this:

...
  test:
    strategy:
      fail-fast: false # dont' want one scenario failing to deprive us of feedback on the others
      matrix:
        go-version: [1.14.x, 1.15.x]
        os: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    services:
        mysql:
            image: mysql:5.7
            env:
                MYSQL_ALLOW_EMPTY_PASSWORD: yes
                MYSQL_DATABASE: laravel_tags
            ports:
                - 3306
            options: --health-cmd="mysqladmin ping" --health-interval=10s
...

However just found this announcement:
https://github.blog/changelog/2020-02-21-github-actions-breaking-change-ubuntu-virtual-environments-will-no-longer-start-the-mysql-service-automatically/

Which may mean that it instead done via a step. Unsure how this would work with a windows container though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant