Skip to content

Commit

Permalink
Merge pull request #14 from indirect/github-actions
Browse files Browse the repository at this point in the history
Working CI via GitHub Actions
  • Loading branch information
indirect authored Jan 14, 2022
2 parents 377183d + 87c05f1 commit 5cca4e9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 113 deletions.
51 changes: 13 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,28 @@
name: CI
on: [push]

jobs:
linters:
name: Linters
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Run linters
run: |
bin/standardrb
- name: Run security checks
run: |
bin/bundler-audit --update
tests:
name: Tests
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11-alpine
ports:
- 5432:5432
env:
POSTGRES_USER: feedyour_email
POSTGRES_DB: feedyour_email_test
POSTGRES_PASSWORD: ""
ports: ["5432:5432"]
POSTGRES_USER: rails
POSTGRES_PASSWORD: password

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
- uses: actions/checkout@v1
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Setup test database
- name: Run RSpec
run: |
bin/rails db:schema:load
bin/rspec
env:
RAILS_ENV: test
PGHOST: localhost
PGUSER: feedyour_email
run: bin/rails db:setup

- name: Run tests
run: bin/rspec
PGUSER: rails
PGPASSWORD: password
6 changes: 6 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ guard :shell do
watch(%r{^config|lib/.*}) { `touch tmp/restart.txt` }
end

# Audit dependencies for security issues as they change
guard :shell do
watch("Gemfile.lock") { `bin/bundler-audit --update` }
end

# Run tests, then lint if tests pass
group :test_lint, halt_on_fail: true do
# Run tests automatically as related files change
guard :rspec, cmd: "bin/rspec", bundler_env: :inherit do
Expand Down
1 change: 1 addition & 0 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
//= link_tree ../../javascript .js
//= link_tree ../../../vendor/javascript .js
//= link_tree ../builds
//= link tailwind.css
2 changes: 1 addition & 1 deletion app/views/feeds/show.atom.builder
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
atom_feed do |feed|
atom_feed root_url: feed_posts_url(@feed) do |feed|
feed.title @feed.name
feed.updated @feed.posts.last&.updated_at || @feed.updated_at

Expand Down
75 changes: 1 addition & 74 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,13 @@
# PostgreSQL. Versions 9.3 and up are supported.
#
# Install the pg driver:
# gem install pg
# On macOS with Homebrew:
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
# On macOS with MacPorts:
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
# gem install pg
# Choose the win32 build.
# Install PostgreSQL and put its /bin directory on your path.
#
# Configure Using Gemfile
# gem "pg"
#
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see Rails configuration guide
# https://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>

development:
<<: *default
database: feedyour_email_development

# The specified database role being used to connect to postgres.
# To create additional roles in postgres see `$ createuser --help`.
# When left blank, postgres will use the default role. This is
# the same name as the operating system user running Rails.
#username: feedyour_email

# The password associated with the postgres role (username).
#password:

# Connect on a TCP socket. Omitted by default since the client uses a
# domain socket that doesn't need configuration. Windows does not have
# domain sockets, so uncomment these lines.
#host: localhost

# The TCP port the server listens on. Defaults to 5432.
# If your server runs on a different port number, change accordingly.
#port: 5432

# Schema search path. The server defaults to $user,public
#schema_search_path: myapp,sharedapp,public

# Minimum log levels, in increasing order:
# debug5, debug4, debug3, debug2, debug1,
# log, notice, warning, error, fatal, and panic
# Defaults to warning.
#min_messages: notice

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
host: localhost
database: feedyour_email_test

# As with config/credentials.yml, you never want to store sensitive information,
# like your database password, in your source code. If your source code is
# ever seen by anyone, they now have access to your database.
#
# Instead, provide the password or a full connection URL as an environment
# variable when you boot the app. For example:
#
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
#
# If the connection URL is provided in the special DATABASE_URL environment
# variable, Rails will automatically merge its configuration values on top of
# the values provided in this file. Alternatively, you can specify a connection
# URL environment variable explicitly:
#
# production:
# url: <%= ENV["MY_APP_DATABASE_URL"] %>
#
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
# for a full overview on how database connection configuration can be specified.
#
production:
<<: *default
database: feedyour_email_production
username: feedyour_email
password: <%= ENV["FEEDYOUR_EMAIL_DATABASE_PASSWORD"] %>

0 comments on commit 5cca4e9

Please sign in to comment.