-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
109 lines (107 loc) · 3.4 KB
/
test_solidus.yml
File metadata and controls
109 lines (107 loc) · 3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: "Test Solidus"
on:
workflow_call:
inputs:
lib_name:
description: "The name of the Solidus library to test (e.g., core, backend, frontend)"
type: string
required: true
coverage:
type: boolean
default: true
secrets:
CODECOV_TOKEN:
jobs:
RSpec:
name: Rails ${{ matrix.rails }}, Ruby ${{ matrix.ruby }}, ${{ matrix.database }}, ${{ matrix.storage }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- rails: "7.2"
ruby: "3.2"
database: mysql
storage: activestorage
- rails: "7.2"
ruby: "3.3"
database: postgres
storage: activestorage
- rails: "8.0"
ruby: "3.4"
database: sqlite
storage: activestorage
- rails: "8.1"
ruby: "4.0"
database: postgres
storage: activestorage
env:
BUNDLE_WITHOUT: "lint release"
COVERAGE_DIR: ${{ github.workspace }}/${{ inputs.lib_name }}/coverage
DB: ${{ matrix.database }}
DB_HOST: "127.0.0.1"
DB_USERNAME: solidus
DB_PASSWORD: password
DEFAULT_MAX_WAIT_TIME: 10
DISABLE_ACTIVE_STORAGE: ${{ matrix.storage == 'paperclip' }}
LIB_NAME: ${{ inputs.lib_name }}
RAILS_ENV: test
RAILS_VERSION: '~> ${{ matrix.rails }}'
SOLIDUS_RAISE_DEPRECATIONS: true
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: ${{ env.DB_USERNAME }}
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
POSTGRES_DB: solidus_${{ inputs.lib_name }}_test
ports: [5432:5432]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: ${{ env.DB_PASSWORD }}
MYSQL_PASSWORD: ${{ env.DB_PASSWORD }}
MYSQL_USER: ${{ env.DB_USERNAME }}
MYSQL_DATABASE: solidus_${{ inputs.lib_name }}_test
ports: [3306:3306]
options: >-
--health-cmd "mysqladmin ping -h 127.0.0.1 -uroot -proot"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- uses: awalsh128/cache-apt-pkgs-action@v1
if: ${{ matrix.storage == 'activestorage' }}
name: Install libvips
with:
packages: libvips-dev
- name: Setup coverage
id: setup-coverage
if: ${{ inputs.coverage && matrix.rails == '8.0' && matrix.ruby == '3.4' }}
run: |
echo "COVERAGE=true" >> $GITHUB_ENV
echo "coverage=true" >> $GITHUB_OUTPUT
- name: Run tests
run: |
cd ${{ inputs.lib_name }}
bundle exec rake test_app
bundle exec rspec --profile 10 --format progress --format RSpec::Github::Formatter
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v5
if: ${{ steps.setup-coverage.outputs.coverage == 'true' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: solidusio/solidus
disable_search: true
files: ${{ env.COVERAGE_DIR }}/coverage.xml