Skip to content

extracts to the parent class the as_json logic #374

extracts to the parent class the as_json logic

extracts to the parent class the as_json logic #374

Workflow file for this run

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"