Skip to content

Commit

Permalink
Move from travis to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
compwron committed Nov 9, 2020
1 parent 4b7c3ac commit dc96d3f
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 118 deletions.
1 change: 0 additions & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

ruby:
- "**/*.rb"
- "Gemfile*"

javascript:
- "**/*.js"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See ../labeler.yml for mapping of files and labels
# See https://github.com/actions/labeler for more details on the action

name: "Pull Request Labeler"
name: filetype labeler
on:
- pull_request_target

Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: standardrb lint

on: [push]

jobs:
lint:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.1

- name: install dependencies
run: |
bundle install
- name: lint
run: bundle exec standardrb
87 changes: 87 additions & 0 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: rspec and cypress

on: [push]

jobs:
test:

runs-on: ubuntu-latest

services:
db:
image: postgres:12.3
env:
POSTGRES_PASSWORD: password
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.1

- name: Install PostgreSQL client
run: |
sudo apt-get -yqq install libpq-dev
- name: Build App
env:
POSTGRES_HOST: localhost
DATABASE_HOST: localhost
POSTGRES_USER: postgres
CASA_DATABASE_PASSWORD: password
POSTGRES_PASSWORD: password
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_PORT: 5432
run: |
bundle install
skylight disable_dev_warning
yarn
bundle exec rake db:create
bundle exec rake db:schema:load
bundle exec rails webpacker:compile
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: Run rspec
env:
POSTGRES_HOST: localhost
DATABASE_HOST: localhost
POSTGRES_USER: postgres
CASA_DATABASE_PASSWORD: password
POSTGRES_PASSWORD: password
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_PORT: 5432
PGHOST: localhost
PGUSER: postgres
RAILS_ENV: test
run: |
RUBYOPT='-W:no-deprecated -W:no-experimental' bundle exec rspec
- name: Run cypress
env:
POSTGRES_HOST: localhost
DATABASE_HOST: localhost
POSTGRES_USER: postgres
CASA_DATABASE_PASSWORD: password
POSTGRES_PASSWORD: password
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_PORT: 5432
run: |
RUBYOPT='-W:no-deprecated -W:no-experimental' bundle exec rspec
RAILS_ENV=test bundle exec rails server -b 0.0.0.0 -p 4040 -d
RAILS_ENV=test bundle exec rake db:migrate
RAILS_ENV=test bundle exec rake db:seed
npm run test:cypress
kill $(jobs -p) || true
./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
23 changes: 23 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: brakeman

on: [push]

jobs:
brakeman:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.1

- name: install dependencies
run: |
bundle install
- name: brakeman
run: bundle exec brakeman
48 changes: 0 additions & 48 deletions .travis.yml

This file was deleted.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# CASA Project & Organization Overview

[![Build Status](https://travis-ci.org/rubyforgood/casa.svg?branch=main)](https://travis-ci.org/rubyforgood/casa)
![CI](https://github.com/rubyforgood/casa/workflows/rspec%20and%20cypress/badge.svg)
![lint](https://github.com/rubyforgood/casa/workflows/standardrb%20lint/badge.svg)
[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=rubyforgood/casa)](https://dependabot.com)
[![Maintainability](https://api.codeclimate.com/v1/badges/24f3bb10db6afac417e2/maintainability)](https://codeclimate.com/github/rubyforgood/casa/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/24f3bb10db6afac417e2/test_coverage)](https://codeclimate.com/github/rubyforgood/casa/test_coverage)
Expand Down Expand Up @@ -120,7 +121,7 @@ Test coverage is run by simplecov on all builds and aggregated by CodeClimate
1. `bundle exec erblint --lint-all --autocorrect` [ERB linter](https://github.com/Shopify/erb-lint)
1. `yarn lint:fix` to run the [JS linter](https://standardjs.com/index.html) and fix isses

If you have any troubles running tests, check out `.travis.yml` which is what makes the CI build run.
If you have any troubles running tests, check out the files in `.github/workflow/` which is what makes the CI build run.

**Local email**

Expand Down
67 changes: 1 addition & 66 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -1,85 +1,20 @@
# 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
username: <%= ENV.fetch("POSTGRES_USER") { } %>
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
password: password

development:
<<: *default
database: casa_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 that initialized the database.
#username: casa

# 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: <%= ENV.fetch("DATABASE_HOST") { } %>

# 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
database: casa_test
host: <%= ENV.fetch("DATABASE_HOST") { } %>

# 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 as a unix environment variable when you boot
# the app. Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
# for a full rundown on how to provide these environment variables in a
# production deployment.
#
# On Heroku and other platform providers, you may have a full connection URL
# available as an environment variable. For example:
#
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
#
# You can use this database configuration with:
#
# production:
# url: <%= ENV['DATABASE_URL'] %>
#
production:
<<: *default
database: casa_production
Expand Down

0 comments on commit dc96d3f

Please sign in to comment.