Skip to content

Commit 87cf6ed

Browse files
committed
adding code coverage
1 parent 50b6b79 commit 87cf6ed

File tree

9 files changed

+166
-32
lines changed

9 files changed

+166
-32
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
day: "friday"
8+
time: "01:00" # UTC
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "main" ]
20+
schedule:
21+
- cron: '39 11 * * 2'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'ruby' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v4
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v3
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
52+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53+
# queries: security-extended,security-and-quality
54+
55+
56+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57+
# If this step fails, then you should remove it and run the build manually (see below)
58+
- name: Autobuild
59+
uses: github/codeql-action/autobuild@v3
60+
61+
# ℹ️ Command-line programs to run using the OS shell.
62+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63+
64+
# If the Autobuild fails above, remove it and uncomment the following three lines.
65+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66+
67+
# - run: |
68+
# echo "Run, Build Application using script"
69+
# ./location_of_script_within_repo/buildscript.sh
70+
71+
- name: Perform CodeQL Analysis
72+
uses: github/codeql-action/analyze@v3

.github/workflows/ruby.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# install dependencies and run tests
2+
# https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
3+
4+
name: Ruby
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
11+
pull_request:
12+
13+
jobs:
14+
test_matrix:
15+
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os:
20+
- ubuntu
21+
- macos
22+
ruby:
23+
- 2.5
24+
- 2.6
25+
- 2.7
26+
- "3.0"
27+
- 3.1
28+
- 3.2
29+
- 3.3
30+
- head
31+
- truffleruby
32+
- truffleruby-head
33+
- mingw
34+
- jruby
35+
- jruby-head
36+
exclude:
37+
- { os: ubuntu, ruby: mingw }
38+
- { os: macos, ruby: mingw }
39+
- { os: windows, ruby: truffleruby }
40+
- { os: windows, ruby: truffleruby-head }
41+
42+
runs-on: ${{ matrix.os }}-latest
43+
44+
steps:
45+
- name: clone ${{ github.repository }}
46+
uses: actions/checkout@v4
47+
- name: setup Ruby ${{ matrix.ruby }}
48+
uses: ruby/setup-ruby@v1
49+
with:
50+
ruby-version: ${{ matrix.ruby }}
51+
bundler-cache: true
52+
env:
53+
JAVA_OPTS: -Djdk.io.File.enableADS=true
54+
- name: Run tests
55+
run: bundle exec rake
56+
env:
57+
JAVA_OPTS: -Djdk.io.File.enableADS=true
58+
59+
finish:
60+
runs-on: ubuntu-latest
61+
needs: [ test_matrix ]
62+
steps:
63+
- name: Wait for status checks
64+
run: echo "All Green!"

.rspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--require spec_helper

.travis.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Embedded Localization
22

3+
[![codecov](https://codecov.io/gh/tilo/embedded_localization/graph/badge.svg?token=MX3ULB0S1Y)](https://codecov.io/gh/tilo/embedded_localization) [![Gem Version](https://badge.fury.io/rb/embedded_localization.svg)](http://badge.fury.io/rb/embedded_localization)
4+
35
`embedded_localization` is compatible with Rails 6.x, 7.x, and adds model translations to ActiveRecord. `embedded_localization` is compatible with and builds on the new [I18n API in Ruby on Rails](http://guides.rubyonrails.org/i18n.html)
46

57
`embedded_localization` is very lightweight, and allows you to transparently store translations of attributes right inside each record — no extra database tables needed to store the localization data! Make sure that your database default encoding is UTF-8 or UFT-16.

Rakefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,10 @@ task :spec_all do
1616
end
1717

1818
task :default => :spec
19+
20+
desc 'Run spec with coverage'
21+
task :coverage do
22+
ENV['COVERAGE'] = 'true'
23+
Rake::Task['spec'].execute
24+
`open coverage/index.html`
25+
end

embedded_localization.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
2424
spec.require_paths = ["lib"]
2525
spec.licenses = ['MIT']
2626
# specify any dependencies here; for example:
27+
spec.add_development_dependency "codecov"
2728
spec.add_development_dependency "rspec"
2829
spec.add_development_dependency "activerecord", ">= 6"
2930
spec.add_development_dependency "i18n"

spec/spec_helper.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
require 'active_record'
22
require 'i18n'
33

4+
require 'simplecov'
5+
SimpleCov.start do
6+
add_filter '/spec/'
7+
add_filter "/pkg/"
8+
end
9+
10+
if ENV['CI'] == 'true' || ENV['CODECOV_TOKEN']
11+
require 'codecov'
12+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
13+
end
14+
415
require 'embedded_localization'
516

617
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"

0 commit comments

Comments
 (0)