-
Notifications
You must be signed in to change notification settings - Fork 119
Feature/teste flavio #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
flaviolpgjr
wants to merge
5
commits into
clicksign:main
Choose a base branch
from
flaviolpgjr:feature/teste-flavio
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feature/teste flavio #124
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
835c5a5
chore: setup inicial com Rails, Docker e PostgreSQL
flaviolpgjr 52e221e
feat: add active storage support for file content
flaviolpgjr 9963261
chore: finalize README, docker setup, specs and filesystem demo task
flaviolpgjr 9b21867
Fix readme
flaviolpgjr 248a070
Fix readme
flaviolpgjr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,42 @@ | ||
| # Git | ||
| .git | ||
| .gitignore | ||
|
|
||
| # Bundler | ||
| .bundle | ||
| vendor/bundle | ||
|
|
||
| # Environment | ||
| .env* | ||
| config/master.key | ||
| config/credentials/*.key | ||
|
|
||
| # Logs e temp | ||
| log/* | ||
| tmp/* | ||
| !log/.keep | ||
| !tmp/.keep | ||
|
|
||
| # PIDs | ||
| tmp/pids/* | ||
| !tmp/pids/.keep | ||
|
|
||
| # Node / assets | ||
| node_modules | ||
| app/assets/builds/* | ||
| !app/assets/builds/.keep | ||
| public/assets | ||
|
|
||
| # Storage | ||
| storage | ||
|
|
||
| # Coverage | ||
| coverage | ||
|
|
||
| # Dev / CI | ||
| .github | ||
| .devcontainer | ||
|
|
||
| # Kamal | ||
| config/deploy*.yml | ||
| .kamal |
This file contains hidden or 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,9 @@ | ||
| # 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 | ||
| config/credentials/*.yml.enc diff=rails_credentials | ||
| config/credentials.yml.enc diff=rails_credentials |
This file contains hidden or 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 @@ | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: bundler | ||
| directory: "/" | ||
| schedule: | ||
| interval: weekly | ||
| open-pull-requests-limit: 10 | ||
| - package-ecosystem: github-actions | ||
| directory: "/" | ||
| schedule: | ||
| interval: weekly | ||
| open-pull-requests-limit: 10 |
This file contains hidden or 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,52 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [ main ] | ||
|
|
||
| jobs: | ||
| scan_ruby: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Set up Ruby | ||
| uses: ruby/setup-ruby@v1 | ||
| with: | ||
| bundler-cache: true | ||
|
|
||
| - name: Scan for common Rails security vulnerabilities using static analysis | ||
| run: bin/brakeman --no-pager | ||
|
|
||
| - name: Scan for known security vulnerabilities in gems used | ||
| run: bin/bundler-audit | ||
|
|
||
| lint: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| RUBOCOP_CACHE_ROOT: tmp/rubocop | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Set up Ruby | ||
| uses: ruby/setup-ruby@v1 | ||
| with: | ||
| bundler-cache: true | ||
|
|
||
| - name: Prepare RuboCop cache | ||
| uses: actions/cache@v4 | ||
| env: | ||
| DEPENDENCIES_HASH: ${{ hashFiles('.ruby-version', '**/.rubocop.yml', '**/.rubocop_todo.yml', 'Gemfile.lock') }} | ||
| with: | ||
| path: ${{ env.RUBOCOP_CACHE_ROOT }} | ||
| key: rubocop-${{ runner.os }}-${{ env.DEPENDENCIES_HASH }}-${{ github.ref_name == github.event.repository.default_branch && github.run_id || 'default' }} | ||
| restore-keys: | | ||
| rubocop-${{ runner.os }}-${{ env.DEPENDENCIES_HASH }}- | ||
|
|
||
| - name: Lint code for consistent style | ||
| run: bin/rubocop -f github | ||
|
|
||
This file contains hidden or 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,31 @@ | ||
| # See https://help.github.com/articles/ignoring-files for more about ignoring files. | ||
| # | ||
| # Temporary files generated by your text editor or operating system | ||
| # belong in git's global ignore instead: | ||
| # `$XDG_CONFIG_HOME/git/ignore` or `~/.config/git/ignore` | ||
|
|
||
| # Ignore bundler config. | ||
| /.bundle | ||
|
|
||
| # Ignore all environment files. | ||
| /.env* | ||
|
|
||
| # Ignore all logfiles and tempfiles. | ||
| /log/* | ||
| /tmp/* | ||
| !/log/.keep | ||
| !/tmp/.keep | ||
|
|
||
| # Ignore pidfiles, but keep the directory. | ||
| /tmp/pids/* | ||
| !/tmp/pids/ | ||
| !/tmp/pids/.keep | ||
|
|
||
| /public/assets | ||
|
|
||
| # Ignore key files for decrypting credentials and more. | ||
| /config/*.key | ||
|
|
||
| /storage/* | ||
| !/storage/.keep | ||
|
|
This file contains hidden or 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,3 @@ | ||
| #!/bin/sh | ||
|
|
||
| echo "Docker set up on $KAMAL_HOSTS..." |
This file contains hidden or 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,3 @@ | ||
| #!/bin/sh | ||
|
|
||
| echo "Booted app version $KAMAL_VERSION on $KAMAL_HOSTS..." |
This file contains hidden or 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,14 @@ | ||
| #!/bin/sh | ||
|
|
||
| # A sample post-deploy hook | ||
| # | ||
| # These environment variables are available: | ||
| # KAMAL_RECORDED_AT | ||
| # KAMAL_PERFORMER | ||
| # KAMAL_VERSION | ||
| # KAMAL_HOSTS | ||
| # KAMAL_ROLES (if set) | ||
| # KAMAL_DESTINATION (if set) | ||
| # KAMAL_RUNTIME | ||
|
|
||
| echo "$KAMAL_PERFORMER deployed $KAMAL_VERSION to $KAMAL_DESTINATION in $KAMAL_RUNTIME seconds" |
This file contains hidden or 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,3 @@ | ||
| #!/bin/sh | ||
|
|
||
| echo "Rebooted kamal-proxy on $KAMAL_HOSTS" |
This file contains hidden or 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,3 @@ | ||
| #!/bin/sh | ||
|
|
||
| echo "Booting app version $KAMAL_VERSION on $KAMAL_HOSTS..." |
This file contains hidden or 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,51 @@ | ||
| #!/bin/sh | ||
|
|
||
| # A sample pre-build hook | ||
| # | ||
| # Checks: | ||
| # 1. We have a clean checkout | ||
| # 2. A remote is configured | ||
| # 3. The branch has been pushed to the remote | ||
| # 4. The version we are deploying matches the remote | ||
| # | ||
| # These environment variables are available: | ||
| # KAMAL_RECORDED_AT | ||
| # KAMAL_PERFORMER | ||
| # KAMAL_VERSION | ||
| # KAMAL_HOSTS | ||
| # KAMAL_ROLES (if set) | ||
| # KAMAL_DESTINATION (if set) | ||
|
|
||
| if [ -n "$(git status --porcelain)" ]; then | ||
| echo "Git checkout is not clean, aborting..." >&2 | ||
| git status --porcelain >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| first_remote=$(git remote) | ||
|
|
||
| if [ -z "$first_remote" ]; then | ||
| echo "No git remote set, aborting..." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| current_branch=$(git branch --show-current) | ||
|
|
||
| if [ -z "$current_branch" ]; then | ||
| echo "Not on a git branch, aborting..." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| remote_head=$(git ls-remote $first_remote --tags $current_branch | cut -f1) | ||
|
|
||
| if [ -z "$remote_head" ]; then | ||
| echo "Branch not pushed to remote, aborting..." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ "$KAMAL_VERSION" != "$remote_head" ]; then | ||
| echo "Version ($KAMAL_VERSION) does not match remote HEAD ($remote_head), aborting..." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| exit 0 |
This file contains hidden or 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,47 @@ | ||
| #!/usr/bin/env ruby | ||
|
|
||
| # A sample pre-connect check | ||
| # | ||
| # Warms DNS before connecting to hosts in parallel | ||
| # | ||
| # These environment variables are available: | ||
| # KAMAL_RECORDED_AT | ||
| # KAMAL_PERFORMER | ||
| # KAMAL_VERSION | ||
| # KAMAL_HOSTS | ||
| # KAMAL_ROLES (if set) | ||
| # KAMAL_DESTINATION (if set) | ||
| # KAMAL_RUNTIME | ||
|
|
||
| hosts = ENV["KAMAL_HOSTS"].split(",") | ||
| results = nil | ||
| max = 3 | ||
|
|
||
| elapsed = Benchmark.realtime do | ||
| results = hosts.map do |host| | ||
| Thread.new do | ||
| tries = 1 | ||
|
|
||
| begin | ||
| Socket.getaddrinfo(host, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME) | ||
| rescue SocketError | ||
| if tries < max | ||
| puts "Retrying DNS warmup: #{host}" | ||
| tries += 1 | ||
| sleep rand | ||
| retry | ||
| else | ||
| puts "DNS warmup failed: #{host}" | ||
| host | ||
| end | ||
| end | ||
|
|
||
| tries | ||
| end | ||
| end.map(&:value) | ||
| end | ||
|
|
||
| retries = results.sum - hosts.size | ||
| nopes = results.count { |r| r == max } | ||
|
|
||
| puts "Prewarmed %d DNS lookups in %.2f sec: %d retries, %d failures" % [ hosts.size, elapsed, retries, nopes ] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CI workflow currently runs Brakeman/Bundler Audit and RuboCop, but it does not run the RSpec suite. Given this PR adds model logic + validations + ActiveStorage behavior, add a test job that provisions Postgres and runs
bundle exec rspecso regressions are caught in CI.