name: CI on: [push, pull_request] jobs: RSpec: runs-on: ubuntu-latest strategy: fail-fast: false matrix: rails: - '5.2' - '6.0' ruby: - '2.5.x' - '2.6.x' database: - mysql - postgresql env: DB: ${{ matrix.database }} MYSQL_PASSWORD: root POSTGRES_USER: postgres POSTGRES_PASSWORD: password RAILS_ENV: test RAILS_VERSION: ${{ matrix.rails }} CC_TEST_REPORTER_ID: bca4349e32f97919210ac8a450b04904b90683fcdd57d65a22c0f5065482bc22 services: postgres: image: postgres:11 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: password POSTGRES_DB: alchemy_cms_dummy_test ports: ['5432:5432'] options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - uses: actions/checkout@v1 - name: Set up Ruby uses: actions/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} - name: Restore apt cache id: apt-cache uses: actions/cache@preview with: path: /home/runner/apt/cache key: ${{ runner.os }}-apt-${{ matrix.database }} restore-keys: | ${{ runner.os }}-apt- - name: Install Postgres headers if: matrix.database == 'postgresql' run: | mkdir -p /home/runner/apt/cache sudo apt-get update -qq sudo apt-get install -qq --fix-missing libpq-dev -o dir::cache::archives="/home/runner/apt/cache" sudo chown -R runner /home/runner/apt/cache - name: Install MySQL headers if: matrix.database == 'mysql' run: | mkdir -p /home/runner/apt/cache sudo apt-get update -qq sudo apt-get install -qq --fix-missing libmysqlclient-dev -o dir::cache::archives="/home/runner/apt/cache" sudo chown -R runner /home/runner/apt/cache - name: Install bundler run: | gem install bundler - name: Restore Ruby Gems cache id: cache uses: actions/cache@preview with: path: vendor/bundle key: ${{ runner.os }}-bundle-${{ matrix.ruby }}-${{ matrix.rails }}-${{ matrix.database }}-${{ hashFiles('**/Gemfile') }} restore-keys: | ${{ runner.os }}-bundle- - name: Install bundle timeout-minutes: 10 run: | bundle install --jobs 4 --retry 3 --path vendor/bundle - name: Prepare database run: | bundle exec rake alchemy:spec:prepare - name: Install code climate test reporter run: | curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter chmod +x ./cc-test-reporter ./cc-test-reporter before-build - name: Test with RSpec run: | bundle exec rspec ./cc-test-reporter after-build --exit-code $? - uses: actions/upload-artifact@master if: failure() with: name: Screenshots path: spec/dummy/tmp/screenshots