Skip to content

Commit c3dc673

Browse files
committed
Merge branch 'develop' into manage_users_base
2 parents a70ef9b + afafeaf commit c3dc673

File tree

9 files changed

+89
-60
lines changed

9 files changed

+89
-60
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
services:
9+
postgres:
10+
image: postgres:9.4
11+
ports: ["5432:5432"]
12+
env:
13+
POSTGRES_USER: postgres
14+
POSTGRES_PASSWORD: postgres
15+
POSTGRES_DB: timeoverflow_test
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Set up Ruby
19+
uses: ruby/setup-ruby@v1
20+
with:
21+
bundler-cache: true
22+
- name: Run tests
23+
env:
24+
RAILS_ENV: test
25+
POSTGRES_USER: postgres
26+
POSTGRES_PASSWORD: postgres
27+
run: |
28+
bundle exec rails db:setup
29+
bundle exec rspec
30+
- name: Publish code coverage
31+
uses: paambaati/codeclimate-action@v3.2.0
32+
env:
33+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
34+
with:
35+
coverageLocations: ${{ github.workspace }}/coverage/coverage.json:simplecov

.travis.yml

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

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
source 'https://rubygems.org'
22

3-
ruby File.read('.ruby-version').strip
3+
ruby ">= #{File.read('.ruby-version').strip}"
44

