publiclab/mapknitter

View on GitHub
.github/actions/setup-test-environment/action.yml

Summary

Maintainability
Test Coverage
name: 'Set up test environment'
description: 'Set up test environment for mapknitter'

services:
  mysql:
    image: mysql:5.7
    env:
      MYSQL_ROOT_PASSWORD: root
    ports:
      - 3306
    options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
runs:
  using: 'composite'
  steps:
    - name: Setup database
      shell: bash
      env:
        RAILS_ENV: test
        DB_USER: root
        DB_PASS: root
        # tell Rails to use proper port for MySQL
        DB_PORT: ${{ job.services.mysql.ports[3306] }}
        DISABLE_BOOTSNAP: true
      run: |
        cp config/database.yml.example config/database.yml
        cp db/schema.rb.example db/schema.rb
        cp config/config.yml.example config/config.yml
        sudo systemctl start mysql
        mysql -uroot -proot -e "CREATE DATABASE mapknitter_test;"
        bundle exec rake db:schema:load db:migrate --trace
        sudo apt-get install -y gdal-bin