Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: EdmondFrank <[email protected]>
  • Loading branch information
EdmondFrank committed Jul 14, 2022
0 parents commit 5564647
Show file tree
Hide file tree
Showing 168 changed files with 7,234 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2
41 changes: 41 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

# export RAILS_ENV=development

## Host
export DEFAULT_HOST=git.zhbit.com

## Puma
# export PORT=3000
# export PIDFILE=tmp/pids/server.pid
## Workers and threads count
# export WEB_CONCURRENCY=2
# export RAILS_MAX_THREADS=5
# export RAILS_MIN_THREADS=5

## Mariadb
export MARIADB_PORT=3306
export MARIADB_USER=gitee-grimoirelab
export MARIADB_PASSWORD=123456
export MARIADB_DB=gitee-grimoirelab

## Redis URL
# export REDIS_URL=redis://redis:6379/1
# export REDIS_CHANNEL_PREFIX=gitee-grimoirelab

## Action cable
# export ACTION_CABLE_URL=ws://localhost:28080
# export ACTION_CABLE_ALLOWED_REQUEST_ORIGINS=http:\/\/localhost*
# Examples:
# http:\/\/localhost*
# http:\/\/example.*,https:\/\/example.*

## Sidekiq web
# export SIDEKIQ_WEB_USERNAME=sidekiq-web-dashboard
# export SIDEKIQ_WEB_PASSWORD=sidekiq-web-123

## Secret keys
# You can use `rake secret` command to generate a secret key
export DEVISE_JWT_SECRET_KEY=my-jwt-secret-key

# frontend config
VITE_API_URL=http://localhost:3000
25 changes: 25 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

## Host
export DEFAULT_HOST=localhost

## Mariadb
export MARIADB_HOST=localhost
export MARIADB_PORT=3306
export MARIADB_USER=root
export MARIADB_PASSWORD=root
export MARIADB_DB=gitee-grimoirelab_test

## Redis URL
# export REDIS_URL=redis://redis:6379/1
# export REDIS_CHANNEL_PREFIX=gitee-grimoirelab

## Action cable
# export ACTION_CABLE_URL=ws://localhost:28080
# export ACTION_CABLE_ALLOWED_REQUEST_ORIGINS=http:\/\/localhost*
# Examples:
# http:\/\/localhost*
# http:\/\/example.*,https:\/\/example.*

## Secret keys
# You can use `rake secret` command to generate a secret key
export DEVISE_JWT_SECRET_KEY=bad60161405df79d927357174573d3ef5f8e1086786e9102cdd39d490cab0d7307150d08f8fa9b3e2ef32031a61df7516c8b44a1c0456d8d98b3a32f17aa439
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
yarn.lock
node_modules/
public/vite
public/vite-dev
public/vite-test
vite.config.ts
40 changes: 40 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
extends: [
'plugin:vue/base',
'plugin:vue/vue3-essential',
'plugin:vue/vue3-strongly-recommended',
'plugin:vue/vue3-recommended',
'plugin:import/recommended',
'plugin:@typescript-eslint/recommended',
'@vue/eslint-config-typescript/recommended',
'@vue/eslint-config-prettier',
'prettier',
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'vue'],
rules: {
'vue/attributes-order': 'error',
'vue/order-in-components': 'error',
'vue/require-default-prop': 'error',
'vue/multi-word-component-names': 'off',
'import/order': 'error',
},
settings: {
'import/resolver': {
'eslint-import-resolver-custom-alias': {
alias: {
'@': './app/javascript',
},
extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue', '.d.ts'],
},
},
},
};
22 changes: 22 additions & 0 deletions .fasterer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
speedups:
rescue_vs_respond_to: true
module_eval: true
shuffle_first_vs_sample: true
for_loop_vs_each: true
each_with_index_vs_while: true
map_flatten_vs_flat_map: true
reverse_each_vs_reverse_each: true
select_first_vs_detect: true
sort_vs_sort_by: true
fetch_with_argument_vs_block: true
keys_each_vs_each_key: true
hash_merge_bang_vs_hash_brackets: true
block_vs_symbol_to_proc: true
proc_call_vs_yield: true
gsub_vs_tr: true
select_last_vs_reverse_detect: true
getter_vs_attr_reader: true
setter_vs_attr_writer: true

exclude_paths:
- 'config/**/*.rb'
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 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 any vendored files as having been vendored.
vendor/* linguist-vendored
89 changes: 89 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
linter:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.2 # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Install Yarn
run: |
npm install yarn
yarn --version
yarn install
- name: Prepare environment
run: |
bundle exec overcommit --sign
bundle exec overcommit --sign pre-commit
- name: Run all checks
run: SKIP=AuthorName,AuthorEmail bundle exec overcommit --run

rspec:
runs-on: ubuntu-latest
env:
RAILS_ENV: test
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options:
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: --entrypoint redis-server

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

- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.2 # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Install Yarn
run: |
npm install yarn
yarn --version
yarn install
- name: Create DB
run: |
bundle exec rails db:reset
- name: Run tests
run: bundle exec rspec
57 changes: 57 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep

# Ignore uploaded files in development.
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/
!/tmp/storage/.keep

/public/assets

# Ignore master key for decrypting credentials and more.
/config/master.key

/app/assets/builds/*
!/app/assets/builds/.keep

# Ignore SampleCov files
/coverage/*

# Ignore env files
.env*
!.env.example
!.env.test

# Vite Ruby
/public/vite
/public/vite-dev
/public/vite-test
node_modules
# Vite uses dotenv and suggests to ignore local-only env files. See
# https://vitejs.dev/guide/env-and-mode.html#env-files
*.local

# Ignore uncategorized files
.DS_Store
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
[ -n "$CI" ] && exit 0
. "$(dirname "$0")/_/husky.sh"

npm run lint-staged
54 changes: 54 additions & 0 deletions .overcommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Use this file to configure the Overcommit hooks you wish to use. This will
# extend the default configuration defined in:
# https://github.com/sds/overcommit/blob/master/config/default.yml

PreCommit:
ALL:
on_warn: fail

# Not required because it's not needed/sensible in a CI context.
AuthorEmail:
enabled: true
required: false

# Not required because it's not needed/sensible in a CI context.
AuthorName:
enabled: true
required: false

BundleCheck:
description: 'Check if local Gemfile.lock matches Gemfile when either changes.'
enabled: true

BundleAudit:
description: 'Checks for vulnerable versions of gems in Gemfile.lock.'
enabled: true
command: ['bundle', 'exec', 'bundle-audit']
flags: ['--update']

LicenseFinder:
enabled: true
command: ['bundle', 'exec', 'license_finder']

RuboCop:
enabled: true
command: ['bundle', 'exec', 'rubocop']

Fasterer:
enabled: true
command: ['bundle', 'exec', 'fasterer']

Brakeman:
enabled: true
command: ['brakeman']
flags: ['-A']

YarnAudit:
description: 'Checks for vulnerable versions of packages in yarn.lock.'
enabled: true
command: ['yarn', 'audit']

EsLint:
enabled: true
required_executable: './node_modules/.bin/eslint'
command: ['yarn', 'lint']
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
yarn.lock
node_modules/
public/vite
public/vite-dev
public/vite-test
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"trailingComma": "all",
"singleQuote": true,
"printWidth": 100
}
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require spec_helper
Loading

0 comments on commit 5564647

Please sign in to comment.