Skip to content

Commit

Permalink
Merge branch 'rails:main' into 48326
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaruz committed Nov 29, 2023
2 parents e6c5f41 + f8212aa commit 70e8f28
Show file tree
Hide file tree
Showing 989 changed files with 34,742 additions and 26,735 deletions.
11 changes: 5 additions & 6 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/ruby/.devcontainer/base.Dockerfile

# [Choice] Ruby version: 3, 3.0, 2, 2.7, 2.6
ARG VARIANT="3.0"
FROM mcr.microsoft.com/devcontainers/ruby:0-${VARIANT}
ARG VARIANT="3"
FROM mcr.microsoft.com/devcontainers/ruby:${VARIANT}

# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
ARG NODE_VERSION="none"
ARG NODE_VERSION="lts/*"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi

# [Optional] Uncomment this section to install additional OS packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
mariadb-server libmariadb-dev \
postgresql postgresql-client postgresql-contrib libpq-dev \
redis-server memcached \
mariadb-client libmariadb-dev \
postgresql-client postgresql-contrib libpq-dev \
ffmpeg mupdf mupdf-tools libvips poppler-utils


Expand Down
16 changes: 5 additions & 11 deletions .devcontainer/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@ yarn install

sudo chown -R vscode:vscode /usr/local/bundle

sudo service postgresql start
sudo service mariadb start
sudo service redis-server start
sudo service memcached start
cd activerecord

# Create PostgreSQL users and databases
sudo su postgres -c "createuser --superuser vscode"
sudo su postgres -c "createdb -O vscode -E UTF8 -T template0 activerecord_unittest"
sudo su postgres -c "createdb -O vscode -E UTF8 -T template0 activerecord_unittest2"
# Create PostgreSQL databases
bundle exec rake db:postgresql:rebuild

# Create MySQL database and databases
cd activerecord
MYSQL_CODESPACES=1 bundle exec rake db:mysql:build
# Create MySQL databases
MYSQL_CODESPACES=1 bundle exec rake db:mysql:rebuild
49 changes: 24 additions & 25 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
// 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"
}
},

"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.
// 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",

// Configure tool-specific properties.
"customizations": {
"vscode": {
Expand All @@ -29,16 +38,6 @@
}
},

"containerEnv": {
"MYSQL_SOCK": "/run/mysqld/mysqld.sock"
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// 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"
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
71 changes: 71 additions & 0 deletions .devcontainer/docker-compose.yml
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:
2 changes: 1 addition & 1 deletion .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ markComment: >
The resources of the Rails team are limited, and so we are asking for your help.
If you can still reproduce this error on the `7-0-stable` branch or on `main`,
If you can still reproduce this error on the `7-1-stable` branch or on `main`,
please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.
Expand Down
71 changes: 32 additions & 39 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,41 @@ permissions:
contents: read

jobs:
rails-bin:
name: Check rails-bin lints
lint:
runs-on: ubuntu-latest
env:
BUNDLE_WITHOUT: db:job:cable:storage:ujs

steps:
- uses: actions/checkout@v3
with:
repository: skipkayhil/rails-bin
ref: 748f4673a5fe5686b5859e89f814166280e51781
- uses: ruby/setup-ruby@v1
- uses: actions/checkout@v4

- name: Set up Ruby 3.2
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- uses: actions/checkout@v3

- name: mdl
run: bundle exec rake -f guides/Rakefile guides:lint

- name: Set up Python
uses: actions/setup-python@v3
with:
path: rails
- run: bin/check-changelogs ./rails
- run: bin/check-config-docs ./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,./actiontext/app/assets/javascripts/trix.js" || exit 1

notify:
runs-on: ubuntu-latest
if: always() && github.ref_name == 'main'
continue-on-error: true
needs: [rails-bin, codespell]
steps:
- uses: zzak/action-discord@v4
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
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

- run: tools/railspect changelogs .
- run: tools/railspect configuration .

- 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 }}
22 changes: 0 additions & 22 deletions .github/workflows/mdl.yml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/rail_inspector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Rail Inspector

on:
pull_request:
paths:
- "tools/rail_inspector/**"
push:
paths:
- "tools/rail_inspector/**"

permissions:
contents: read

jobs:
rail_inspector:
name: rail_inspector tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- run: cd tools/rail_inspector && bundle exec rake
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
name: Build and test --dev image
name: rails-new-docker

on: [push, pull_request]

env:
APP_NAME: devrails
APP_PATH: dev/devrails
BUNDLE_WITHOUT: db:job:cable:storage:ujs

jobs:
build-and-test-dev-image:
rails-new-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
Expand All @@ -33,12 +34,9 @@ jobs:
- name: Test container
run: ruby -r ./.github/workflows/scripts/test-container.rb

notify:
runs-on: ubuntu-latest
if: always() && github.ref_name == 'main'
continue-on-error: true
needs: build-and-test-dev-image
steps:
- uses: zzak/action-discord@v4
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
- 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 }}
19 changes: 9 additions & 10 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
BUNDLE_ONLY: rubocop

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Ruby 3.2
uses: ruby/setup-ruby@v1
Expand All @@ -23,12 +23,11 @@ jobs:
- name: Run RuboCop
run: bundle exec rubocop --parallel

notify:
runs-on: ubuntu-latest
if: always() && github.ref_name == 'main'
continue-on-error: true
needs: build
steps:
- uses: zzak/action-discord@v4
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
- uses: zzak/action-discord@v8
env:
BUNDLE_ONLY: ""
continue-on-error: true
if: failure() && github.ref_name == 'main'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
webhook: ${{ secrets.DISCORD_WEBHOOK }}

0 comments on commit 70e8f28

Please sign in to comment.