-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
99 lines (96 loc) · 2.97 KB
/
action.yml
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
name: Build and test a solidus extension
description: Test solidus extension
inputs:
rails-version:
description: Rails version to use
required: true
default: "7.2"
solidus-branch:
description: Solidus branch to use
required: true
default: main
database:
description: Database to use. sqlite3, postgresql, or mariadb
required: true
default: sqlite3
ruby-version:
description: Ruby version to use
required: true
default: "3.3"
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: solidus_user
POSTGRES_PASSWORD: password
POSTGRES_DB: solidus_extension_test
ports: ["5432:5432"]
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
mariadb:
image: mariadb:latest
ports: ["3307:3306"]
env:
MARIADB_USER: solidus_user
MARIADB_PASSWORD: password
MARIADB_DATABASE: solidus_extension_test
MARIADB_ROOT_PASSWORD: password
options: --health-cmd="mariadb-admin ping" --health-interval=10s --health-timeout=5s --health-retries=5
runs:
using: "composite"
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
env:
RAILS_VERSION: ${{ inputs.rails-version }}
SOLIDUS_BRANCH: ${{ inputs.solidus-branch }}
with:
ruby-version: ${{ inputs.ruby-version }}
bundler-cache: true
cache-version: ${{ inputs.rails-version }}-${{ inputs.solidus-branch }}-{{ inputs.database }}-{{ inputs.ruby-version }}
rubygems: "latest"
- name: Restore apt cache
id: apt-cache
uses: actions/cache@v4
with:
path: /home/runner/apt/cache
key: ${{ runner.os }}-apt-${{ inputs.database }}
restore-keys: |
${{ runner.os }}-apt-
- name: Install libvips
shell: bash
run: |
mkdir -p /home/runner/apt/cache
sudo apt update -qq
sudo apt install -qq --fix-missing libvips -o dir::cache::archives="/home/runner/apt/cache"
sudo chown -R runner /home/runner/apt/cache
- name: Install Postgres headers
if: inputs.database == 'postgresql'
shell: bash
run: |
mkdir -p /home/runner/apt/cache
sudo apt update -qq
sudo apt install -qq --fix-missing libpq-dev -o dir::cache::archives="/home/runner/apt/cache"
sudo chown -R runner /home/runner/apt/cache
- name: Install MariaDB headers
if: inputs.database == 'mariadb'
shell: bash
run: |
mkdir -p /home/runner/apt/cache
sudo apt update -qq
sudo apt install -qq --fix-missing libmysqlclient-dev -o dir::cache::archives="/home/runner/apt/cache"
sudo chown -R runner /home/runner/apt/cache
- name: Run tests
shell: bash
env:
RAILS_VERSION: ${{ inputs.rails-version }}
SOLIDUS_BRANCH: ${{ inputs.solidus-branch }}
run: |
bundle exec rake
- uses: actions/upload-artifact@v4
if: failure()
with:
name: Screenshots
path: |
spec/dummy/tmp/capybara
spec/dummy/tmp/screenshots