forked from rails/rails
-
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 branch 'main' into allow_redirect_from_configuration_hosts
- Loading branch information
Showing
1,575 changed files
with
36,876 additions
and
23,594 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
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
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 |
---|---|---|
@@ -1,38 +1,43 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/ruby | ||
// For format details, see https://aka.ms/devcontainer.json. | ||
{ | ||
"name": "Ruby", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"context": "..", | ||
"args": { | ||
// Update 'VARIANT' to pick a Ruby version: 3, 3.0, 2, 2.7, 2.6 | ||
"VARIANT": "3", | ||
// Options | ||
"NODE_VERSION": "lts/*" | ||
} | ||
}, | ||
"name": "Rails project development", | ||
"dockerComposeFile": "docker-compose.yml", | ||
"service": "rails", | ||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
"features": { | ||
"ghcr.io/devcontainers/features/github-cli:1": { | ||
"version": "latest" | ||
} | ||
}, | ||
|
||
// Set *default* container specific settings.json values on container create. | ||
"settings": {}, | ||
|
||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"rebornix.Ruby" | ||
], | ||
"containerEnv": { | ||
"PGHOST": "postgres", | ||
"PGUSER": "postgres", | ||
"PGPASSWORD": "postgres", | ||
"MYSQL_HOST": "mariadb", | ||
"REDIS_URL": "redis://redis/0", | ||
"MEMCACHE_SERVERS": "memcached:11211" | ||
}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
// This can be used to network with other containers or the host. | ||
// "forwardPorts": [3000, 5432], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": ".devcontainer/boot.sh", | ||
|
||
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
"remoteUser": "vscode" | ||
// Configure tool-specific properties. | ||
"customizations": { | ||
"vscode": { | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"Shopify.ruby-lsp" | ||
] | ||
} | ||
}, | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
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,71 @@ | ||
version: '3' | ||
|
||
services: | ||
rails: | ||
build: | ||
context: .. | ||
dockerfile: .devcontainer/Dockerfile | ||
|
||
volumes: | ||
- ../..:/workspaces:cached | ||
|
||
# Overrides default command so things don't shut down after the process ends. | ||
command: sleep infinity | ||
|
||
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. | ||
networks: | ||
- default | ||
|
||
depends_on: | ||
- postgres | ||
- mariadb | ||
- redis | ||
- memcached | ||
|
||
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally. | ||
# (Adding the "ports" property to this file will not forward from a Codespace.) | ||
|
||
postgres: | ||
image: postgres:latest | ||
restart: unless-stopped | ||
networks: | ||
- default | ||
volumes: | ||
- postgres-data:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_DB: postgres | ||
POSTGRES_PASSWORD: postgres | ||
|
||
mariadb: | ||
image: mariadb:latest | ||
restart: unless-stopped | ||
networks: | ||
- default | ||
volumes: | ||
- mariadb-data:/var/lib/mysql | ||
environment: | ||
MARIADB_ROOT_PASSWORD: root | ||
|
||
redis: | ||
image: redis:latest | ||
restart: unless-stopped | ||
networks: | ||
- default | ||
volumes: | ||
- redis-data:/data | ||
|
||
memcached: | ||
image: memcached:latest | ||
restart: unless-stopped | ||
command: ["-m", "1024"] | ||
networks: | ||
- default | ||
|
||
networks: | ||
default: | ||
|
||
volumes: | ||
postgres-data: | ||
mariadb-data: | ||
redis-data: |
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 |
---|---|---|
@@ -1,42 +1,56 @@ | ||
name: Lint | ||
|
||
on: [pull_request] | ||
on: [push, pull_request] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
changelog-formatting: | ||
name: Check CHANGELOGs formatting | ||
lint: | ||
runs-on: ubuntu-latest | ||
env: | ||
BUNDLE_WITHOUT: db:job:cable:storage:ujs | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Ruby 3.2 | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.2 | ||
bundler-cache: true | ||
|
||
- name: mdl | ||
run: bundle exec rake -f guides/Rakefile guides:lint | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install codespell==2.1.0 | ||
- name: Check spelling with codespell | ||
run: codespell --ignore-words=codespell.txt --skip="./vendor/bundle,./actionview/test/ujs/public/vendor/qunit.js,./actiontext/app/assets/javascripts/trix.js,./yarn.lock" || exit 1 | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
repository: skipkayhil/rails-bin | ||
ref: ba349066e1ce0c6e8d5b2c5e92dc71802237adbd | ||
ref: 748f4673a5fe5686b5859e89f814166280e51781 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.1 | ||
ruby-version: 3.2 | ||
bundler-cache: true | ||
- uses: actions/checkout@v3 | ||
with: | ||
path: rails | ||
- run: bin/check-changelogs ./rails | ||
codespell: | ||
name: Check spelling all files with codespell | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.10'] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install codespell==2.1.0 | ||
- name: Check spelling with codespell | ||
run: codespell --ignore-words=codespell.txt --skip="./actionview/test/ujs/public/vendor/qunit.js" || exit 1 | ||
- run: bin/check-config-docs ./rails | ||
|
||
- uses: zzak/action-discord@v8 | ||
continue-on-error: true | ||
if: failure() && github.ref_name == 'main' | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
webhook: ${{ secrets.DISCORD_WEBHOOK }} |
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,42 @@ | ||
name: rails-new-docker | ||
|
||
on: [push, pull_request] | ||
|
||
env: | ||
APP_NAME: devrails | ||
APP_PATH: dev/devrails | ||
BUNDLE_WITHOUT: db:job:cable:storage:ujs | ||
|
||
jobs: | ||
rails-new-docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '3.2' | ||
bundler-cache: true | ||
- name: Generate --dev app | ||
run: | | ||
bundle exec railties/exe/rails new $APP_PATH --dev | ||
- name: Build image | ||
run: | | ||
podman build -t $APP_NAME \ | ||
-v $(pwd):$(pwd) \ | ||
-f ./$APP_PATH/Dockerfile \ | ||
./$APP_PATH | ||
- name: Run container | ||
run: | | ||
podman run --name $APP_NAME \ | ||
-v $(pwd):$(pwd) \ | ||
-e SECRET_KEY_BASE_DUMMY=1 \ | ||
-p 3000:3000 $APP_NAME & | ||
- name: Test container | ||
run: ruby -r ./.github/workflows/scripts/test-container.rb | ||
|
||
- uses: zzak/action-discord@v8 | ||
continue-on-error: true | ||
if: failure() && github.ref_name == 'main' | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
webhook: ${{ secrets.DISCORD_WEBHOOK }} |
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
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,29 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
# Based on Sam Ruby's system test from dockerfile-rails: | ||
# https://github.com/rubys/dockerfile-rails/pull/21 | ||
|
||
require "net/http" | ||
require "socket" | ||
|
||
LOCALHOST = Socket.gethostname | ||
PORT = 3000 | ||
|
||
60.times do |i| | ||
sleep 0.5 | ||
begin | ||
response = Net::HTTP.get_response(LOCALHOST, "/up", PORT) | ||
|
||
if %w(404 500).include? response.code | ||
status = response.code.to_i | ||
end | ||
|
||
puts response.body | ||
exit status || 0 | ||
rescue SystemCallError, IOError | ||
puts "#{i}/60 Connection to #{LOCALHOST}:#{PORT} refused or timed out, retrying..." | ||
end | ||
end | ||
|
||
exit 999 |
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 @@ | ||
style "#{File.dirname(__FILE__)}/.mdlrc.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,23 @@ | ||
# frozen_string_literal: true | ||
|
||
all | ||
|
||
exclude_rule "MD003" | ||
exclude_rule "MD004" | ||
exclude_rule "MD005" | ||
exclude_rule "MD006" | ||
exclude_rule "MD007" | ||
exclude_rule "MD012" | ||
exclude_rule "MD014" | ||
exclude_rule "MD024" | ||
exclude_rule "MD026" | ||
exclude_rule "MD033" | ||
exclude_rule "MD034" | ||
exclude_rule "MD036" | ||
exclude_rule "MD040" | ||
exclude_rule "MD041" | ||
|
||
rule "MD013", line_length: 2000, ignore_code_blocks: true | ||
# rule "MD024", allow_different_nesting: true # This did not work as intended, see action_cable_overview.md | ||
rule "MD029", style: :ordered | ||
# rule "MD046", style: :consistent # default (:fenced) |
Oops, something went wrong.