internetee-registry/.github/workflows/ruby.yml
2025-08-08 11:09:37 +03:00

69 lines
2.3 KiB
YAML

name: Github Testing
on: [push]
jobs:
test:
services:
postgres:
image: postgres:16
ports:
- "5432:5432"
env:
POSTGRES_PASSWORD: password
POSTGRES_USERNAME: postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
ruby: ['3.0.3']
runs-on: ${{ matrix.os }}
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Config bundler
run: |
bundle config set without 'development staging production'
bundle config set deployment '[secure]'
bundle env
head -n1 $(which bundle)
- name: Run Tests
env:
PG_DATABASE: postgres
PG_HOST: localhost
PG_USER: postgres
PG_PASSWORD: password
PG_PORT: ${{ job.services.postgres.ports[5432] }}
RAILS_ENV: test
COVERAGE: true
DISABLE_SPRING: 1
run: |
cp config/application.yml.sample config/application.yml
cp config/database_travis.yml config/database.yml
echo "openssl_config_path: 'test/fixtures/files/test_ca/openssl.cnf'" >> config/application.yml
echo "crl_dir: 'test/fixtures/files/test_ca/crl'" >> config/application.yml
echo "crl_path: 'test/fixtures/files/test_ca/crl/crl.pem'" >> config/application.yml
echo "ca_cert_path: 'test/fixtures/files/test_ca/certs/ca.crt.pem'" >> config/application.yml
echo "ca_key_path: 'test/fixtures/files/test_ca/private/ca.key.pem'" >> config/application.yml
echo "ca_key_password: 'password'" >> config/application.yml
bundle exec rake db:setup:all
bundle exec rails test test/*
- uses: qltysh/qlty-action/coverage@v2
if: github.event_name == 'push'
with:
token: ${{ secrets.QLTY_TOKEN }}
files: coverage/.resultset.json
- uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage/