Skip to content

Commit

Permalink
Migrate to Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
palkan committed Jul 10, 2020
1 parent 779ad84 commit c6e412a
Show file tree
Hide file tree
Showing 14 changed files with 191 additions and 67 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/docs-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Lint Docs

on:
push:
branches:
- master
paths:
- "*.md"
- "**/*.md"
pull_request:
paths:
- "*.md"
- "**/*.md"

jobs:
markdownlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Run Markdown linter
run: |
gem install mdl
mdl *.md
rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Lint Markdown files with RuboCop
run: |
gem install bundler
bundle install --gemfile gemfiles/rubocop.gemfile --jobs 4 --retry 3
bundle exec --gemfile gemfiles/rubocop.gemfile rubocop -c .rubocop-md.yml
forspell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Hunspell
run: |
sudo apt-get install hunspell
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Cache installed gems
uses: actions/cache@v1
with:
path: /home/runner/.rubies/ruby-2.7.0/lib/ruby/gems/2.7.0
key: gems-cache-${{ runner.os }}
- name: Install Forspell
run: gem install forspell
- name: Run Forspell
run: forspell *.md
liche:
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.13.x
- name: Run liche
run: |
export PATH=$PATH:$(go env GOPATH)/bin
go get -u github.com/raviqqe/liche
liche README.md CHANGELOG.md
74 changes: 74 additions & 0 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build

on:
push:
branches:
- master
pull_request:

jobs:
rspec:
runs-on: ubuntu-latest
env:
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
CI: true
RAILS_ENV: test
LOGIDZE_DB_URL: postgres://postgres:postgres@localhost:5432
strategy:
fail-fast: false
matrix:
ruby: ["2.7"]
postgres: ["12"]
gemfile: [
"gemfiles/rails6.gemfile"
]
include:
- ruby: "2.7"
postgres: "13"
gemfile: "gemfiles/railsmaster.gemfile"
- ruby: "2.6"
postgres: "9.6"
gemfile: "gemfiles/rails6.gemfile"
- ruby: "2.6"
postgres: "10"
gemfile: "gemfiles/rails52.gemfile"
services:
postgres:
image: postgres:${{ matrix.postgres }}
ports: ["5432:5432"]
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: /home/runner/bundle
key: bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles(matrix.gemfile) }}-${{ hashFiles('**/*.gemspec') }}
restore-keys: |
bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-
- name: Install system deps
run: |
sudo apt-get update
sudo apt-get -yqq install libpq-dev
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Bundle install
run: |
bundle config path /home/runner/bundle
bundle config --global gemfile ${{ matrix.gemfile }}
bundle install
bundle update
- name: Prepare test database
run: |
bundle exec rake dummy:db:create
bundle exec rake dummy:db:migrate
- name: Run RSpec
run: |
bundle exec rspec --color -f p --format RSpec::Github::Formatter
21 changes: 21 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Lint Ruby

on:
push:
branches:
- master
pull_request:

jobs:
rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Lint Ruby code with RuboCop
run: |
gem install bundler
bundle install --gemfile gemfiles/rubocop.gemfile --jobs 4 --retry 3
bundle exec --gemfile gemfiles/rubocop.gemfile rubocop
46 changes: 0 additions & 46 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ gemspec

gem "pry-byebug", platform: :mri

eval_gemfile "gemfiles/rubocop.gemfile"

local_gemfile = "#{File.dirname(__FILE__)}/Gemfile.local"

if File.exist?(local_gemfile)
Expand Down
9 changes: 7 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# frozen_string_literal: true

require "rspec/core/rake_task"
require "rubocop/rake_task"

RuboCop::RakeTask.new
begin
require "rubocop/rake_task"
RuboCop::RakeTask.new
rescue LoadError
task(:rubocop) {}
end

RSpec::Core::RakeTask.new(:spec)

namespace :dummy do
Expand Down
6 changes: 0 additions & 6 deletions gemfiles/rails42.gemfile

This file was deleted.

6 changes: 0 additions & 6 deletions gemfiles/rails5.gemfile

This file was deleted.

4 changes: 3 additions & 1 deletion gemfiles/rails52.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ source 'https://rubygems.org'
gem 'rails', '~> 5.2.1'
gem 'rspec-rails', '~> 3.5'

gemspec path: '..'
eval_gemfile './shared.gemfile'

gemspec path: '..'
4 changes: 3 additions & 1 deletion gemfiles/rails6.gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
source 'https://rubygems.org'

gem 'rails', '~> 6.0'
gem 'rspec-rails', '>= 3.5'
gem 'rspec-rails', '>= 4.0'

eval_gemfile './shared.gemfile'

gemspec path: '..'
7 changes: 4 additions & 3 deletions gemfiles/railsmaster.gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
source 'https://rubygems.org'

gem 'arel', github: 'rails/arel'
gem 'rails', github: 'rails/rails'
gem 'rspec-rails', '>= 3.5'
gem 'rspec-rails', '>= 4.0'

gemspec path: '..'
eval_gemfile './shared.gemfile'

gemspec path: '..'
4 changes: 4 additions & 0 deletions gemfiles/rubocop.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source "https://rubygems.org" do
gem "rubocop-md", "~> 0.3"
gem "standard", "~> 0.3.0"
end
1 change: 1 addition & 0 deletions gemfiles/shared.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gem 'rspec-github', require: false
2 changes: 0 additions & 2 deletions logidze.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "pg", ">= 0.18"
spec.add_development_dependency "rake", ">= 13.0"
spec.add_development_dependency "rspec-rails", ">= 3.4"
spec.add_development_dependency "rubocop-md", "~> 0.3.0"
spec.add_development_dependency "standard", "~> 0.2.0"
spec.add_development_dependency "timecop", "~> 0.8"
end

0 comments on commit c6e412a

Please sign in to comment.