-
-
Notifications
You must be signed in to change notification settings - Fork 0
170 lines (145 loc) · 4.91 KB
/
Copy pathci.yml
File metadata and controls
170 lines (145 loc) · 4.91 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# workflows/ci.yml
#
# CI
# Run lint, test matrix, and example checks for pull requests and main.
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
- name: Install RuboCop
run: gem install rubocop --no-document
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Set up uv
uses: astral-sh/setup-uv@v7
- name: Run RuboCop lint cops
run: |
rubocop --version
rubocop --lint \
lib \
spec \
rails-paradedb.gemspec \
Rakefile
- name: Check API coverage
run: uv run --with json5 scripts/check_api_coverage.py
- name: Gem install smoke test
run: bash scripts/smoke_gem_install.sh
matrix-tests:
name: Ruby ${{ matrix.ruby-version }} / Rails ${{ matrix.rails-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# Rails 7.2 supports Ruby 3.1+ — test on 3.2/3.3/3.4
- rails-version: "7.2"
ruby-version: "3.2"
gemfile: "gemfiles/rails72.gemfile"
- rails-version: "7.2"
ruby-version: "3.3"
gemfile: "gemfiles/rails72.gemfile"
- rails-version: "7.2"
ruby-version: "3.4"
gemfile: "gemfiles/rails72.gemfile"
# Rails 8.1 supports Ruby 3.2+
- rails-version: "8.1"
ruby-version: "3.2"
gemfile: "Gemfile"
- rails-version: "8.1"
ruby-version: "3.3"
gemfile: "Gemfile"
- rails-version: "8.1"
ruby-version: "3.4"
gemfile: "Gemfile"
- rails-version: "8.1"
ruby-version: "4.0"
gemfile: "Gemfile"
services:
paradedb:
image: paradedb/paradedb:0.24.2-pg18
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 12
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
PARADEDB_TEST_DSN: postgresql://postgres:postgres@localhost:5432/postgres
PGPASSWORD: postgres
COVERAGE: "1"
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Run unit tests
env:
COVERAGE_COMMAND_NAME: unit
run: bundle exec rake test
- name: Run integration tests
env:
COVERAGE_COMMAND_NAME: integration
run: bundle exec rake test:integration
- name: Upload to Codecov
uses: codecov/codecov-action@v7
with:
files: ./coverage/coverage.xml
flags: rails-paradedb,rb${{ matrix.ruby-version }},rl${{ matrix.rails-version }}
fail_ci_if_error: false
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Run examples
if: matrix.ruby-version == '3.3' && matrix.rails-version == '8.1'
env:
DATABASE_URL: ${{ env.PARADEDB_TEST_DSN }}
run: |
set -euo pipefail
BUNDLE_GEMFILE=examples/Gemfile bundle install --jobs 4 --retry 3
run_example() {
local script="$1"
local expected="$2"
echo "Running ${script}"
output="$(BUNDLE_GEMFILE=examples/Gemfile bundle exec ruby "${script}")"
echo "${output}"
echo "${output}" | grep -F "${expected}" >/dev/null
}
run_example examples/quickstart/quickstart.rb "rails-paradedb Quickstart Example"
run_example examples/autocomplete/setup.rb "Autocomplete Setup - Creating Dedicated Table"
run_example examples/autocomplete/autocomplete.rb "rails-paradedb Autocomplete Example"
run_example examples/more_like_this/more_like_this.rb "rails-paradedb MoreLikeThis Example"
run_example examples/faceted_search/faceted_search.rb "rails-paradedb Faceted Search Example"
run_example examples/hybrid_rrf/setup.rb "Hybrid Search Setup - Loading Embeddings from CSV"
run_example examples/hybrid_rrf/hybrid_rrf.rb "Hybrid Search with Reciprocal Rank Fusion (single SQL query)"