Skip to content

refactor: split validation and formatting #115

refactor: split validation and formatting

refactor: split validation and formatting #115

Workflow file for this run

name: Ruby CI
on:
push:
branches: [master]
paths:
- ".github/workflows/ruby.yml"
- "Gemfile"
- "lib/**"
- "mihari.gemspec"
- "Rakefile"
- "specs/**"
pull_request:
branches: [master]
paths:
- ".github/workflows/ruby.yml"
- "Gemfile"
- "lib/**"
- "mihari.gemspec"
- "Rakefile"
- "specs/**"
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: [3.3]
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler: latest
bundler-cache: true
- name: Lint
run: bundle exec rake rubocop
test:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: [3.1, 3.2, 3.3]
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler: latest
bundler-cache: true
- name: Create dummy frontend assets
run: |
mkdir -p lib/mihari/web/public/
touch lib/mihari/web/public/index.html
- name: Test
run: bundle exec rake
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
flag-name: run-${{ matrix.ruby-version }}
parallel: true
test-postgres:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
strategy:
matrix:
ruby-version: [3.1, 3.2, 3.3]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get -yqq install libpq-dev
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler: latest
bundler-cache: true
- name: Create dummy frontend assets
run: |
mkdir -p lib/mihari/web/public/
touch lib/mihari/web/public/index.html
- name: Test
env:
DATABASE: postgresql://postgres:postgres@localhost:5432/test
run: bundle exec rake
test-mysql:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8
env:
MYSQL_USER: mysql
MYSQL_PASSWORD: mysql
MYSQL_DATABASE: test
MYSQL_ROOT_PASSWORD: rootpassword
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
strategy:
matrix:
ruby-version: [3.1, 3.2, 3.3]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get -yqq install libmysqlclient-dev
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler: latest
bundler-cache: true
- name: Create dummy frontend assets
run: |
mkdir -p lib/mihari/web/public/
touch lib/mihari/web/public/index.html
- name: Test
env:
DATABASE: mysql2://mysql:[email protected]:3306/test
run: bundle exec rake
coverage:
name: Coverage
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true