Skip to content

Run tests on github actions #8

Run tests on github actions

Run tests on github actions #8

Workflow file for this run

name: Test
on:
push:
branches:
- main
pull_request:
schedule:
- cron: "0 0 * * 4" # every Thursday
concurrency:
group: test-${{ github.ref_name }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
permissions:
contents: read
jobs:
Rspec:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
ruby-version:
- "3.1"
- "3.2"
- "3.3"
solidus:
- "v4.1"
- "v4.2"
- "v4.3"
- "v4.4"
database:
- "postgresql"
- "mysql"
- "sqlite"
env:
SOLIDUS_BRANCH: ${{ matrix.solidus }}
DB: ${{ matrix.database }}
RAILS_ENV: test
TEST_RESULTS_PATH: coverage/coverage.xml
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: dummy
POSTGRES_PASSWORD: dummy
POSTGRES_DB: dummy_test
ports: ["5432:5432"]
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
mysql:
image: mysql:5.7
ports: ['3306:3306']
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_ROOT_HOST: '%'
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Install libvips
run: |
mkdir -p /home/runner/apt/cache
sudo apt update -qq
sudo apt install -qq --fix-missing libvips -o dir::cache::archives="/home/runner/apt/cache"
sudo chown -R runner /home/runner/apt/cache
- name: Setup mysql database connection
run: |
sudo apt install -qq --fix-missing libmysqlclient-dev -o dir::cache::archives="/home/runner/apt/cache"
echo "DATABASE_URL=mysql2://[email protected]:3306/dummy_test?pool=5" >> $GITHUB_ENV
if: matrix.database == 'mysql'
- name: Setup postgresql database connection
if: matrix.database == 'postgresql'
run: |
sudo apt install -qq --fix-missing libpq-dev -o dir::cache::archives="/home/runner/apt/cache"
echo "DATABASE_URL=postgres://dummy:[email protected]:5432/dummy_test?pool=5" >> $GITHUB_ENV
- name: Run tests for Solidus ${{ matrix.solidus }} on ${{ matrix.database }} with Ruby ${{ matrix.ruby-version }}
run: bundle exec rake
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: solidusio-contrib/solidus_reviews
file: ./coverage/coverage.xml
- uses: actions/upload-artifact@v4
if: failure()
with:
name: Screenshots
path: |
tmp/capybara
tmp/screenshots