-
Notifications
You must be signed in to change notification settings - Fork 4
141 lines (134 loc) · 4.58 KB
/
main.yml
File metadata and controls
141 lines (134 loc) · 4.58 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
name: Ruby
on:
- push
- workflow_call
jobs:
build:
services:
mysql:
image: mysql:8
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: cats_test
ports: ['3306:3306']
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
postgres:
image: postgres:16
ports: ['5432:5432']
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
options: --mount type=tmpfs,destination=/var/lib/postgresql/data --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries=3
runs-on: ubuntu-latest
name: Build (Ruby ${{ matrix.ruby }})
strategy:
fail-fast: false
matrix:
ruby:
- "3.3"
- "3.2"
- "3.1"
- "3.0"
- "2.7"
include:
- ruby: "3.3"
latest: true
env:
POSTGRES_USERNAME: postgres
POSTGRES_PASSWORD: password
steps:
- uses: actions/checkout@v4
- name: Install any system dependencies
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
- name: Set up the correct Gemfile for Ruby ${{ matrix.ruby }}
run: bin/link_gemfile "${{ matrix.ruby }}"
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run the unit tests
run: bundle exec rake test
- name: Lint the code
run: bundle exec rake standard
- name: Build the gem
run: bundle exec rake build
e2e:
services:
mysql:
image: mysql:8
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: cats_test
ports: ['3306:3306']
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
postgres:
image: postgres:16
ports: ['5432:5432']
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
options: --mount type=tmpfs,destination=/var/lib/postgresql/data --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries=3
runs-on: ubuntu-latest
name: End to end tests (Ruby ${{ matrix.ruby }}, DB ${{ matrix.db }}, App ${{ matrix.app }})
strategy:
fail-fast: false
matrix:
ruby:
- "3.3"
- "3.2"
- "3.1"
- "3.0"
- "2.7"
app:
- "rails7.1_sql_injection"
db:
- "mysql2"
- "trilogy"
- "postgresql"
- "sqlite3"
include:
- app: "rails7.1_sql_injection"
db: "mysql2"
env: "DATABASE_URL=mysql2://root:@127.0.0.1:3306/cats_test"
- app: "rails7.1_sql_injection"
db: "trilogy"
env: "DATABASE_URL=trilogy://root:@127.0.0.1:3306/cats_test"
- app: "rails7.1_sql_injection"
db: "postgresql"
env: "DATABASE_URL=postgresql://postgres:password@127.0.0.1:5432/cats_test"
- app: "rails7.1_sql_injection"
db: "sqlite3"
env: "DATABASE_URL=sqlite3:storage/test.salite3"
exclude:
- ruby: "2.7"
db: "trilogy"
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/sample_apps/${{ matrix.app }}/Gemfile
steps:
- uses: actions/checkout@v4
- name: Set up the correct Gemfile for Ruby ${{ matrix.ruby }}
run: bin/link_gemfile "${{ matrix.ruby }}"
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Set any matrix-defined ENV
run: echo "${{ matrix.env }}" >> "$GITHUB_ENV"
if: ${{ matrix.env }}
- name: Install system dependencies
run: |
sudo gpg -k
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/k6-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
echo "deb [signed-by=/usr/share/keyrings/k6-archive-keyring.gpg] https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list
sudo apt-get update
sudo apt-get install -y k6
- name: Remove the in-repo database config
run: rm -f ${{ github.workspace }}/sample_apps/${{ matrix.app }}/config/database.yml
- name: Download libzen
run: "bundle exec rake libzen:download:current"
- name: Run the e2e tests
run: "bundle exec rake e2e:${{ matrix.app }}"
- name: Run the benchmarks
run: "bundle exec rake bench:${{ matrix.app }}:run"