Skip to content

TravisCI -> GH Actions #648

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

Merged
merged 19 commits into from
Mar 14, 2023
Merged
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
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:9.4
ports: ["5432:5432"]
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: timeoverflow_test
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run tests
env:
RAILS_ENV: test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
run: |
bundle exec rails db:setup
bundle exec rspec
- name: Publish code coverage
uses: paambaati/codeclimate-action@v3.2.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: ${{ github.workspace }}/coverage/coverage.json:simplecov
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

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

gem 'rails', '~> 6.1.1'
gem 'rails-i18n', '~> 6.0.0'
Expand All @@ -10,7 +10,7 @@ gem 'activeadmin', '~> 2.9.0'
gem 'bootsnap', '~> 1.12.0', require: false
gem 'has_scope', '~> 0.7.2'
gem 'pundit', '~> 2.1.0'
gem 'pg', '~> 1.2.1'
gem 'pg', '~> 1.4'
gem 'json_translate', '~> 4.0.0'
gem 'devise', '~> 4.7.1'
gem 'http_accept_language', '~> 2.1.1'
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ GEM
parser (3.0.1.1)
ast (~> 2.4.1)
pdf-core (0.9.0)
pg (1.2.3)
pg (1.4.6)
pg_search (2.3.5)
activerecord (>= 5.2)
activesupport (>= 5.2)
Expand Down Expand Up @@ -450,7 +450,7 @@ DEPENDENCIES
letter_opener (~> 1.7.0)
listen (~> 3.2.0)
localeapp (~> 3.1)
pg (~> 1.2.1)
pg (~> 1.4)
pg_search (~> 2.3.5)
prawn (~> 2.4.0)
prawn-table (~> 0.2.2)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TimeOverflow
[![View performance data on Skylight](https://badges.skylight.io/problem/grDTNuzZRnyu.svg)](https://oss.skylight.io/app/applications/grDTNuzZRnyu)
[![Build Status](https://travis-ci.com/coopdevs/timeoverflow.svg?branch=develop)](https://travis-ci.com/coopdevs/timeoverflow)
[![Build Status](https://github.com/coopdevs/timeoverflow/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/coopdevs/timeoverflow/actions)
[![Maintainability](https://api.codeclimate.com/v1/badges/f82c6d98a2441c84f2ef/maintainability)](https://codeclimate.com/github/coopdevs/timeoverflow/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/f82c6d98a2441c84f2ef/test_coverage)](https://codeclimate.com/github/coopdevs/timeoverflow/test_coverage)

Expand Down
24 changes: 8 additions & 16 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
# If you want to change this file, please keep the changes in your working
# copy by using
#
# git update-index --skip-worktree config/database.yml
#
# or just use DATABASE_URL, in which case Rails will happily skip the whole
# file.
#
# See https://github.com/coopdevs/timeoverflow/wiki/Keeping-your-local-files
# for more information
#

defaults: &defaults
adapter: postgresql
username: <%= ENV['DATABASE_USER'] %> # default is null
collation: 'es_ES.UTF-8'
ctype: 'es_ES.UTF-8'
username: <%= ENV['DATABASE_USER'] || ENV["POSTGRES_USER"] %>
template: 'template0'
encoding: 'UTF8'

Expand All @@ -24,12 +10,18 @@ development:

test:
<<: *defaults
database: 'timeoverflow_test'
database: timeoverflow_test
host: localhost
password: <%= ENV['DATABASE_PASSWORD'] || ENV["POSTGRES_PASSWORD"] %>

staging:
<<: *defaults
collation: 'es_ES.UTF-8'
ctype: 'es_ES.UTF-8'
database: <%= ENV.fetch('DATABASE_NAME', 'timeoverflow_staging') %>

production:
<<: *defaults
collation: 'es_ES.UTF-8'
ctype: 'es_ES.UTF-8'
database: <%= ENV.fetch('DATABASE_NAME', 'timeoverflow_production') %>
15 changes: 15 additions & 0 deletions db/migrate/20230312231058_migrate_hstore_to_json.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class MigrateHstoreToJson < ActiveRecord::Migration[6.1]
def up
rename_column :categories, :name_translations, :name_translations_hstore
add_column :categories, :name_translations, :jsonb, default: {}, null: false, index: { using: 'gin' }
execute 'UPDATE "categories" SET "name_translations" = json_object(hstore_to_matrix("name_translations_hstore"))::jsonb'
remove_column :categories, :name_translations_hstore
end

def down
rename_column :categories, :name_translations, :name_translations_jsonb
add_column :categories, :name_translations, :hstore, default: {}, null: false
execute 'UPDATE "categories" SET "name_translations" = (SELECT hstore(key, value) FROM jsonb_each_text("name_translations_jsonb"))'
remove_column :categories, :name_translations_jsonb
end
end
29 changes: 15 additions & 14 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ ALTER SEQUENCE public.active_admin_comments_id_seq OWNED BY public.active_admin_


--
-- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
-- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.active_storage_attachments (
Expand Down Expand Up @@ -191,7 +191,7 @@ ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_s


--
-- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
-- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.active_storage_blobs (
Expand Down Expand Up @@ -227,7 +227,7 @@ ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage


--
-- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: -
-- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.active_storage_variant_records (
Expand Down Expand Up @@ -257,7 +257,7 @@ ALTER SEQUENCE public.active_storage_variant_records_id_seq OWNED BY public.acti


--
-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.ar_internal_metadata (
Expand All @@ -276,7 +276,7 @@ CREATE TABLE public.categories (
id integer NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
name_translations public.hstore
name_translations jsonb DEFAULT '{}'::jsonb NOT NULL
);


Expand Down Expand Up @@ -822,31 +822,31 @@ ALTER TABLE ONLY public.active_admin_comments


--
-- Name: active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
-- Name: active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

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


--
-- Name: active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
-- Name: active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

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


--
-- Name: active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
-- Name: active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

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


--
-- Name: ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
-- Name: ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.ar_internal_metadata
Expand Down Expand Up @@ -977,28 +977,28 @@ CREATE INDEX index_active_admin_comments_on_resource_type_and_resource_id ON pub


--
-- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
-- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
--

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


--
-- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
-- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
--

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


--
-- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
-- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
--

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


--
-- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
-- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
--

CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
Expand Down Expand Up @@ -1285,6 +1285,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20210423193937'),
('20210424174640'),
('20210502160343'),
('20210503201944');
('20210503201944'),
('20230312231058');


13 changes: 10 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
require 'simplecov'
SimpleCov.start 'rails'

ENV["RAILS_ENV"] ||= 'test'
ENV["ADMINS"] = "admin@timeoverflow.org"

require 'simplecov'

SimpleCov.formatter = if ENV["CI"]
require "simplecov_json_formatter"
SimpleCov::Formatter::JSONFormatter
else
SimpleCov::Formatter::HTMLFormatter
end
SimpleCov.start 'rails'

require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'capybara/rails'
Expand Down