Skip to content

Commit

Permalink
Rename test job to rspec in CI, add rake env:setup task, and update R…
Browse files Browse the repository at this point in the history
…EADME
  • Loading branch information
Grigore-George-Mihai committed Sep 12, 2024
1 parent 99f0934 commit be01dba
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .env.development.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Database
POSTGRES_USER=
POSTGRES_USER=postgres
POSTGRES_PASSWORD=

# ScoutApm
Expand Down
4 changes: 2 additions & 2 deletions .env.test.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Databse
POSTGRES_USER=
# Database
POSTGRES_USER=postgres
POSTGRES_PASSWORD=

# Redis
Expand Down
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: Grigore-George-Mihai

---

## Description
A brief description of the issue.

## Steps to Reproduce
1.
2.
3.

## Expected Behavior
What did you expect to happen?

## Actual Behavior
What actually happened?
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: Grigore-George-Mihai

---

## Description
A brief description of the feature you would like to see.

## Motivation
Why is this feature important or how does it improve the project?

## Proposed Solution
How do you think this feature should work?
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Lint code for consistent style
run: bin/rubocop -f github

test:
rspec:
runs-on: ubuntu-latest

services:
Expand Down Expand Up @@ -68,10 +68,15 @@ jobs:
ruby-version: .ruby-version
bundler-cache: true

- name: Install dependencies
run: bundle install

- name: Run migrations
run: bin/rails db:migrate RAILS_ENV=test

- name: Prepare database and run tests
run: bin/rails db:test:prepare && bundle exec rspec


- name: Keep screenshots from failed system tests
uses: actions/upload-artifact@v4
if: failure()
Expand Down
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,20 @@ git clone https://github.com/Grigore-George-Mihai/graphql_template

- Update the project name to reflect your application.
- Modify the [Scout APM](https://github.com/scoutapp/scout_apm_ruby) settings as needed, or remove them if application performance monitoring is not required.
- Rename `.env.development.template` to `.env.development` and `.env.test.template` to `.env.test`. Populate these files with the appropriate environment-specific variables.
- Run the following rake task to create your environment files:
```bash
rake env:setup
````
- After running the task, open the newly created .env.development and .env.test files to modify them with the appropriate environment-specific variables as needed.
- Create DB and seed:
```bash
rails db:create db:migrate db:seed
````
## Gems
### API Framework
-
- [GraphQL](https://github.com/rmosolgo/graphql-ruby): GraphQL implementation for Ruby, providing query execution and schema building tools.
### Pagination
- [Kaminari](https://github.com/kaminari/kaminari): A scope and engine-based pagination library for Rails, Sinatra, and other Ruby frameworks.
Expand Down Expand Up @@ -69,13 +77,14 @@ git clone https://github.com/Grigore-George-Mihai/graphql_template
## Rake Tasks
Run the following rake task to check for security risks in your application:
### Security Check
- Run the following rake task to check for security risks in your application:
```bash
rake security:check
```
```bash
rake security:check
```
This task runs tools like Brakeman and Bundler Audit to ensure your application is secure.
- This task runs tools like Brakeman and Bundler Audit to ensure your application is secure.
## Contact
For questions or further information, feel free to reach out via [LinkedIn](https://www.linkedin.com/in/grigore-george-mihai-73981b86/).
25 changes: 25 additions & 0 deletions lib/tasks/env.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

namespace :env do
desc "Create new .env files from .env.template files"
task setup: :environment do
development_template = ".env.development.template"
test_template = ".env.test.template"
development_file = ".env.development"
test_file = ".env.test"

if File.exist?(development_template)
File.write(development_file, File.read(development_template)) unless File.exist?(development_file)
puts "Created #{development_file} from #{development_template}"
else
puts "#{development_template} does not exist!"
end

if File.exist?(test_template)
File.write(test_file, File.read(test_template)) unless File.exist?(test_file)
puts "Created #{test_file} from #{test_template}"
else
puts "#{test_template} does not exist!"
end
end
end

0 comments on commit be01dba

Please sign in to comment.