Skip to content

Commit 53d0b7c

Browse files
committed
wip: run tests on github actions
1 parent 125d862 commit 53d0b7c

File tree

3 files changed

+157
-0
lines changed

3 files changed

+157
-0
lines changed
File renamed without changes.

.github/workflows/test.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
concurrency:
9+
group: test-${{ github.ref_name }}
10+
cancel-in-progress: ${{ github.ref_name != 'main' }}
11+
12+
jobs:
13+
solidus_admin:
14+
uses: solidusio/solidus/.github/workflows/test_solidus.yml@run-tests-on-github-actions
15+
with:
16+
lib_name: admin
17+
coverage: false
18+
19+
solidus_api:
20+
uses: solidusio/solidus/.github/workflows/test_solidus.yml@run-tests-on-github-actions
21+
with:
22+
lib_name: api
23+
coverage: false
24+
25+
solidus_backend:
26+
uses: solidusio/solidus/.github/workflows/test_solidus.yml@run-tests-on-github-actions
27+
with:
28+
lib_name: backend
29+
coverage: false
30+
31+
solidus_core:
32+
uses: solidusio/solidus/.github/workflows/test_solidus.yml@run-tests-on-github-actions
33+
with:
34+
lib_name: core
35+
coverage: false
36+
37+
solidus_legacy_promotions:
38+
uses: solidusio/solidus/.github/workflows/test_solidus.yml@run-tests-on-github-actions
39+
with:
40+
lib_name: legacy_promotions
41+
coverage: false
42+
43+
solidus_promotions:
44+
uses: solidusio/solidus/.github/workflows/test_solidus.yml@run-tests-on-github-actions
45+
with:
46+
lib_name: promotions
47+
coverage: false

.github/workflows/test_solidus.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: "Test Solidus"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
lib_name:
7+
description: "The name of the Solidus library to test (e.g., core, backend, frontend)"
8+
type: string
9+
required: true
10+
coverage:
11+
description: "Enable code coverage reporting"
12+
type: boolean
13+
default: false
14+
15+
jobs:
16+
RSpec:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: true
20+
matrix:
21+
include:
22+
- rails: "7.1"
23+
ruby: "3.1"
24+
database: sqlite
25+
storage: paperclip
26+
- rails: "7.2"
27+
ruby: "3.2"
28+
database: postgres
29+
storage: activestorage
30+
- rails: "8.0"
31+
ruby: "3.4"
32+
database: mysql
33+
storage: paperclip
34+
env:
35+
BUNDLE_WITHOUT: "lint release"
36+
COVERAGE: ${{ inputs.coverage }}
37+
COVERAGE_DIR: tmp/coverage
38+
DB: ${{ matrix.database }}
39+
DB_HOST: ${{ matrix.database == 'mysql' && '127.0.0.1' || 'localhost' }}
40+
DB_USERNAME: solidus
41+
DB_PASSWORD: password
42+
DEFAULT_MAX_WAIT_TIME: 10
43+
DISABLE_ACTIVE_STORAGE: ${{ matrix.storage == 'paperclip' }}
44+
LIB_NAME: ${{ inputs.lib_name }}
45+
RAILS_ENV: test
46+
RAILS_VERSION: ${{ matrix.rails }}
47+
SOLIDUS_RAISE_DEPRECATIONS: true
48+
services:
49+
postgres:
50+
image: postgres:13
51+
env:
52+
POSTGRES_USER: ${{ env.DB_USERNAME }}
53+
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
54+
POSTGRES_DB: solidus_test
55+
ports: [5432:5432]
56+
options: >-
57+
--health-cmd pg_isready
58+
--health-interval 10s
59+
--health-timeout 5s
60+
--health-retries 5
61+
mysql:
62+
image: mysql:5.7
63+
env:
64+
MYSQL_ROOT_PASSWORD: ${{ env.DB_PASSWORD }}
65+
MYSQL_DATABASE: solidus_test
66+
ports: [3306:3306]
67+
options: >-
68+
--health-cmd "mysqladmin ping -h 127.0.0.1 -uroot -proot"
69+
--health-interval 10s
70+
--health-timeout 5s
71+
--health-retries 5
72+
steps:
73+
- uses: actions/checkout@v4
74+
- name: Set up Ruby
75+
uses: ruby/setup-ruby@v1
76+
with:
77+
ruby-version: ${{ matrix.ruby }}
78+
bundler-cache: true
79+
- name: Install imagemagick
80+
if: ${{ matrix.storage == 'paperclip' }}
81+
run: |
82+
sudo apt-get update -yq
83+
sudo apt-get autoremove -yq
84+
sudo apt-get install -yq imagemagick --fix-missing
85+
- name: Install libvips
86+
if: ${{ matrix.storage == 'activestorage' }}
87+
run: |
88+
sudo apt-get update -yq
89+
sudo apt-get autoremove -yq
90+
sudo apt-get install -yq libvips-dev --fix-missing
91+
- name: Run tests
92+
run: |
93+
cd ${{ inputs.lib_name }}
94+
bundle exec rake test_app
95+
bundle exec rspec --profile 10 --format progress
96+
97+
Coverage:
98+
runs-on: ubuntu-latest
99+
if: ${{ inputs.coverage == 'true' }}
100+
needs:
101+
- RSpec
102+
steps:
103+
- name: Report Coverage
104+
run: |
105+
bundle exec rake solidus:coverage[cobertura]
106+
- name: Upload Coverage Report
107+
uses: actions/upload-artifact@v4
108+
with:
109+
name: coverage-report
110+
path: tmp/coverage/coverage.xml

0 commit comments

Comments
 (0)