Skip to content

Commit

Permalink
Add configuration to run CI on Github Actions (#597)
Browse files Browse the repository at this point in the history
* Add configuration to run CI on Github Actions.

* Remove obsolete references and configurations for Travis CI.
  • Loading branch information
anaulin authored Dec 6, 2021
1 parent 96161e3 commit 75c9485
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 39 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Ruby CI

on:
push:
branches:
- main
paths-ignore:
- 'docs/**'
- '*.md'
- 'bin/*'
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'
- '*.md'
- 'bin/*'

jobs:
rspec:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:13
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v1

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Bundle install
run: |
bundle install --jobs 4 --retry 3
- name: Setup CI database.yml
run: cp config/database.github-actions.yml config/database.yml

- name: Setup DB, Run tests
env:
RAILS_ENV: test
run: |
bundle exec rails db:create db:schema:load
bundle exec rspec
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

35 changes: 18 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ Anyone is welcome to make an issue or a pull request. We would *love* for first-

Most contributors are DU members who collaborate in an internal Slack channel, but we also welcome non-member contributors! To support that, we have a public mailing list. Feel free to ask any question, including basic git and Ruby questions etc :) https://groups.google.com/a/doubleunion.org/forum/#!forum/public-du-code

- [Development setup](#development-setup)
- [Steps to get set up to develop and run tests](#steps-to-get-set-up-to-develop-and-run-tests)
- [Steps to run arooo server locally](#steps-to-run-arooo-server-locally)
- [Docker setup (optional)](#docker-setup-optional)
- [Set up an application for local OAuth:](#set-up-an-application-for-local-oauth)
- [Common errors and gotchas](#common-errors-and-gotchas)
- [Linting](#linting)
- [Tests](#tests)
- [User states](#user-states)
- [Manually changing a user's state](#manually-changing-a-users-state)
- [Programmatic doorbell](#programmatic-doorbell)
- [Manual doorbell testing](#manual-doorbell-testing)
- [Contributing Guide](#contributing-guide)
- [Development setup](#development-setup)
- [Steps to get set up to develop and run tests](#steps-to-get-set-up-to-develop-and-run-tests)
- [Steps to run arooo server locally](#steps-to-run-arooo-server-locally)
- [Docker setup (optional)](#docker-setup-optional)
- [Set up an application for local OAuth:](#set-up-an-application-for-local-oauth)
- [Common errors and gotchas](#common-errors-and-gotchas)
- [Linting](#linting)
- [Tests](#tests)
- [User states](#user-states)
- [Manually changing a user's state](#manually-changing-a-users-state)
- [Programmatic doorbell](#programmatic-doorbell)
- [Manual doorbell testing](#manual-doorbell-testing)

## Development setup

Expand Down Expand Up @@ -60,9 +61,9 @@ $ cp config/application.example.yml config/application.yml
$ bundle exec rake db:test:prepare
```

If this step fails on Ubuntu, make sure that your postgres db is up and running
and that you only have one postgres instance up: try `sudo lsof -i:5432`.
You may need to use sudo to set your `/etc/postgresql/11/main/pg_hba.conf` file.
If this step fails on Ubuntu, make sure that your postgres db is up and running
and that you only have one postgres instance up: try `sudo lsof -i:5432`.
You may need to use sudo to set your `/etc/postgresql/11/main/pg_hba.conf` file.
IPv4 local connections should say `localhost` under ADDRESS and `trust` under METHOD.
9. Now you should be able to run tests locally, and they should all pass:
```
Expand Down Expand Up @@ -132,7 +133,7 @@ Tests, also known as specs, are great! Adding tests is a great pull request all

Run `rake db:test:prepare` after you pull or make any changes to the app, so make sure that your test database has the correct database schema

Make sure `bundle exec rake spec` passes before pushing your changes. (Our TravisCI integration will double-check before we merge code, so it's ok if you forget sometimes) :)
Make sure `bundle exec rake spec` passes before pushing your changes.

## User states

Expand Down Expand Up @@ -187,4 +188,4 @@ For exceptional cases (e.g. package delivery) that don't fit the "one door code
You can test the doorbell endpoints directly from a browser or using CURL. You can pass parameters to each endpoint direclty as query params. For example, to manually test the SMS endpoint:
```
http://localhost:3000/doorbell/sms?Body=123456
```
```
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Arooo - A Room Of One's Own <!-- omit in toc -->
[![Build Status](https://travis-ci.org/doubleunion/arooo.svg)](https://travis-ci.org/doubleunion/arooo)
[![Open Source Helpers](https://www.codetriage.com/doubleunion/arooo/badges/users.svg)](https://www.codetriage.com/doubleunion/arooo)

- [Welcome :rocket::rocket::rocket:✨✨](#welcome-rocketrocketrocket)
Expand Down Expand Up @@ -70,7 +69,7 @@ This section only pertains if you have heroku & deployment access. Only maintain
If you are a DU member, see https://docs.google.com/document/d/19LbIYB2RDy-17UXuQx6wLgKp2EdLdqj-pg1cm3EpSb8/edit for more information on getting permission.

Both `staging` and `production` Heroku environments are connected to this GitHub repo, making it possible to deploy directly through the Heroku UI. To deploy:
* Staging: Merge to `master`, and your code will be automatically deployed to `staging` as soon as Travis CI goes green.
* Staging: Merge to `master`, and your code will be automatically deployed to `staging` as soon as CI goes green.
* Production: Log into Heroku, and select the production Aroo app from your dashboard. Click on "Deploy", and scroll to the bottom. There will be a place to select a branch to deploy, and a button that you can click to deploy.

Database migrations will run automatically during the release process on Heroku. This is controlled by the `release` directive in our [Procfile](Procfile).
Expand All @@ -95,7 +94,7 @@ If you prefer to do deploys from the command line, here are the steps:
git pull --rebase origin master
```

1. If Travis CI tests are passing, push to the `staging` environment
1. If CI tests are passing, push to the `staging` environment

```
git checkout master
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
test:
adapter: postgresql
database: doubleunion_test
host: localhost
username: postgres
password: postgres

0 comments on commit 75c9485

Please sign in to comment.