Skip to content

Commit

Permalink
Pull in earlier config files
Browse files Browse the repository at this point in the history
This pulls a few select config files files from commit
40313a8 which should be the last commit
before a new Rails app was initialized
  • Loading branch information
h-m-m committed May 21, 2024
1 parent 1ddd669 commit 58e3060
Show file tree
Hide file tree
Showing 10 changed files with 278 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
*Before filing the ticket you should replace all text between the horizontal rules with your own words. We recommend keeping the headings (optional headings can be left off if you don't need them)*

--------

# Summary

Describe an overview of the problem. Provide a general description of the problem it's solving or why this issue should be addressed.

## Things to Consider
> **OPTIONAL** If you happen to know that this particular issue will touch other parts of the application in non-obvious ways (maybe there are side effects, or there are other parts of the application that depend on the thing that needs to be changed), you can list them out here. This is an opportunity to share *domain knowledge* that you might have about the problemset.
# Criteria for Completion
> This should be a bulleted list of items that, if satisfied, would result in an acceptably complete Pull Request. Be as specific as you need to be. For example:
- [ ] When a user clicks on {this} it should now do {that}
- [ ] This feature should only be available to admins
- [ ] Add a test proving that it works

-------

The goal here is to minimize the amount of clarification that a user needs in order to get started on the work, as well as reducing the likelihood that a lengthy PR discsussion about the scope of work ensues. This whole project is volunteer-driven, on both sides, so we want to communicate expectations and needs as clearly as possible up front.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "bundler" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
49 changes: 49 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This workflow uses actions that are not certified by GitHub. They are
# provided by a third-party and are governed by separate terms of service,
# privacy policy, and support documentation.
#
# This workflow will install a prebuilt Ruby version, install dependencies, and
# run tests and linters.
---
name: "Ruby on Rails CI"

on:
push:
branches: ['main']
pull_request:
types: ['opened', 'reopened', 'synchronize', 'unlocked']

jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
ports:
- "5432:5432"
env:
POSTGRES_DB: sif
POSTGRES_USER: sif
POSTGRES_PASSWORD: password
redis:
image: redis:7.0

env:
RAILS_ENV: test
DATABASE_URL: "postgres://sif:password@localhost:5432/sif"
REDIS_URL: "redis://localhost:6379/1"
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Ruby and gems
uses: ruby/[email protected]
with:
ruby-version: '3.2.2'
bundler-cache: true

- name: Set up database schema
run: bin/rails db:schema:load

- name: Run tests
run: bin/rake
31 changes: 31 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Ensure Docker container for Ruby can build successfully

on:
push:
branches: ['main']
pull_request:
types: ['opened', 'reopened', 'synchronize', 'unlocked']

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build Images
working-directory: ./
run: |
docker compose build
- name: Run containers
working-directory: ./
run: |
docker compose up --wait
- name: Curl web page
working-directory: ./
run: |
curl -X GET http://localhost:3000
21 changes: 21 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: "Lint"

on:
push:
branches: ['main']
pull_request:
types: ['opened', 'reopened', 'synchronize', 'unlocked']

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ruby/[email protected]
with:
ruby-version: '3.2.2'
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Lint Ruby files
run: bundle exec standardrb
24 changes: 24 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: "Security"

on:
push:
branches: ['main']
pull_request:
types: ['opened', 'reopened', 'synchronize', 'unlocked']

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ruby/[email protected]
with:
ruby-version: '3.2.2'
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Security audit dependencies
run: bundle exec bundler-audit check --update

- name: Security audit application code
run: bundle exec brakeman -q -w2
41 changes: 41 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## Contributing

We ♥ contributors! By participating in this project, you agree to abide by the Ruby for Good [code of conduct].

**First:** if you're unsure or afraid of *anything*, just ask or submit the issue or pull request anyways. You won't be yelled at for giving your best effort. The worst that can happen is that you'll be politely asked to change something. We appreciate any sort of contributions, and don't want a wall of rules to get in the way of that.

[code of conduct]: https://github.com/rubyforgood/stocks-in-the-future/blob/main/code-of-conduct.md

Here are the basic steps to submit a pull request. Make sure that you're working on an [open issue]. If the relevant issue doesn't exist, open it!

[open issue]: https://github.com/rubyforgood/stocks-in-the-future/issues

1. Claim an issue on [our issue tracker][open issue] by assigning it to yourself (core team member) or commenting. If the issue doesn't exist yet, open it.

2. Fork the repo.

3. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate:
```
# start application
docker compose up
# run tests
docker compose run --rm stocks rspec
```

4. Add a test for your change. If you are adding functionality or fixing a bug, you should add a test!

5. Make the test pass.

6. Push to your fork and submit a pull request. Read through the PR template, address the checklist, description, type of change, and add screenshots.

7. For any changes, please create a feature branch and open a PR for it. Even if there's no real disagreement about a PR, at least one other person on the team needs to look over a PR before merging. The purpose of this review requirement is to ensure shared knowledge of the app and its changes and to take advantage of the benefits of working together changes without any single person being a bottleneck to making progress.

At this point you're waiting on us. We'll try to respond to your PR quickly and suggest changes or alternatives if appropriate.

Some things that will increase the chance that your pull request is accepted:

* Be complete and descriptive in your PR summary
* Use conventions found within the codebase
* Include tests that fail without your code, and pass with it
* Clean up your commits such that each commit contains working, discreet bodies of work
* Update the documentation, the surrounding one, examples elsewhere, guides, whatever is affected by your contribution
16 changes: 16 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# syntax = docker/dockerfile:1

# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.2.2
FROM ruby:$RUBY_VERSION-slim as base

# Rails app lives here
WORKDIR /rails

# Install packages needed to build gems
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential libpq-dev curl

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["./bin/rails", "console"]
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright (c) 2023 Ruby for Good

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
55 changes: 55 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
version: "3.9"
services:
redis:
image: redis:7.0
ports:
- 6379
healthcheck:
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
volumes:
- redis:/data

db:
image: postgres:15
restart: always
environment:
PGUSER: sif
POSTGRES_USER: sif
POSTGRES_PASSWORD: password
POSTGRES_DB: sif
ports:
- 5432
healthcheck:
test: ["CMD-SHELL", "pg_isready", "--database", "stocks_in_the_future_development" ]
interval: 10s
volumes:
- postgres:/var/lib/postgresql/data

stocks:
build:
dockerfile: Dockerfile.dev
context: .
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:${APP_PORT:-3000}"]
command: "bin/docker-entrypoint bin/rails server -b 0.0.0.0 -p ${APP_PORT:-3000}"
entrypoint: bin/docker-entrypoint
ports:
- "${APP_PORT:-3000}:${APP_PORT:-3000}"
volumes:
- .:/rails
- bundler:/usr/local/bundle

environment:
RAILS_ENV: development
DATABASE_URL: postgresql://sif:password@db/

volumes:
redis:
postgres:
bundler:

0 comments on commit 58e3060

Please sign in to comment.