Skip to content

Commit 7987635

Browse files
committed
fix: Remove services
GitHub composite actions do not support starting services. The calling workflow needs to handle this. Currently all our extensions that test multiple database actually test with SQLite all the time. Adding examples and more documentation to README. We now need to update all extensions that use this action manually
1 parent 143f373 commit 7987635

File tree

2 files changed

+49
-69
lines changed

2 files changed

+49
-69
lines changed

README.md

Lines changed: 45 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

33
A GitHub action for testing Solidus extensions
44

5+
## Inputs
6+
7+
| Input | Description | Required | Default |
8+
|-------|-------------|----------|---------|
9+
| `ruby-version` | Ruby version to use | Yes | `3.3` |
10+
| `rails-version` | Rails version to use | Yes | `7.2` |
11+
| `solidus-branch` | Solidus branch to use | Yes | `main` |
12+
| `database` | Database to use (`sqlite3`, `postgresql`, or `mariadb`) | Yes | `sqlite3` |
13+
14+
## Database Services
15+
16+
This is a composite GitHub Action, which means it **cannot define services directly**. If you need to test against PostgreSQL or MySQL/MariaDB, you must define the database service in your workflow file.
17+
18+
The action will install the necessary database client libraries automatically based on the `database` input.
19+
520
## Example configuration
621

722
```yaml
@@ -12,54 +27,41 @@ on:
1227
branches:
1328
- main
1429
pull_request:
15-
schedule:
16-
- cron: "0 0 * * 4" # every Thursday
17-
18-
concurrency:
19-
group: test-${{ github.ref_name }}
20-
cancel-in-progress: ${{ github.ref_name != 'main' }}
21-
22-
permissions:
23-
contents: read
2430

2531
jobs:
26-
rspec:
27-
name: Solidus ${{ matrix.solidus-branch }}, Rails ${{ matrix.rails-version }} and Ruby ${{ matrix.ruby-version }} on ${{ matrix.database }}
32+
test:
33+
name: ${{ matrix.database }} - Solidus ${{ matrix.solidus-branch }}, Rails ${{ matrix.rails-version }}, Ruby ${{ matrix.ruby-version }}
2834
runs-on: ubuntu-24.04
35+
services:
36+
postgres:
37+
image: postgres:16
38+
env:
39+
POSTGRES_HOST_AUTH_METHOD: trust
40+
options: >-
41+
--health-cmd="pg_isready"
42+
--health-interval=10s
43+
--health-timeout=5s
44+
--health-retries=5
45+
ports:
46+
- 5432:5432
47+
mysql:
48+
image: mysql:8.0
49+
env:
50+
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
51+
options: >-
52+
--health-cmd="mysqladmin ping"
53+
--health-interval=10s
54+
--health-timeout=5s
55+
--health-retries=5
56+
ports:
57+
- 3306:3306
2958
strategy:
30-
fail-fast: true
59+
fail-fast: false
3160
matrix:
32-
rails-version:
33-
- "7.0"
34-
- "7.1"
35-
- "7.2"
36-
ruby-version:
37-
- "3.1"
38-
- "3.4"
39-
solidus-branch:
40-
- "v4.1"
41-
- "v4.2"
42-
- "v4.3"
43-
- "v4.4"
44-
database:
45-
- "postgresql"
46-
- "mysql"
47-
- "sqlite"
48-
exclude:
49-
- rails-version: "7.2"
50-
solidus-branch: "v4.3"
51-
- rails-version: "7.2"
52-
solidus-branch: "v4.2"
53-
- rails-version: "7.2"
54-
solidus-branch: "v4.1"
55-
- rails-version: "7.1"
56-
solidus-branch: "v4.2"
57-
- rails-version: "7.1"
58-
solidus-branch: "v4.1"
59-
- ruby-version: "3.4"
60-
rails-version: "7.0"
61-
env:
62-
TEST_RESULTS_PATH: coverage/coverage.xml
61+
database: ["sqlite3", "postgresql", "mariadb"]
62+
rails-version: ["7.1", "7.2"]
63+
ruby-version: ["3.2", "3.3"]
64+
solidus-branch: ["v4.3", "v4.4"]
6365
steps:
6466
- uses: actions/checkout@v4
6567
- name: Run extension tests
@@ -69,11 +71,4 @@ jobs:
6971
rails-version: ${{ matrix.rails-version }}
7072
ruby-version: ${{ matrix.ruby-version }}
7173
solidus-branch: ${{ matrix.solidus-branch }}
72-
- name: Upload coverage reports to Codecov
73-
uses: codecov/codecov-action@v5
74-
continue-on-error: true
75-
with:
76-
token: ${{ secrets.CODECOV_TOKEN }}
77-
files: ${{ env.TEST_RESULTS_PATH }}
78-
7974
```

action.yml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,6 @@ inputs:
1919
required: true
2020
default: "3.3"
2121

22-
services:
23-
postgres:
24-
image: postgres:latest
25-
env:
26-
POSTGRES_USER: solidus_user
27-
POSTGRES_PASSWORD: password
28-
POSTGRES_DB: solidus_extension_test
29-
ports: ["5432:5432"]
30-
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
31-
mariadb:
32-
image: mariadb:latest
33-
ports: ["3307:3306"]
34-
env:
35-
MARIADB_USER: solidus_user
36-
MARIADB_PASSWORD: password
37-
MARIADB_DATABASE: solidus_extension_test
38-
MARIADB_ROOT_PASSWORD: password
39-
options: --health-cmd="mariadb-admin ping" --health-interval=10s --health-timeout=5s --health-retries=5
40-
4122
runs:
4223
using: "composite"
4324
steps:
@@ -46,6 +27,8 @@ runs:
4627
uses: ruby/setup-ruby@v1
4728
env:
4829
DB: ${{ inputs.database }}
30+
DB_HOST: 127.0.0.1
31+
DB_USERNAME: root
4932
RAILS_VERSION: ${{ inputs.rails-version }}
5033
SOLIDUS_BRANCH: ${{ inputs.solidus-branch }}
5134
with:
@@ -88,6 +71,8 @@ runs:
8871
shell: bash
8972
env:
9073
DB: ${{ inputs.database }}
74+
DB_HOST: 127.0.0.1
75+
DB_USERNAME: root
9176
RAILS_VERSION: ${{ inputs.rails-version }}
9277
SOLIDUS_BRANCH: ${{ inputs.solidus-branch }}
9378
run: |

0 commit comments

Comments
 (0)