55
gem 'rails', '~> 6.1.1'
66
gem 'rails-i18n', '~> 6.0.0'
@@ -10,7 +10,7 @@ gem 'activeadmin', '~> 2.9.0'
1010
gem 'bootsnap', '~> 1.12.0', require: false
1111
gem 'has_scope', '~> 0.7.2'
1212
gem 'pundit', '~> 2.1.0'
13-
gem 'pg', '~> 1.2.1'
13+
gem 'pg', '~> 1.4'
1414
gem 'json_translate', '~> 4.0.0'
1515
gem 'devise', '~> 4.7.1'
1616
gem 'http_accept_language', '~> 2.1.1'

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ GEM
239239
parser (3.0.1.1)
240240
ast (~> 2.4.1)
241241
pdf-core (0.9.0)
242-
pg (1.2.3)
242+
pg (1.4.6)
243243
pg_search (2.3.5)
244244
activerecord (>= 5.2)
245245
activesupport (>= 5.2)
@@ -253,7 +253,7 @@ GEM
253253
activesupport (>= 3.0.0)
254254
raabro (1.4.0)
255255
racc (1.6.1)
256-
rack (2.2.6.2)
256+
rack (2.2.6.3)
257257
rack-test (2.0.2)
258258
rack (>= 1.3)
259259
rails (6.1.6)
@@ -450,7 +450,7 @@ DEPENDENCIES
450450
letter_opener (~> 1.7.0)
451451
listen (~> 3.2.0)
452452
localeapp (~> 3.3)
453-
pg (~> 1.2.1)
453+
pg (~> 1.4)
454454
pg_search (~> 2.3.5)
455455
prawn (~> 2.4.0)
456456
prawn-table (~> 0.2.2)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# TimeOverflow
22
[![View performance data on Skylight](https://badges.skylight.io/problem/grDTNuzZRnyu.svg)](https://oss.skylight.io/app/applications/grDTNuzZRnyu)
3-
[![Build Status](https://travis-ci.com/coopdevs/timeoverflow.svg?branch=develop)](https://travis-ci.com/coopdevs/timeoverflow)
3+
[![Build Status](https://github.com/coopdevs/timeoverflow/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/coopdevs/timeoverflow/actions)
44
[![Maintainability](https://api.codeclimate.com/v1/badges/f82c6d98a2441c84f2ef/maintainability)](https://codeclimate.com/github/coopdevs/timeoverflow/maintainability)
55
[![Test Coverage](https://api.codeclimate.com/v1/badges/f82c6d98a2441c84f2ef/test_coverage)](https://codeclimate.com/github/coopdevs/timeoverflow/test_coverage)
66

config/database.yml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
1-
# If you want to change this file, please keep the changes in your working
2-
# copy by using
3-
#
4-
# git update-index --skip-worktree config/database.yml
5-
#
6-
# or just use DATABASE_URL, in which case Rails will happily skip the whole
7-
# file.
8-
#
9-
# See https://github.com/coopdevs/timeoverflow/wiki/Keeping-your-local-files
10-
# for more information
11-
#
12-
131
defaults: &defaults
142
adapter: postgresql
15-
username: <%= ENV['DATABASE_USER'] %> # default is null
16-
collation: 'es_ES.UTF-8'
17-
ctype: 'es_ES.UTF-8'
3+
username: <%= ENV['DATABASE_USER'] || ENV["POSTGRES_USER"] %>
184
template: 'template0'
195
encoding: 'UTF8'
206

@@ -24,12 +10,18 @@ development:
2410

2511
test:
2612
<<: *defaults
27-
database: 'timeoverflow_test'
13+
database: timeoverflow_test
14+
host: localhost
15+
password: <%= ENV['DATABASE_PASSWORD'] || ENV["POSTGRES_PASSWORD"] %>
2816

2917
staging:
3018
<<: *defaults
19+
collation: 'es_ES.UTF-8'
20+
ctype: 'es_ES.UTF-8'
3121
database: <%= ENV.fetch('DATABASE_NAME', 'timeoverflow_staging') %>
3222

3323
production:
3424
<<: *defaults
25+
collation: 'es_ES.UTF-8'
26+
ctype: 'es_ES.UTF-8'
3527
database: <%= ENV.fetch('DATABASE_NAME', 'timeoverflow_production') %>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class MigrateHstoreToJson < ActiveRecord::Migration[6.1]
2+
def up
3+
rename_column :categories, :name_translations, :name_translations_hstore
4+
add_column :categories, :name_translations, :jsonb, default: {}, null: false, index: { using: 'gin' }
5+
execute 'UPDATE "categories" SET "name_translations" = json_object(hstore_to_matrix("name_translations_hstore"))::jsonb'
6+
remove_column :categories, :name_translations_hstore
7+
end
8+
9+
def down
10+
rename_column :categories, :name_translations, :name_translations_jsonb
11+
add_column :categories, :name_translations, :hstore, default: {}, null: false
12+
execute 'UPDATE "categories" SET "name_translations" = (SELECT hstore(key, value) FROM jsonb_each_text("name_translations_jsonb"))'
13+
remove_column :categories, :name_translations_jsonb
14+
end
15+
end

db/structure.sql

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ ALTER SEQUENCE public.active_admin_comments_id_seq OWNED BY public.active_admin_
158158

159159

160160
--
161-
-- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
161+
-- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
162162
--
163163

164164
CREATE TABLE public.active_storage_attachments (
@@ -191,7 +191,7 @@ ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_s
191191

192192

193193
--
194-
-- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
194+
-- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
195195
--
196196

197197
CREATE TABLE public.active_storage_blobs (
@@ -227,7 +227,7 @@ ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage
227227

228228

229229
--
230-
-- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: -
230+
-- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: -
231231
--
232232

233233
CREATE TABLE public.active_storage_variant_records (
@@ -257,7 +257,7 @@ ALTER SEQUENCE public.active_storage_variant_records_id_seq OWNED BY public.acti
257257

258258

259259
--
260-
-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
260+
-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
261261
--
262262

263263
CREATE TABLE public.ar_internal_metadata (
@@ -276,7 +276,7 @@ CREATE TABLE public.categories (
276276
id integer NOT NULL,
277277
created_at timestamp without time zone,
278278
updated_at timestamp without time zone,
279-
name_translations public.hstore
279+
name_translations jsonb DEFAULT '{}'::jsonb NOT NULL
280280
);
281281

282282

@@ -862,31 +862,31 @@ ALTER TABLE ONLY public.active_admin_comments
862862

863863

864864
--
865-
-- Name: active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
865+
-- Name: active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
866866
--
867867

868868
ALTER TABLE ONLY public.active_storage_attachments
869869
ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
870870

871871

872872
--
873-
-- Name: active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
873+
-- Name: active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
874874
--
875875

876876
ALTER TABLE ONLY public.active_storage_blobs
877877
ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
878878

879879

880880
--
881-
-- Name: active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
881+
-- Name: active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
882882
--
883883

884884
ALTER TABLE ONLY public.active_storage_variant_records
885885
ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
886886

887887

888888
--
889-
-- Name: ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
889+
-- Name: ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
890890
--
891891

892892
ALTER TABLE ONLY public.ar_internal_metadata
@@ -1025,28 +1025,28 @@ CREATE INDEX index_active_admin_comments_on_resource_type_and_resource_id ON pub
10251025

10261026

10271027
--
1028-
-- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
1028+
-- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
10291029
--
10301030

10311031
CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
10321032

10331033

10341034
--
1035-
-- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
1035+
-- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
10361036
--
10371037

10381038
CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
10391039

10401040

10411041
--
1042-
-- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
1042+
-- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
10431043
--
10441044

10451045
CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
10461046

10471047

10481048
--
1049-
-- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
1049+
-- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
10501050
--
10511051

10521052
CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
@@ -1364,6 +1364,7 @@ INSERT INTO "schema_migrations" (version) VALUES
13641364
('20210424174640'),
13651365
('20210502160343'),
13661366
('20210503201944'),
1367-
('20221016192111');
1367+
('20221016192111'),
1368+
('20230312231058');
13681369

13691370

spec/spec_helper.rb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
require 'simplecov'
2-
SimpleCov.start 'rails'
3-
41
ENV["RAILS_ENV"] ||= 'test'
52
ENV["ADMINS"] = "admin@timeoverflow.org"
63

4+
require 'simplecov'
5+
6+
SimpleCov.formatter = if ENV["CI"]
7+
require "simplecov_json_formatter"
8+
SimpleCov::Formatter::JSONFormatter
9+
else
10+
SimpleCov::Formatter::HTMLFormatter
11+
end
12+
SimpleCov.start 'rails'
13+
714
require File.expand_path("../../config/environment", __FILE__)
815
require 'rspec/rails'
916
require 'capybara/rails'

0 commit comments

Comments
 (0)