Testing improvements #25
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Rails testing | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| pull_request: | |
| branches: | |
| - develop | |
| env: | |
| RAILS_ENV: test | |
| jobs: | |
| tests: | |
| name: Ruby on Rails tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| ruby_version: [3.1, 3.2] | |
| test_type: [test, test:system] | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_HOST: '%' | |
| MYSQL_ROOT_PASSWORD: 'root' | |
| MYSQL_DATABASE: 'qpixel_test' | |
| ports: | |
| - 3306:3306 | |
| redis: | |
| image: redis:8.0 | |
| ports: | |
| - 6379:6379 | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v3 | |
| - name: Setup dependencies | |
| run: | | |
| sudo apt-get -qq update | |
| sudo apt-get -yqq install libmariadb-dev libmagickwand-dev | |
| - name: Setup Firefox | |
| if: ${{ matrix.test_type == 'test:system' }} | |
| uses: browser-actions/setup-firefox@v1.5.4 | |
| - name: Check Firefox setup | |
| if: ${{ matrix.test_type == 'test:system' }} | |
| run: firefox --version | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby_version }} | |
| bundler-cache: true | |
| - name: Prepare for testing | |
| run: | | |
| cp config/database.sample.yml config/database.yml | |
| cp config/storage.sample.yml config/storage.yml | |
| bundle exec rails db:create | |
| bundle exec rails db:schema:load | |
| bundle exec rails db:migrate | |
| bundle exec rails test:prepare | |
| - run: bundle exec rails ${{ matrix.test_type }} | |
| - name: Upload screenshots | |
| if: ${{ matrix.test_type == 'test:system' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: screenshots-${{ matrix.ruby_version }} | |
| path: tmp/screenshots | |
| if-no-files-found: ignore | |
| - uses: codecov/codecov-action@v5 | |
| if: ${{ matrix.ruby_version == 3.2 && matrix.test_type == 'test' }} | |
| with: | |
| directory: coverage | |
| fail_ci_if_error: true | |
| report_type: coverage | |
| token: ${{ secrets.CODECOV_TOKEN }} |