forked from rubyapi/rubyapi
-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (116 loc) · 3.38 KB
/
test.yml
File metadata and controls
130 lines (116 loc) · 3.38 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
name: Test
on:
push:
branches:
- main
paths-ignore:
- "**.md"
pull_request:
types:
- opened
- synchronize
paths-ignore:
- "**.md"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set Up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run Ruby linting
run: bin/rubocop
test-import:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17-alpine
ports:
- 5432:5432
env:
POSTGRES_USER: rubyapi
POSTGRES_PASSWORD: rubyapi_password
POSTGRES_DB: rubyapi_test
options: >-
--health-cmd "pg_isready -U rubyapi"
--health-interval 10s
--health-timeout 5s
--health-retries 5
search:
image: opensearchproject/opensearch:2.11.0
ports:
- 9200:9200
env:
"discovery.type": "single-node"
"plugins.security.disabled": "true"
options: >-
--health-cmd "curl --silent --fail http://localhost:9200/_cluster/health || exit 1"
--health-start-period 30s
--health-interval 10s
--health-timeout 5s
--health-retries 10
env:
SEARCH_URL: "http://localhost:9200"
DATABASE_URL: "postgresql://rubyapi:rubyapi_password@localhost:5432/rubyapi_test"
QUEUE_DATABASE_URL: "postgresql://rubyapi:rubyapi_password@localhost:5432/rubyapi_test_queue"
RAILS_ENV: test
steps:
- uses: actions/checkout@v5
- name: Set Up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Setup database config
run: cp config/database.yml.sample config/database.yml
- name: Setup Database
run: bin/rails db:setup
- name: Test Importing Ruby Documentation
run: bin/rails "import:ruby[3.4]"
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17-alpine
ports:
- 5432:5432
env:
POSTGRES_USER: rubyapi
POSTGRES_PASSWORD: rubyapi_password
POSTGRES_DB: rubyapi_test
options: >-
--health-cmd "pg_isready -U rubyapi"
--health-interval 10s
--health-timeout 5s
--health-retries 5
search:
image: opensearchproject/opensearch:2.11.0
ports:
- 9200:9200
env:
"discovery.type": "single-node"
"plugins.security.disabled": "true"
options: >-
--health-cmd "curl --silent --fail http://localhost:9200/_cluster/health || exit 1"
--health-start-period 30s
--health-interval 10s
--health-timeout 5s
--health-retries 10
env:
SEARCH_URL: "http://localhost:9200"
DATABASE_URL: "postgresql://rubyapi:rubyapi_password@localhost:5432/rubyapi_test"
QUEUE_DATABASE_URL: "postgresql://rubyapi:rubyapi_password@localhost:5432/rubyapi_test_queue"
RAILS_ENV: test
steps:
- uses: actions/checkout@v5
- name: Set Up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Setup database config
run: cp config/database.yml.sample config/database.yml
- name: Setup Database
run: bin/rails db:setup
- name: Run Tests
run: bin/rails test