-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from malparty/chore/project-init
#1 Setup Rails template
- Loading branch information
Showing
169 changed files
with
11,815 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
defaults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.gitignore | ||
.semaphore | ||
.semaphore-cache | ||
log/ | ||
tmp/ | ||
!tmp/docker | ||
coverage/ | ||
node_modules/ | ||
docker-compose.dev.yml | ||
docker-compose.test.yml | ||
docker-compose.yml | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Editor Configurations | ||
# See: http://editorconfig.org | ||
|
||
# Top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
indent_size = 4 | ||
trim_trailing_whitespace = false | ||
|
||
[Makefile] | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
DOCKER_REGISTRY_HOST=docker.io | ||
DOCKER_IMAGE=nimblehq/google_search_ruby | ||
BRANCH_TAG=latest | ||
PORT=80 | ||
CI=false | ||
TEST_RETRY=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/node_modules/** | ||
/config/** | ||
/coverage/** | ||
/public/** | ||
/tmp/** | ||
/vendor/** | ||
|
||
postcss.config.js | ||
babel.config.js | ||
|
||
app/javascript/channels/* | ||
app/javascript/translations/translations.js | ||
|
||
engines/*/node_modules/** | ||
engines/*/vendor/** | ||
engines/*/app/javascript/*/translations/translations.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": [ | ||
"@nimblehq/eslint-config-nimble" | ||
], | ||
"globals": { | ||
"I18n": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
**/db/**/*.rb | ||
**/spec/**/*_spec.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# See https://git-scm.com/docs/gitattributes for more about git attribute files. | ||
|
||
# Mark the database schema as having been generated. | ||
db/schema.rb linguist-generated | ||
|
||
# Mark the yarn lockfile as having been generated. | ||
yarn.lock linguist-generated | ||
|
||
# Mark any vendored files as having been vendored. | ||
vendor/* linguist-vendored |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Add the story URL here. Prefer the short link format, e.g. https://app.clubhouse.io/acme/story/1234/ | ||
|
||
## What happened | ||
|
||
Describe the big picture of your changes here to communicate to the team why we should accept this pull request. | ||
|
||
## Insight | ||
|
||
Describe in detail how to test the changes. Referenced documentation is welcome as well. | ||
|
||
## Proof Of Work | ||
|
||
Show us the implementation: screenshots, gif, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Github Actions | ||
|
||
## Requirements: | ||
|
||
- Generate new token on docker registry, support `docker.io`, `ghcr.io`, `azurecr.io`, `gcr.io`, `registry.gitlab.com` | ||
- Generate new Heroku API key | ||
|
||
## Setup the CI | ||
|
||
### Secrets | ||
|
||
Depending on the workflow used in the project, set up the following secrets: | ||
|
||
- DOCKER_REGISTRY_HOST | ||
- DOCKER_REGISTRY_TOKEN | ||
- DOCKER_REGISTRY_USERNAME (Default: ${{ github.repository_owner }}) | ||
- DOCKER_IMAGE (Default: ${{ github. repository }}) | ||
- HEROKU_API_KEY (for deployment) | ||
- DANGER_GITHUB_API_TOKEN (Default: ${{ github.token }}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Deploy Heroku | ||
|
||
on: | ||
workflow_run: | ||
workflows: | ||
- Test | ||
branches: | ||
- master | ||
- main | ||
- development | ||
types: | ||
- completed | ||
workflow_dispatch: | ||
|
||
env: | ||
DOCKER_REGISTRY_HOST: ${{ secrets.DOCKER_REGISTRY_HOST }} | ||
DOCKER_REGISTRY_USERNAME: ${{ github.repository_owner }} | ||
DOCKER_REGISTRY_TOKEN: ${{ secrets.DOCKER_REGISTRY_TOKEN }} | ||
DOCKER_IMAGE: ${{ github.repository }} | ||
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} | ||
steps: | ||
- name: Cancel previous runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- uses: actions/[email protected] | ||
with: | ||
ref: ${{ github.event.workflow_run.head_branch || github.ref }} | ||
|
||
- name: Set env BRANCH_TAG | ||
uses: nimblehq/[email protected] | ||
with: | ||
ref: ${{ github.event.workflow_run.head_branch || github.ref }} | ||
|
||
- name: Set env HEROKU_APP | ||
run: | | ||
if [[ $BRANCH_TAG = "latest" ]] | ||
then | ||
echo "HEROKU_APP=google_search_ruby" >> $GITHUB_ENV | ||
else | ||
echo "HEROKU_APP=google_search_ruby-staging" >> $GITHUB_ENV | ||
fi | ||
- name: Login to Docker registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.DOCKER_REGISTRY_HOST }} | ||
username: ${{ env.DOCKER_REGISTRY_USERNAME }} | ||
password: ${{ env.DOCKER_REGISTRY_TOKEN }} | ||
|
||
- name: Build Docker image | ||
run: bin/docker-prepare && docker-compose build | ||
|
||
- name: Push Docker image | ||
run: docker-compose push web | ||
|
||
- name: Login to Heroku | ||
run: heroku container:login | ||
|
||
- name: Push images to Heroku | ||
run: heroku container:push --arg DOCKER_REGISTRY_HOST=$DOCKER_REGISTRY_HOST,DOCKER_IMAGE=$DOCKER_IMAGE,BRANCH_TAG=$BRANCH_TAG --recursive | ||
|
||
- name: Release | ||
run: heroku container:release web worker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Review code | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
env: | ||
DANGER_GITHUB_API_TOKEN: ${{ github.token }} | ||
|
||
jobs: | ||
automated_code_review: | ||
name: Run Danger | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
bundler-cache: true | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14.17.0' | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
||
- name: Cache Yarn | ||
uses: actions/cache@v2 | ||
id: yarn-cache | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Cache Node modules | ||
id: node-modules-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-nodemodules-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-nodemodules- | ||
- name: Yarn install | ||
if: steps.yarn-cache.outputs.cache-hit != 'true' || steps.node-modules-cache.outputs.cache-hit != 'true' | ||
run: yarn | ||
|
||
- name: Run Danger | ||
run: bundle exec danger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
name: Test | ||
|
||
on: push | ||
|
||
env: | ||
DOCKER_REGISTRY_HOST: ${{ secrets.DOCKER_REGISTRY_HOST }} | ||
DOCKER_REGISTRY_USERNAME: ${{ github.repository_owner }} | ||
DOCKER_REGISTRY_TOKEN: ${{ secrets.DOCKER_REGISTRY_TOKEN }} | ||
DOCKER_IMAGE: ${{ github.repository }} | ||
|
||
# Set the default docker-compose file | ||
COMPOSE_FILE: docker-compose.test.yml | ||
|
||
jobs: | ||
build: | ||
name: Build Docker image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cancel previous runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- uses: actions/[email protected] | ||
|
||
- name: Set env BRANCH_TAG | ||
uses: nimblehq/[email protected] | ||
|
||
- name: Login to Docker registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.DOCKER_REGISTRY_HOST }} | ||
username: ${{ env.DOCKER_REGISTRY_USERNAME }} | ||
password: ${{ env.DOCKER_REGISTRY_TOKEN }} | ||
|
||
- name: Pull Docker image | ||
if: ${{ env.BRANCH_TAG != 'latest' && env.BRANCH_TAG != 'development' }} | ||
run: docker-compose pull test || true | ||
|
||
- name: Build Docker image | ||
run: bin/docker-prepare && docker-compose build | ||
|
||
- name: Push Docker image | ||
run: docker-compose push test | ||
|
||
unit_tests: | ||
name: Unit tests | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Set env BRANCH_TAG | ||
uses: nimblehq/[email protected] | ||
|
||
- name: Login to Docker registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.DOCKER_REGISTRY_HOST }} | ||
username: ${{ env.DOCKER_REGISTRY_USERNAME }} | ||
password: ${{ env.DOCKER_REGISTRY_TOKEN }} | ||
|
||
- name: Pull Docker image | ||
run: docker-compose pull test || true | ||
|
||
- name: Run unit tests | ||
run: docker-compose run test bundle exec rspec --exclude-pattern "spec/systems/**/*_spec.rb" --profile | ||
|
||
system_tests: | ||
name: System tests | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Set env BRANCH_TAG | ||
uses: nimblehq/[email protected] | ||
|
||
- name: Login to Docker registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.DOCKER_REGISTRY_HOST }} | ||
username: ${{ env.DOCKER_REGISTRY_USERNAME }} | ||
password: ${{ env.DOCKER_REGISTRY_TOKEN }} | ||
|
||
- name: Pull Docker image | ||
run: docker-compose pull test || true | ||
|
||
- name: Run system tests | ||
run: docker-compose run test bundle exec rspec spec/systems --profile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Test production build | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- master | ||
- main | ||
- development | ||
|
||
env: | ||
DOCKER_REGISTRY_HOST: ${{ secrets.DOCKER_REGISTRY_HOST }} | ||
DOCKER_IMAGE: ${{ github.repository }} | ||
|
||
jobs: | ||
docker_production_build_test: | ||
name: Build Docker production image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cancel previous runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- uses: actions/[email protected] | ||
|
||
- name: Set env BRANCH_TAG | ||
uses: nimblehq/[email protected] | ||
|
||
- name: Build Docker image | ||
run: bin/docker-prepare && docker-compose build |
Oops, something went wrong.