name: Pull Request Testing
on: pull_request
jobs:
  test:
    runs-on: ubuntu-latest
    services:
      memcached:
        image: memcached:1.4.31
        ports:
          - 11211/udp
      mysql:
        image: mysql:5.7
        env:
          MYSQL_DATABASE: datacite
          MYSQL_USER: root
          MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
        ports:
          - 3306
      elasticsearch:
        image: docker.elastic.co/elasticsearch/elasticsearch:7.1.1
        env:
          discovery.type: single-node
          ES_JAVA_OPTS: -Xms512m -Xmx512m
          ELASTIC_PASSWORD: changeme
          xpack.security.enabled: "false"
          http.cors.enabled: "true"
          http.cors.allow-origin: "*"
        ports:
          - 9200
    env:
      MEMCACHE_SERVERS: "localhost:11211"
      MYSQL_HOST: "127.0.0.1"
      MYSQL_DATABASE: datacite
      MYSQL_USER: root
      ES_HOST: "localhost:9200"
      ELASTIC_PASSWORD: "changeme"
      SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
      SESSION_ENCRYPTED_COOKIE_SALT: ${{ secrets.SESSION_ENCRYPTED_COOKIE_SALT }}
      JWT_PRIVATE_KEY: ${{ secrets.JWT_PRIVATE_KEY }}
      JWT_PUBLIC_KEY: ${{ secrets.JWT_PUBLIC_KEY }}
      AWS_REGION: ${{ secrets.AWS_REGION }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up Ruby 2.6
        uses: actions/setup-ruby@v1
        with:
          ruby-version: '2.6.x'
      - uses: actions/cache@v2
        with:
          path: vendor/bundle
          key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
          restore-keys: |
            ${{ runner.os }}-gems-
      - name: Install
        env:
          MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} 
        run: |
          cp .env.build .env
          gem install bundler
          bundle config path vendor/bundle
          bundle install --jobs 4 --retry 3
          sudo /etc/init.d/mysql start
          # bundle exec rails db:setup RAILS_ENV=test      
      - name: Lint and Test
        env:
          MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
          ES_HOST: localhost:${{ job.services.elasticsearch.ports[9200] }}
          ELASTIC_PASSWORD: "changeme"
          MEMCACHE_SERVERS: "localhost:11211"
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        run: |
          # bundle exec rubocop
          bundle exec rspec
          echo $? 
Add testing on pull request
Add testing on pull request
