|
2 | 2 |
|
3 | 3 | A GitHub action for testing Solidus extensions |
4 | 4 |
|
| 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 | + |
5 | 20 | ## Example configuration |
6 | 21 |
|
7 | 22 | ```yaml |
|
12 | 27 | branches: |
13 | 28 | - main |
14 | 29 | 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 |
24 | 30 |
|
25 | 31 | 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 }} |
28 | 34 | 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 |
29 | 58 | strategy: |
30 | | - fail-fast: true |
| 59 | + fail-fast: false |
31 | 60 | 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"] |
63 | 65 | steps: |
64 | 66 | - uses: actions/checkout@v4 |
65 | 67 | - name: Run extension tests |
|
69 | 71 | rails-version: ${{ matrix.rails-version }} |
70 | 72 | ruby-version: ${{ matrix.ruby-version }} |
71 | 73 | 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 | | - |
79 | 74 | ``` |
0 commit comments