Skip to content

Commit cbcfdd2

Browse files
committed
Run tests on github actions
Bye Bye CircleCI. GittHub actions is much faster and has better integration into GitHub (surprise!).
1 parent 72b8c40 commit cbcfdd2

File tree

3 files changed

+163
-0
lines changed

3 files changed

+163
-0
lines changed

.github/workflows/test.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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_sample:
38+
uses: solidusio/solidus/.github/workflows/test_solidus.yml@run-tests-on-github-actions
39+
with:
40+
lib_name: sample
41+
coverage: false
42+
43+
solidus_legacy_promotions:
44+
uses: solidusio/solidus/.github/workflows/test_solidus.yml@run-tests-on-github-actions
45+
with:
46+
lib_name: legacy_promotions
47+
coverage: false
48+
49+
solidus_promotions:
50+
uses: solidusio/solidus/.github/workflows/test_solidus.yml@run-tests-on-github-actions
51+
with:
52+
lib_name: promotions
53+
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+
name: Rails ${{ matrix.rails }}, Ruby ${{ matrix.ruby }}, ${{ matrix.database }}, ${{ matrix.storage }}
18+
runs-on: ubuntu-22.04
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- rails: "7.0"
24+
ruby: "3.1"
25+
database: postgres
26+
storage: paperclip
27+
- rails: "7.1"
28+
ruby: "3.2"
29+
database: mysql
30+
storage: activestorage
31+
- rails: "7.2"
32+
ruby: "3.3"
33+
database: postgres
34+
storage: activestorage
35+
- rails: "8.0"
36+
ruby: "3.4"
37+
database: sqlite
38+
storage: activestorage
39+
env:
40+
BUNDLE_WITHOUT: "lint release"
41+
COVERAGE: ${{ inputs.coverage }}
42+
COVERAGE_DIR: tmp/coverage
43+
DB: ${{ matrix.database }}
44+
DB_HOST: "127.0.0.1"
45+
DB_USERNAME: solidus
46+
DB_PASSWORD: password
47+
DEFAULT_MAX_WAIT_TIME: 10
48+
DISABLE_ACTIVE_STORAGE: ${{ matrix.storage == 'paperclip' }}
49+
LIB_NAME: ${{ inputs.lib_name }}
50+
RAILS_ENV: test
51+
RAILS_VERSION: '~> ${{ matrix.rails }}'
52+
SOLIDUS_RAISE_DEPRECATIONS: true
53+
services:
54+
postgres:
55+
image: postgres:13
56+
env:
57+
POSTGRES_USER: ${{ env.DB_USERNAME }}
58+
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
59+
POSTGRES_DB: solidus_${{ inputs.lib_name }}_test
60+
ports: [5432:5432]
61+
options: >-
62+
--health-cmd pg_isready
63+
--health-interval 10s
64+
--health-timeout 5s
65+
--health-retries 5
66+
mysql:
67+
image: mysql:5.7
68+
env:
69+
MYSQL_ROOT_PASSWORD: ${{ env.DB_PASSWORD }}
70+
MYSQL_PASSWORD: ${{ env.DB_PASSWORD }}
71+
MYSQL_USER: ${{ env.DB_USERNAME }}
72+
MYSQL_DATABASE: solidus_${{ inputs.lib_name }}_test
73+
ports: [3306:3306]
74+
options: >-
75+
--health-cmd "mysqladmin ping -h 127.0.0.1 -uroot -proot"
76+
--health-interval 10s
77+
--health-timeout 5s
78+
--health-retries 5
79+
steps:
80+
- uses: actions/checkout@v4
81+
- name: Setup Ruby
82+
uses: ruby/setup-ruby@v1
83+
with:
84+
ruby-version: ${{ matrix.ruby }}
85+
bundler-cache: true
86+
- uses: awalsh128/cache-apt-pkgs-action@v1
87+
if: ${{ matrix.storage == 'activestorage' }}
88+
name: Install libvips
89+
with:
90+
packages: libvips-dev
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)