Repository navigation
153 lines (122 loc) · 3.57 KB
/
Copy pathtests.yml
File metadata and controls
153 lines (122 loc) · 3.57 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
name: Tests
defaults:
run:
shell: bash
permissions:
contents: read
concurrency:
group: tests-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
on:
workflow_call: # the Release workflow runs the full gate on the exact commit it releases
push:
branches: [ "main" ]
pull_request:
branches: [ "*" ]
paths:
- "**"
- "!**.md"
env:
DB_NAME: tests
DB_USER: root
DB_PASS: pass
jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
# protocol codec, generator, golden snapshots, formatting rules (incl. the protobuf codec cross-check)
- name: Unit & golden tests
run: bundle exec rake test
compatibility:
name: Plugin on Ruby ${{ matrix.ruby-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby-version: ['3.1', '3.2', '3.4']
steps:
- uses: actions/checkout@v7
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
# the process plugin runs on whatever Ruby the user has: no bundler, only the standard library + minitest
- name: Unit tests
run: ruby -Ilib -Itest -e 'Dir["test/*_test.rb"].sort.each { |file| require File.expand_path(file) }'
end2end-pg:
name: End-to-End (PostgreSQL)
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16.2
env:
POSTGRES_DB: tests
POSTGRES_USER: root
POSTGRES_PASSWORD: pass
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U root -d tests"
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
POSTGRES_HOST: 127.0.0.1
steps:
- uses: actions/checkout@v7
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Create the schema
run: psql -v ON_ERROR_STOP=1 -h 127.0.0.1 -U "${DB_USER}" -d "${DB_NAME}" -f examples/authors/postgresql/schema.sql
env:
PGPASSWORD: ${{ env.DB_PASS }}
- name: End-to-End tests
run: bundle exec rake end2end_pg
end2end-mysql:
name: End-to-End (MySQL)
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.3.0
env:
MYSQL_DATABASE: tests
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -h 127.0.0.1"
--health-interval 5s
--health-timeout 5s
--health-retries 20
env:
MYSQL_HOST: 127.0.0.1
steps:
- uses: actions/checkout@v7
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Create the schema (and allow LOAD DATA LOCAL INFILE for :copyfrom)
run: |
mysql -h 127.0.0.1 -u "${DB_USER}" -e 'SET GLOBAL local_infile = 1'
mysql -h 127.0.0.1 -u "${DB_USER}" "${DB_NAME}" < examples/authors/mysql/schema.sql
- name: End-to-End tests
run: bundle exec rake end2end_mysql2
end2end-sqlite:
name: End-to-End (SQLite)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: End-to-End tests
run: bundle exec rake end2end_sqlite3