Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: test CI #1

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
REDIS_URL=redis://:supersecret@127.0.0.1:6379/10
REDIS_URL=redis://:supersecret@redis:6379/10
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Provide configs
2. Run command
3. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Context (please complete the following information):**
- Gem version
- Ruby version
- Rails version
- Gruf version
- Faraday version

**Additional context**
Add any other context about the problem here.
24 changes: 24 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Context

<!--
Short description about the feature and the motivation/issue behind it
-->
-

## Related tickets

-

# What's inside

<!--
List of features and changes (or highlights) (from the code perspective)
The purpose of this list is to track the progress if it's WIP (use checkboxes)
and to emphasize the critical parts (which you'd like to pay reviewers attention to)
-->
- [x] A

# Checklist:

- [ ] I have added tests
- [ ] I have made corresponding changes to the documentation
61 changes: 35 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,47 @@ on:
push:
branches: [main]
pull_request:
branches: [main]
branches: [ '**' ]

jobs:
build:
lint:
runs-on: ubuntu-latest
env:
RUBY_VERSION: "3.3"
name: Rubocop
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Ruby w/ same version as image
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
- name: Install dependencies
run: |
gem install dip
dip bundle install
- name: Run linter
run: dip rubocop

test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ["2.5", "2.6", "2.7", "3.0"]
services:
redis:
image: bitnami/redis:6.2
ports:
- 6379:6379
env:
REDIS_PASSWORD: supersecret
options: >-
--health-cmd "redis-cli -p 6379 -a 'supersecret' ping"
--health-interval 1s
--health-timeout 3s
--health-retries 10
ruby: [ '2.7', '3.0', '3.1', '3.2', '3.3' ]
env:
RUBY_VERSION: ${{ matrix.ruby }}
name: Ruby ${{ matrix.ruby }}
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Ruby w/ same version as image
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ${{ matrix.ruby }}
- name: Run all tests
run: bundle exec rspec
env:
REDIS_URL: redis://:supersecret@redis:${{ job.services.redis.ports[6379] }}/0
# FIXME!
SKIP_REDIS_SPECS: true
- name: Run rubocop
run: bundle exec rubocop
- name: Install dependencies
run: |
gem install dip
dip provision
- name: Run tests
run: dip appraisal rspec --format RspecJunitFormatter --out test-results/rspec_${{ matrix.ruby }}.xml --format documentation
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
/_yardoc/
/coverage/
/doc/
/log/
/pkg/
/spec/reports/
/tmp/
/.idea
*.gem
/test-results/
.rspec_status
/Gemfile.lock
/gemfiles/*gemfile*
/spec/internal/log/*.log
test.log
37 changes: 37 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
include:
- project: "nstmrt/rubygems/templates"
ref: master
file: "build-rubygems.yml"

lint:
stage: test
image: ${BUILD_CONF_HARBOR_REGISTRY}/dhub/library/ruby:3.3
tags:
- paas-tests
script:
- bundle install
- bundle exec rubocop

tests:
stage: test
image: ${BUILD_CONF_HARBOR_REGISTRY}/dhub/library/ruby:$RUBY_VERSION
tags:
- paas-tests
services:
- name: ${BUILD_CONF_HARBOR_REGISTRY}/dhub/bitnami/redis:6.2
alias: redis
variables:
REDIS_PASSWORD: supersecret
parallel:
matrix:
- RUBY_VERSION: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4']
before_script:
- gem sources --remove https://rubygems.org/
- gem sources --add ${RUBYGEMS_PUBLIC_SOURCE}
- gem install bundler -v 2.3.26
- bin/setup
script:
- bundle exec appraisal rspec --format RspecJunitFormatter --out test-results/rspec_$RUBY_VERSION.xml --format documentation
artifacts:
reports:
junit: test-results/rspec*.xml
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
--require spec_helper
--require rails_helper
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: 2.5
TargetRubyVersion: 2.7

Style/Documentation:
Enabled: false
Expand Down
24 changes: 24 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

# See compatibility table at https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html

versions_map = {
'6.0' => %w[2.7],
'6.1' => %w[2.7 3.0],
'7.0' => %w[3.1],
'7.1' => %w[3.2],
'7.2' => %w[3.3 3.4],
'8.0' => %w[3.4]
}

current_ruby_version = RUBY_VERSION.split('.').first(2).join('.')

versions_map.each do |rails_version, ruby_versions|
ruby_versions.each do |ruby_version|
next if ruby_version != current_ruby_version

appraise "rails-#{rails_version}" do
gem 'rails', "~> #{rails_version}.0"
end
end
end
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# CHANGELOG.md

## 1.0.0 (2024-12-28)

Features:

- Drop ruby 2.5/2.6 support
- Add appraisals

Fix:

- Fix ruby-kafka health-check bug for some ActiveSupport versions

## 0.5.0 (2023-08-16)

Features:
Expand Down
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ARG RUBY_VERSION

FROM ruby:$RUBY_VERSION

ARG BUNDLER_VERSION
ARG RUBYGEMS_VERSION

ENV BUNDLE_JOBS=4 \
BUNDLE_RETRY=3

RUN gem update --system "${RUBYGEMS_VERSION}" \
&& rm /usr/local/lib/ruby/gems/*/specifications/default/bundler*.gemspec \
&& gem install --default bundler:${BUNDLER_VERSION} \
&& gem install bundler -v ${BUNDLER_VERSION}
5 changes: 1 addition & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# frozen_string_literal: true

source 'https://rubygems.org'
source ENV.fetch('RUBYGEMS_PUBLIC_SOURCE', 'https://rubygems.org/')

# Specify your gem's dependencies in http_health_check.gemspec
gemspec

gem 'rake', '~> 13.0'

group :test do
gem 'rspec_junit_formatter'
gem 'simplecov', require: false
gem 'simplecov-cobertura', require: false
end
99 changes: 0 additions & 99 deletions Gemfile.lock

This file was deleted.

1 change: 1 addition & 0 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ IFS=$'\n\t'
set -vx

bundle install
bundle exec appraisal install

# Do any other automated setup that you need to do here
6 changes: 6 additions & 0 deletions bin/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -euxo pipefail

bundle exec rubocop
bundle exec appraisal rspec
Loading
Loading