Skip to content

Attempt fix at tests CI #54

Attempt fix at tests CI

Attempt fix at tests CI #54

Workflow file for this run

name: Tests
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
branches:
- 'main'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11.5
ports: ["5432:5432"]
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
strategy:
fail-fast: false
matrix:
db:
- mysql
- postgresql
- sqlite3
ruby:
- 3.3.0
rails:
- rails_7_1
# exclude:
# - rails: rails_4_2
# ruby: 2.6.6
# - rails: rails_4_2
# ruby: 2.7.2
env:
BUNDLER_VERSION: 2.5.6
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 8
distribution: 'temurin'
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-${{ matrix.ruby}}-gems-${{ hashFiles('**/calagator.gemspec') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ruby }}-gems-
- name: Install System Dependencies
run: |
gem install bundler -v $BUNDLER_VERSION
- name: bundle install
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
# - name: Generate host app for testing
# run: bundle _1.17.3_ exec bin/calagator new spec/dummy --dummy --database=${{ matrix.db }} --postgres-username=postgres
- name: Standardrb Check
run: bundle exec standardrb
- name: Set Postgres Username + Host
if: matrix.db == 'postgresql'
run: |
sed -e $'s/adapter: postgresql/adapter: postgresql\\\n username: postgres\\\n host: localhost/' -i -- spec/test_app/config/database.yml
- name: Setup MySQL
if: matrix.db == 'mysql'
run: |
sed -e 's/password:.*/password: root/' -i -- spec/test_app/config/database.yml
sudo systemctl start mysql.service
- name: Prepare Database
run: bundle exec rake app:db:create app:db:migrate app:db:seed
- name: Start Solr
run: |
RAILS_ENV=test bundle exec rake app:sunspot:solr:start_with_waiting
- name: Run RSpec
run: bundle exec rake spec
- uses: actions/upload-artifact@v1
with:
name: coverage-${{ matrix.db }}-${{ matrix.ruby }}-${{ matrix.rails }}
path: coverage
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage/lcov.info