Compare commits
31 Commits
Author | SHA1 | Date |
---|---|---|
Thor | 22e9559aa2 | 1 year ago |
Thor | 8be9ee756a | 2 years ago |
Thor | b4853ea584 | 2 years ago |
root | ecc8e19071 | 2 years ago |
Thor | f196a3d4d9 | 2 years ago |
Thor | d8da65025d | 2 years ago |
Thor | 0d2e4b6294 | 2 years ago |
Thor | 244a5e21ea | 2 years ago |
Thor | 22f653c17b | 2 years ago |
Thor | 36e533eaab | 2 years ago |
Thor | eb8fa57261 | 2 years ago |
Thor | affab99b47 | 2 years ago |
Thor | 6b0dc8407e | 2 years ago |
Thor | 7f3114e4cb | 2 years ago |
Thor | 74bb52bd7e | 2 years ago |
Thor | 6a50920252 | 2 years ago |
Thor | 7a325063af | 2 years ago |
Thor | e9272004de | 2 years ago |
Thor | 2271f10292 | 2 years ago |
Thor | 96c9b527f6 | 2 years ago |
Thor | ca90a99560 | 2 years ago |
Thor | 775e4c4be9 | 2 years ago |
Thor | ad6397f1bb | 2 years ago |
Thor | 89a476f0bc | 2 years ago |
Thor | bc8d4d0c78 | 2 years ago |
Thor | e998b1e630 | 2 years ago |
Thor | c4bb82b49e | 2 years ago |
Thor | 655573f9c5 | 2 years ago |
Thor | d4219bd203 | 2 years ago |
Thor | f487fe0951 | 2 years ago |
Mastodon | 65e9b5c2e6 | 2 years ago |
4790 changed files with 138841 additions and 216555 deletions
@ -0,0 +1,223 @@ |
||||
version: 2.1 |
||||
|
||||
orbs: |
||||
ruby: circleci/ruby@1.4.1 |
||||
node: circleci/node@5.0.1 |
||||
|
||||
executors: |
||||
default: |
||||
parameters: |
||||
ruby-version: |
||||
type: string |
||||
docker: |
||||
- image: cimg/ruby:<< parameters.ruby-version >> |
||||
environment: |
||||
BUNDLE_JOBS: 3 |
||||
BUNDLE_RETRY: 3 |
||||
CONTINUOUS_INTEGRATION: true |
||||
DB_HOST: localhost |
||||
DB_USER: root |
||||
DISABLE_SIMPLECOV: true |
||||
RAILS_ENV: test |
||||
- image: cimg/postgres:14.0 |
||||
environment: |
||||
POSTGRES_USER: root |
||||
POSTGRES_HOST_AUTH_METHOD: trust |
||||
- image: cimg/redis:6.2 |
||||
|
||||
commands: |
||||
install-system-dependencies: |
||||
steps: |
||||
- run: |
||||
name: Install system dependencies |
||||
command: | |
||||
sudo apt-get update |
||||
sudo apt-get install -y libicu-dev libidn11-dev |
||||
install-ruby-dependencies: |
||||
parameters: |
||||
ruby-version: |
||||
type: string |
||||
steps: |
||||
- run: |
||||
command: | |
||||
bundle config clean 'true' |
||||
bundle config frozen 'true' |
||||
bundle config without 'development production' |
||||
name: Set bundler settings |
||||
- ruby/install-deps: |
||||
bundler-version: '2.3.8' |
||||
key: ruby<< parameters.ruby-version >>-gems-v1 |
||||
wait-db: |
||||
steps: |
||||
- run: |
||||
command: dockerize -wait tcp://localhost:5432 -wait tcp://localhost:6379 -timeout 1m |
||||
name: Wait for PostgreSQL and Redis |
||||
|
||||
jobs: |
||||
build: |
||||
docker: |
||||
- image: cimg/ruby:3.0-node |
||||
environment: |
||||
RAILS_ENV: test |
||||
steps: |
||||
- checkout |
||||
- install-system-dependencies |
||||
- install-ruby-dependencies: |
||||
ruby-version: '3.0' |
||||
- node/install-packages: |
||||
cache-version: v1 |
||||
pkg-manager: yarn |
||||
- run: |
||||
command: ./bin/rails assets:precompile |
||||
name: Precompile assets |
||||
- persist_to_workspace: |
||||
paths: |
||||
- public/assets |
||||
- public/packs-test |
||||
root: . |
||||
|
||||
test: |
||||
parameters: |
||||
ruby-version: |
||||
type: string |
||||
executor: |
||||
name: default |
||||
ruby-version: << parameters.ruby-version >> |
||||
environment: |
||||
ALLOW_NOPAM: true |
||||
PAM_ENABLED: true |
||||
PAM_DEFAULT_SERVICE: pam_test |
||||
PAM_CONTROLLED_SERVICE: pam_test_controlled |
||||
parallelism: 4 |
||||
steps: |
||||
- checkout |
||||
- install-system-dependencies |
||||
- run: |
||||
command: sudo apt-get install -y ffmpeg imagemagick libpam-dev |
||||
name: Install additional system dependencies |
||||
- run: |
||||
command: bundle config with 'pam_authentication' |
||||
name: Enable PAM authentication |
||||
- install-ruby-dependencies: |
||||
ruby-version: << parameters.ruby-version >> |
||||
- attach_workspace: |
||||
at: . |
||||
- wait-db |
||||
- run: |
||||
command: ./bin/rails db:create db:schema:load db:seed |
||||
name: Load database schema |
||||
- ruby/rspec-test |
||||
|
||||
test-migrations: |
||||
executor: |
||||
name: default |
||||
ruby-version: '3.0' |
||||
steps: |
||||
- checkout |
||||
- install-system-dependencies |
||||
- install-ruby-dependencies: |
||||
ruby-version: '3.0' |
||||
- wait-db |
||||
- run: |
||||
command: ./bin/rails db:create |
||||
name: Create database |
||||
- run: |
||||
command: ./bin/rails db:migrate VERSION=20171010025614 |
||||
name: Run migrations up to v2.0.0 |
||||
- run: |
||||
command: ./bin/rails tests:migrations:populate_v2 |
||||
name: Populate database with test data |
||||
- run: |
||||
command: ./bin/rails db:migrate VERSION=20180514140000 |
||||
name: Run migrations up to v2.4.0 |
||||
- run: |
||||
command: ./bin/rails tests:migrations:populate_v2_4 |
||||
name: Populate database with test data |
||||
- run: |
||||
command: ./bin/rails db:migrate VERSION=20180707154237 |
||||
name: Run migrations up to v2.4.3 |
||||
- run: |
||||
command: ./bin/rails tests:migrations:populate_v2_4_3 |
||||
name: Populate database with test data |
||||
- run: |
||||
command: ./bin/rails db:migrate |
||||
name: Run all remaining migrations |
||||
- run: |
||||
command: ./bin/rails tests:migrations:check_database |
||||
name: Check migration result |
||||
|
||||
test-two-step-migrations: |
||||
executor: |
||||
name: default |
||||
ruby-version: '3.0' |
||||
steps: |
||||
- checkout |
||||
- install-system-dependencies |
||||
- install-ruby-dependencies: |
||||
ruby-version: '3.0' |
||||
- wait-db |
||||
- run: |
||||
command: ./bin/rails db:create |
||||
name: Create database |
||||
- run: |
||||
command: ./bin/rails db:migrate VERSION=20171010025614 |
||||
name: Run migrations up to v2.0.0 |
||||
- run: |
||||
command: ./bin/rails tests:migrations:populate_v2 |
||||
name: Populate database with test data |
||||
- run: |
||||
command: ./bin/rails db:migrate VERSION=20180514140000 |
||||
name: Run pre-deployment migrations up to v2.4.0 |
||||
environment: |
||||
SKIP_POST_DEPLOYMENT_MIGRATIONS: true |
||||
- run: |
||||
command: ./bin/rails tests:migrations:populate_v2_4 |
||||
name: Populate database with test data |
||||
- run: |
||||
command: ./bin/rails db:migrate VERSION=20180707154237 |
||||
name: Run migrations up to v2.4.3 |
||||
environment: |
||||
SKIP_POST_DEPLOYMENT_MIGRATIONS: true |
||||
- run: |
||||
command: ./bin/rails tests:migrations:populate_v2_4_3 |
||||
name: Populate database with test data |
||||
- run: |
||||
command: ./bin/rails db:migrate |
||||
name: Run all remaining pre-deployment migrations |
||||
environment: |
||||
SKIP_POST_DEPLOYMENT_MIGRATIONS: true |
||||
- run: |
||||
command: ./bin/rails db:migrate |
||||
name: Run all post-deployment migrations |
||||
- run: |
||||
command: ./bin/rails tests:migrations:check_database |
||||
name: Check migration result |
||||
|
||||
workflows: |
||||
version: 2 |
||||
build-and-test: |
||||
jobs: |
||||
- build |
||||
- test: |
||||
matrix: |
||||
parameters: |
||||
ruby-version: |
||||
- '2.7' |
||||
- '3.0' |
||||
name: test-ruby<< matrix.ruby-version >> |
||||
requires: |
||||
- build |
||||
- test-migrations: |
||||
requires: |
||||
- build |
||||
- test-two-step-migrations: |
||||
requires: |
||||
- build |
||||
- node/run: |
||||
cache-version: v1 |
||||
name: test-webui |
||||
pkg-manager: yarn |
||||
requires: |
||||
- build |
||||
version: lts |
||||
yarn-run: test:jest |
@ -0,0 +1,39 @@ |
||||
version: '2' |
||||
checks: |
||||
argument-count: |
||||
enabled: false |
||||
complex-logic: |
||||
enabled: false |
||||
file-lines: |
||||
enabled: false |
||||
method-complexity: |
||||
enabled: false |
||||
method-count: |
||||
enabled: false |
||||
method-lines: |
||||
enabled: false |
||||
nested-control-flow: |
||||
enabled: false |
||||
return-statements: |
||||
enabled: false |
||||
similar-code: |
||||
enabled: false |
||||
identical-code: |
||||
enabled: false |
||||
plugins: |
||||
brakeman: |
||||
enabled: true |
||||
bundler-audit: |
||||
enabled: true |
||||
eslint: |
||||
enabled: false |
||||
rubocop: |
||||
enabled: false |
||||
sass-lint: |
||||
enabled: false |
||||
exclude_patterns: |
||||
- spec/ |
||||
- vendor/asset/ |
||||
|
||||
- app/javascript/mastodon/locales/**/*.json |
||||
- config/locales/**/*.yml |
@ -0,0 +1,23 @@ |
||||
version = 1 |
||||
|
||||
test_patterns = ["app/javascript/mastodon/**/__tests__/**"] |
||||
|
||||
exclude_patterns = [ |
||||
"db/migrate/**", |
||||
"db/post_migrate/**" |
||||
] |
||||
|
||||
[[analyzers]] |
||||
name = "ruby" |
||||
enabled = true |
||||
|
||||
[[analyzers]] |
||||
name = "javascript" |
||||
enabled = true |
||||
|
||||
[analyzers.meta] |
||||
environment = [ |
||||
"browser", |
||||
"jest", |
||||
"nodejs" |
||||
] |
@ -1,49 +0,0 @@ |
||||
{ |
||||
"name": "Mastodon on GitHub Codespaces", |
||||
"dockerComposeFile": "../docker-compose.yml", |
||||
"service": "app", |
||||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", |
||||
|
||||
"features": { |
||||
"ghcr.io/devcontainers/features/sshd:1": {} |
||||
}, |
||||
|
||||
"runServices": ["app", "db", "redis"], |
||||
|
||||
"forwardPorts": [3000, 4000], |
||||
|
||||
"portsAttributes": { |
||||
"3000": { |
||||
"label": "web", |
||||
"onAutoForward": "notify" |
||||
}, |
||||
"4000": { |
||||
"label": "stream", |
||||
"onAutoForward": "silent" |
||||
} |
||||
}, |
||||
|
||||
"otherPortsAttributes": { |
||||
"onAutoForward": "silent" |
||||
}, |
||||
|
||||
"remoteEnv": { |
||||
"LOCAL_DOMAIN": "${localEnv:CODESPACE_NAME}-3000.app.github.dev", |
||||
"LOCAL_HTTPS": "true", |
||||
"STREAMING_API_BASE_URL": "https://${localEnv:CODESPACE_NAME}-4000.app.github.dev", |
||||
"DISABLE_FORGERY_REQUEST_PROTECTION": "true", |
||||
"ES_ENABLED": "", |
||||
"LIBRE_TRANSLATE_ENDPOINT": "" |
||||
}, |
||||
|
||||
"onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", |
||||
"postCreateCommand": ".devcontainer/post-create.sh", |
||||
"waitFor": "postCreateCommand", |
||||
|
||||
"customizations": { |
||||
"vscode": { |
||||
"settings": {}, |
||||
"extensions": ["EditorConfig.EditorConfig", "webben.browserslist"] |
||||
} |
||||
} |
||||
} |
@ -1,40 +1,27 @@ |
||||
{ |
||||
"name": "Mastodon on local machine", |
||||
"name": "Mastodon", |
||||
"dockerComposeFile": "docker-compose.yml", |
||||
"service": "app", |
||||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", |
||||
"workspaceFolder": "/workspaces/mastodon", |
||||
|
||||
"features": { |
||||
"ghcr.io/devcontainers/features/sshd:1": {} |
||||
}, |
||||
// Set *default* container specific settings.json values on container create. |
||||
"settings": {}, |
||||
|
||||
"forwardPorts": [3000, 4000], |
||||
|
||||
"portsAttributes": { |
||||
"3000": { |
||||
"label": "web", |
||||
"onAutoForward": "notify", |
||||
"requireLocalPort": true |
||||
}, |
||||
"4000": { |
||||
"label": "stream", |
||||
"onAutoForward": "silent", |
||||
"requireLocalPort": true |
||||
} |
||||
}, |
||||
// Add the IDs of extensions you want installed when the container is created. |
||||
"extensions": [ |
||||
"EditorConfig.EditorConfig", |
||||
"dbaeumer.vscode-eslint", |
||||
"rebornix.Ruby", |
||||
"webben.browserslist" |
||||
], |
||||
|
||||
"otherPortsAttributes": { |
||||
"onAutoForward": "silent" |
||||
}, |
||||
// 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, 4000], |
||||
|
||||
"onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", |
||||
"postCreateCommand": ".devcontainer/post-create.sh", |
||||
"waitFor": "postCreateCommand", |
||||
// Use 'postCreateCommand' to run commands after the container is created. |
||||
"postCreateCommand": "bundle install --path vendor/bundle && yarn install && git checkout -- Gemfile.lock && ./bin/rails db:setup", |
||||
|
||||
"customizations": { |
||||
"vscode": { |
||||
"settings": {}, |
||||
"extensions": ["EditorConfig.EditorConfig", "webben.browserslist"] |
||||
} |
||||
} |
||||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. |
||||
"remoteUser": "vscode" |
||||
} |
||||
|
@ -1,26 +0,0 @@ |
||||
#!/bin/bash |
||||
|
||||
set -e # Fail the whole script on first error |
||||
|
||||
# Fetch Ruby gem dependencies |
||||
bundle config path 'vendor/bundle' |
||||
bundle config with 'development test' |
||||
bundle install |
||||
|
||||
# Make Gemfile.lock pristine again |
||||
git checkout -- Gemfile.lock |
||||
|
||||
# Fetch Javascript dependencies |
||||
yarn --frozen-lockfile |
||||
|
||||
# [re]create, migrate, and seed the test database |
||||
RAILS_ENV=test ./bin/rails db:setup |
||||
|
||||
# [re]create, migrate, and seed the development database |
||||
RAILS_ENV=development ./bin/rails db:setup |
||||
|
||||
# Precompile assets for development |
||||
RAILS_ENV=development ./bin/rails assets:precompile |
||||
|
||||
# Precompile assets for test |
||||
RAILS_ENV=test NODE_ENV=tests ./bin/rails assets:precompile |
@ -0,0 +1,3 @@ |
||||
patreon: mastodon |
||||
open_collective: mastodon |
||||
custom: https://sponsor.joinmastodon.org |
@ -0,0 +1,56 @@ |
||||
name: Bug Report |
||||
description: If something isn't working as expected |
||||
labels: bug |
||||
body: |
||||
- type: markdown |
||||
attributes: |
||||
value: | |
||||
Make sure that you are submitting a new bug that was not previously reported or already fixed. |
||||
|
||||
Please use a concise and distinct title for the issue. |
||||
- type: textarea |
||||
attributes: |
||||
label: Steps to reproduce the problem |
||||
description: What were you trying to do? |
||||
value: | |
||||
1. |
||||
2. |
||||
3. |
||||
... |
||||
validations: |
||||
required: true |
||||
- type: input |
||||
attributes: |
||||
label: Expected behaviour |
||||
description: What should have happened? |
||||
validations: |
||||
required: true |
||||
- type: input |
||||
attributes: |
||||
label: Actual behaviour |
||||
description: What happened? |
||||
validations: |
||||
required: true |
||||
- type: textarea |
||||
attributes: |
||||
label: Detailed description |
||||
validations: |
||||
required: false |
||||
- type: textarea |
||||
attributes: |
||||
label: Specifications |
||||
description: | |
||||
What version or commit hash of Mastodon did you find this bug in? |
||||
|
||||
If a front-end issue, what browser and operating systems were you using? |
||||
placeholder: | |
||||
Mastodon 3.5.3 (or Edge) |
||||
Ruby 2.7.6 (or v3.1.2) |
||||
Node.js 16.18.0 |
||||
|
||||
Google Chrome 106.0.5249.119 |
||||
Firefox 105.0.3 |
||||
|
||||
etc... |
||||
validations: |
||||
required: true |
@ -1,76 +0,0 @@ |
||||
name: Bug Report (Web Interface) |
||||
description: If you are using Mastodon's web interface and something is not working as expected |
||||
labels: [bug, 'status/to triage', 'area/web interface'] |
||||
body: |
||||
- type: markdown |
||||
attributes: |
||||
value: | |
||||
Make sure that you are submitting a new bug that was not previously reported or already fixed. |
||||
|
||||
Please use a concise and distinct title for the issue. |
||||
- type: textarea |
||||
attributes: |
||||
label: Steps to reproduce the problem |
||||
description: What were you trying to do? |
||||
value: | |
||||
1. |
||||
2. |
||||
3. |
||||
... |
||||
validations: |
||||
required: true |
||||
- type: input |
||||
attributes: |
||||
label: Expected behaviour |
||||
description: What should have happened? |
||||
validations: |
||||
required: true |
||||
- type: input |
||||
attributes: |
||||
label: Actual behaviour |
||||
description: What happened? |
||||
validations: |
||||
required: true |
||||
- type: textarea |
||||
attributes: |
||||
label: Detailed description |
||||
validations: |
||||
required: false |
||||
- type: input |
||||
attributes: |
||||
label: Mastodon instance |
||||
description: The address of the Mastodon instance where you experienced the issue |
||||
placeholder: mastodon.social |
||||
validations: |
||||
required: true |
||||
- type: input |
||||
attributes: |
||||
label: Mastodon version |
||||
description: | |
||||
This is displayed at the bottom of the About page, eg. `v4.1.2+nightly-20230627` |
||||
placeholder: v4.1.2 |
||||
validations: |
||||
required: true |
||||
- type: input |
||||
attributes: |
||||
label: Browser name and version |
||||
description: | |
||||
What browser are you using when getting this bug? Please specify the version as well. |
||||
placeholder: Firefox 105.0.3 |
||||
validations: |
||||
required: true |
||||
- type: input |
||||
attributes: |
||||
label: Operating system |
||||
description: | |
||||
What OS are you running? Please specify the version as well. |
||||
placeholder: macOS 13.4.1 |
||||
validations: |
||||
required: true |
||||
- type: textarea |
||||
attributes: |
||||
label: Technical details |
||||
description: | |
||||
Any additional technical details you may have. This can include the full error log, inspector's output… |
||||
validations: |
||||
required: false |
@ -0,0 +1,22 @@ |
||||
name: Feature Request |
||||
description: I have a suggestion |
||||
labels: suggestion |
||||
body: |
||||
- type: markdown |
||||
attributes: |
||||
value: | |
||||
Please use a concise and distinct title for the issue. |
||||
|
||||
Consider: Could it be implemented as a 3rd party app using the REST API instead? |
||||
- type: textarea |
||||
attributes: |
||||
label: Pitch |
||||
description: Describe your idea for a feature. Make sure it has not already been suggested/implemented/turned down before. |
||||
validations: |
||||
required: true |
||||
- type: textarea |
||||
attributes: |
||||
label: Motivation |
||||
description: Why do you think this feature is needed? Who would benefit from it? |
||||
validations: |
||||
required: true |
@ -1,65 +0,0 @@ |
||||
name: Bug Report (server / API) |
||||
description: | |
||||
If something is not working as expected, but is not from using the web interface. |
||||
labels: [bug, 'status/to triage'] |
||||
body: |
||||
- type: markdown |
||||
attributes: |
||||
value: | |
||||
Make sure that you are submitting a new bug that was not previously reported or already fixed. |
||||
|
||||
Please use a concise and distinct title for the issue. |
||||
- type: textarea |
||||
attributes: |
||||
label: Steps to reproduce the problem |
||||
description: What were you trying to do? |
||||
value: | |
||||
1. |
||||
2. |
||||
3. |
||||
... |
||||
validations: |
||||
required: true |
||||
- type: input |
||||
attributes: |
||||
label: Expected behaviour |
||||
description: What should have happened? |
||||
validations: |
||||
required: true |
||||
- type: input |
||||
attributes: |
||||
label: Actual behaviour |
||||
description: What happened? |
||||
validations: |
||||
required: true |
||||
- type: textarea |
||||
attributes: |
||||
label: Detailed description |
||||
validations: |
||||
required: false |
||||
- type: input |
||||
attributes: |
||||
label: Mastodon instance |
||||
description: The address of the Mastodon instance where you experienced the issue |
||||
placeholder: mastodon.social |
||||
validations: |
||||
required: false |
||||
- type: input |
||||
attributes: |
||||
label: Mastodon version |
||||
description: | |
||||
This is displayed at the bottom of the About page, eg. `v4.1.2+nightly-20230627` |
||||
placeholder: v4.1.2 |
||||
validations: |
||||
required: false |
||||
- type: textarea |
||||
attributes: |
||||
label: Technical details |
||||
description: | |
||||
Any additional technical details you may have, like logs or error traces |
||||
value: | |
||||
If this is happening on your own Mastodon server, please fill out those: |
||||
- Ruby version: (from `ruby --version`, eg. v3.1.2) |
||||
- Node.js version: (from `node --version`, eg. v18.16.0) |
||||
validations: |
||||
required: false |
@ -1,22 +0,0 @@ |
||||
name: Feature Request |
||||
description: I have a suggestion |
||||
labels: [suggestion] |
||||
body: |
||||
- type: markdown |
||||
attributes: |
||||
value: | |
||||
Please use a concise and distinct title for the issue. |
||||
|
||||
Consider: Could it be implemented as a 3rd party app using the REST API instead? |
||||
- type: textarea |
||||
attributes: |
||||
label: Pitch |
||||
description: Describe your idea for a feature. Make sure it has not already been suggested/implemented/turned down before. |
||||
validations: |
||||
required: true |
||||
- type: textarea |
||||
attributes: |
||||
label: Motivation |
||||
description: Why do you think this feature is needed? Who would benefit from it? |
||||
validations: |
||||
required: true |
@ -1,124 +0,0 @@ |
||||
{ |
||||
$schema: 'https://docs.renovatebot.com/renovate-schema.json', |
||||
extends: [ |
||||
'config:recommended', |
||||
':labels(dependencies)', |
||||
':maintainLockFilesMonthly', // update non-direct dependencies monthly |
||||
':prConcurrentLimitNone', // Remove limit for open PRs at any time. |
||||
':prHourlyLimit2', // Rate limit PR creation to a maximum of two per hour. |
||||
], |
||||
minimumReleaseAge: '3', // Wait 3 days after the package has been published before upgrading it |
||||
// packageRules order is important, they are applied from top to bottom and are merged, |
||||
// meaning the most important ones must be at the bottom, for example grouping rules |
||||
// If we do not want a package to be grouped with others, we need to set its groupName |
||||
// to `null` after any other rule set it to something. |
||||
dependencyDashboardHeader: 'This issue lists Renovate updates and detected dependencies. Read the [Dependency Dashboard](https://docs.renovatebot.com/key-concepts/dashboard/) docs to learn more. Before approving any upgrade: read the description and comments in the [`renovate.json5` file](https://github.com/mastodon/mastodon/blob/main/.github/renovate.json5).', |
||||
packageRules: [ |
||||
{ |
||||
// Require Dependency Dashboard Approval for major version bumps of these node packages |
||||
matchManagers: ['npm'], |
||||
matchPackageNames: [ |
||||
'tesseract.js', // Requires code changes |
||||
'react-hotkeys', // Requires code changes |
||||
|
||||
// Requires Webpacker upgrade or replacement |
||||
'@types/webpack', |
||||
'babel-loader', |
||||
'compression-webpack-plugin', |
||||
'css-loader', |
||||
'imports-loader', |
||||
'mini-css-extract-plugin', |
||||
'postcss-loader', |
||||
'sass-loader', |
||||
'terser-webpack-plugin', |
||||
'webpack', |
||||
'webpack-assets-manifest', |
||||
'webpack-bundle-analyzer', |
||||
'webpack-dev-server', |
||||
'webpack-cli', |
||||
|
||||
// react-router: Requires manual upgrade |
||||
'history', |
||||
'react-router-dom', |
||||
], |
||||
matchUpdateTypes: ['major'], |
||||
dependencyDashboardApproval: true, |
||||
}, |
||||
{ |
||||
// Require Dependency Dashboard Approval for major version bumps of these Ruby packages |
||||
matchManagers: ['bundler'], |
||||
matchPackageNames: [ |
||||
'rack', // Needs to be synced with Rails version |
||||
'sprockets', // Requires manual upgrade https://github.com/rails/sprockets/blob/master/UPGRADING.md#guide-to-upgrading-from-sprockets-3x-to-4x |
||||
'strong_migrations', // Requires manual upgrade |
||||
'sidekiq', // Requires manual upgrade |
||||
'sidekiq-unique-jobs', // Requires manual upgrades and sync with Sidekiq version |
||||
'redis', // Requires manual upgrade and sync with Sidekiq version |
||||
], |
||||
matchUpdateTypes: ['major'], |
||||
dependencyDashboardApproval: true, |
||||
}, |
||||
{ |
||||
// Update Github Actions and Docker images weekly |
||||
matchManagers: ['github-actions', 'dockerfile', 'docker-compose'], |
||||
extends: ['schedule:weekly'], |
||||
}, |
||||
{ |
||||
// Require Dependency Dashboard Approval for major & minor bumps for the ruby image, this needs to be synced with .ruby-version |
||||
matchManagers: ['dockerfile'], |
||||
matchPackageNames: ['moritzheiber/ruby-jemalloc'], |
||||
matchUpdateTypes: ['minor', 'major'], |
||||
dependencyDashboardApproval: true, |
||||
}, |
||||
{ |
||||
// Require Dependency Dashboard Approval for major bumps for the node image, this needs to be synced with .nvmrc |
||||
matchManagers: ['dockerfile'], |
||||
matchPackageNames: ['node'], |
||||
matchUpdateTypes: ['major'], |
||||
dependencyDashboardApproval: true, |
||||
}, |
||||
{ |
||||
// Require Dependency Dashboard Approval for major postgres bumps in the docker-compose file, as those break dev environments |
||||
matchManagers: ['docker-compose'], |
||||
matchPackageNames: ['postgres'], |
||||
matchUpdateTypes: ['major'], |
||||
dependencyDashboardApproval: true, |
||||
}, |
||||
{ |
||||
// Update devDependencies every week, with one grouped PR |
||||
matchDepTypes: 'devDependencies', |
||||
matchUpdateTypes: ['patch', 'minor'], |
||||
groupName: 'devDependencies (non-major)', |
||||
extends: ['schedule:weekly'], |
||||
}, |
||||
{ |
||||
// Group all eslint-related packages with `eslint` in the same PR |
||||
matchManagers: ['npm'], |
||||
matchPackageNames: ['eslint'], |
||||
matchPackagePrefixes: ['eslint-', '@typescript-eslint/'], |
||||
matchUpdateTypes: ['patch', 'minor'], |
||||
groupName: 'eslint (non-major)', |
||||
}, |
||||
{ |
||||
// Update @types/* packages every week, with one grouped PR |
||||
matchPackagePrefixes: '@types/', |
||||
matchUpdateTypes: ['patch', 'minor'], |
||||
groupName: 'DefinitelyTyped types (non-major)', |
||||
extends: ['schedule:weekly'], |
||||
addLabels: ['typescript'], |
||||
}, |
||||
{ |
||||
// We want those packages to always have their own PR |
||||
matchManagers: ['npm'], |
||||
matchPackageNames: [ |
||||
'typescript', // Typescript has code-impacting changes in minor versions |
||||
], |
||||
groupName: null, // We dont want them to belong to any group |
||||
}, |
||||
// Add labels depending on package manager |
||||
{ matchManagers: ['npm', 'nvm'], addLabels: ['javascript'] }, |
||||
{ matchManagers: ['bundler', 'ruby-version'], addLabels: ['ruby'] }, |
||||
{ matchManagers: ['docker-compose', 'dockerfile'], addLabels: ['docker'] }, |
||||
{ matchManagers: ['github-actions'], addLabels: ['github_actions'] }, |
||||
], |
||||
} |
@ -1,99 +0,0 @@ |
||||
on: |
||||
workflow_call: |
||||
inputs: |
||||
platforms: |
||||
required: true |
||||
type: string |
||||
cache: |
||||
type: boolean |
||||
default: true |
||||
use_native_arm64_builder: |
||||
type: boolean |
||||
push_to_images: |
||||
type: string |
||||
version_prerelease: |
||||
type: string |
||||
version_metadata: |
||||
type: string |
||||
flavor: |
||||
type: string |
||||
tags: |
||||
type: string |
||||
labels: |
||||
type: string |
||||
|
||||
jobs: |
||||
build-image: |
||||
runs-on: ubuntu-latest |
||||
|
||||
steps: |
||||
- uses: actions/checkout@v4 |
||||
|
||||
- uses: docker/setup-qemu-action@v3 |
||||
if: contains(inputs.platforms, 'linux/arm64') && !inputs.use_native_arm64_builder |
||||
|
||||
- uses: docker/setup-buildx-action@v3 |
||||
id: buildx |
||||
if: ${{ !(inputs.use_native_arm64_builder && contains(inputs.platforms, 'linux/arm64')) }} |
||||
|
||||
- name: Start a local Docker Builder |
||||
if: inputs.use_native_arm64_builder && contains(inputs.platforms, 'linux/arm64') |
||||
run: | |
||||
docker run --rm -d --name buildkitd -p 1234:1234 --privileged moby/buildkit:latest --addr tcp://0.0.0.0:1234 |
||||
|
||||
- uses: docker/setup-buildx-action@v3 |
||||
id: buildx-native |
||||
if: inputs.use_native_arm64_builder && contains(inputs.platforms, 'linux/arm64') |
||||
with: |
||||
driver: remote |
||||
endpoint: tcp://localhost:1234 |
||||
platforms: linux/amd64 |
||||
append: | |
||||
- endpoint: tcp://${{ vars.DOCKER_BUILDER_HETZNER_ARM64_01_HOST }}:13865 |
||||
platforms: linux/arm64 |
||||
name: mastodon-docker-builder-arm64-01 |
||||
driver-opts: |
||||
- servername=mastodon-docker-builder-arm64-01 |
||||
env: |
||||
BUILDER_NODE_1_AUTH_TLS_CACERT: ${{ secrets.DOCKER_BUILDER_HETZNER_ARM64_01_CACERT }} |
||||
BUILDER_NODE_1_AUTH_TLS_CERT: ${{ secrets.DOCKER_BUILDER_HETZNER_ARM64_01_CERT }} |
||||
BUILDER_NODE_1_AUTH_TLS_KEY: ${{ secrets.DOCKER_BUILDER_HETZNER_ARM64_01_KEY }} |
||||
|
||||
- name: Log in to Docker Hub |
||||
if: contains(inputs.push_to_images, 'tootsuite') |
||||
uses: docker/login-action@v3 |
||||
with: |
||||
username: ${{ secrets.DOCKERHUB_USERNAME }} |
||||
password: ${{ secrets.DOCKERHUB_TOKEN }} |
||||
|
||||
- name: Log in to the Github Container registry |
||||
if: contains(inputs.push_to_images, 'ghcr.io') |
||||
uses: docker/login-action@v3 |
||||
with: |
||||
registry: ghcr.io |
||||
username: ${{ github.actor }} |
||||
password: ${{ secrets.GITHUB_TOKEN }} |
||||
|
||||
- uses: docker/metadata-action@v5 |
||||
id: meta |
||||
if: ${{ inputs.push_to_images != '' }} |
||||
with: |
||||
images: ${{ inputs.push_to_images }} |
||||
flavor: ${{ inputs.flavor }} |
||||
tags: ${{ inputs.tags }} |
||||
labels: ${{ inputs.labels }} |
||||
|
||||
- uses: docker/build-push-action@v5 |
||||
with: |
||||
context: . |
||||
build-args: | |
||||
MASTODON_VERSION_PRERELEASE=${{ inputs.version_prerelease }} |
||||
MASTODON_VERSION_METADATA=${{ inputs.version_metadata }} |
||||
platforms: ${{ inputs.platforms }} |
||||
provenance: false |
||||
builder: ${{ steps.buildx.outputs.name || steps.buildx-native.outputs.name }} |
||||
push: ${{ inputs.push_to_images != '' }} |
||||
tags: ${{ steps.meta.outputs.tags }} |
||||
labels: ${{ steps.meta.outputs.labels }} |
||||
cache-from: ${{ inputs.cache && 'type=gha' || '' }} |
||||
cache-to: ${{ inputs.cache && 'type=gha,mode=max' || '' }} |
@ -0,0 +1,43 @@ |
||||
name: Build container image |
||||
on: |
||||
workflow_dispatch: |
||||
push: |
||||
branches: |
||||
- 'main' |
||||
pull_request: |
||||
paths: |
||||
- .github/workflows/build-image.yml |
||||
- Dockerfile |
||||
permissions: |
||||
contents: read |
||||
packages: write |
||||
|
||||
jobs: |
||||
build-image: |
||||
runs-on: ubuntu-latest |
||||
steps: |
||||
- uses: actions/checkout@v3 |
||||
- uses: docker/setup-qemu-action@v2 |
||||
- uses: docker/setup-buildx-action@v2 |
||||
- uses: docker/login-action@v2 |
||||
with: |
||||
registry: ghcr.io |
||||
username: ${{ github.repository_owner }} |
||||
password: ${{ secrets.GITHUB_TOKEN }} |
||||
if: github.event_name != 'pull_request' |
||||
- uses: docker/metadata-action@v4 |
||||
id: meta |
||||
with: |
||||
images: ghcr.io/${{ github.repository_owner }}/mastodon |
||||
tags: | |
||||
type=raw,value=latest,enable={{is_default_branch}} |
||||
type=edge,branch=main |
||||
type=sha,prefix=,format=long |
||||
- uses: docker/build-push-action@v3 |
||||
with: |
||||
context: . |
||||
platforms: linux/amd64,linux/arm64 |
||||
push: ${{ github.event_name != 'pull_request' }} |
||||
tags: ${{ steps.meta.outputs.tags }} |
||||
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/mastodon:edge |
||||
cache-to: type=inline |
@ -1,42 +0,0 @@ |
||||
name: Build nightly container image |
||||
on: |
||||
workflow_dispatch: |
||||
schedule: |
||||
- cron: '0 2 * * *' # run at 2 AM UTC |
||||
|
||||
permissions: |
||||
contents: read |
||||
packages: write |
||||
|
||||
jobs: |
||||
compute-suffix: |
||||
runs-on: ubuntu-latest |
||||
if: github.repository == 'glitch-soc/mastodon' |
||||
steps: |
||||
- id: version_vars |
||||
env: |
||||
TZ: Etc/UTC |
||||
run: | |
||||
echo mastodon_version_prerelease=nightly.$(date +'%Y-%m-%d')>> $GITHUB_OUTPUT |
||||
outputs: |
||||
prerelease: ${{ steps.version_vars.outputs.mastodon_version_prerelease }} |
||||
|
||||
build-image: |
||||
needs: compute-suffix |
||||
uses: ./.github/workflows/build-container-image.yml |
||||
with: |
||||
platforms: linux/amd64,linux/arm64 |
||||
use_native_arm64_builder: false |
||||
cache: false |
||||
push_to_images: | |
||||
ghcr.io/${{ github.repository_owner }}/mastodon |
||||
version_prerelease: ${{ needs.compute-suffix.outputs.prerelease }} |
||||
labels: | |
||||
org.opencontainers.image.description=Nightly build image used for testing purposes |
||||
flavor: | |
||||
latest=true |
||||
tags: | |
||||
type=raw,value=edge |
||||
type=raw,value=nightly |
||||
type=schedule,pattern=${{ needs.compute-suffix.outputs.prerelease }} |
||||
secrets: inherit |
@ -1,41 +0,0 @@ |
||||
name: Build container image for PR |
||||
on: |
||||
pull_request: |
||||
types: [labeled, synchronize, reopened, ready_for_review, opened] |
||||
|
||||
permissions: |
||||
contents: read |
||||
packages: write |
||||
|
||||
jobs: |
||||
compute-suffix: |
||||
runs-on: ubuntu-latest |
||||
# This is only allowed to run if: |
||||
# - the PR branch is in the `mastodon/mastodon` repository |
||||
# - the PR is not a draft |
||||
# - the PR has the "build-image" label |
||||
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && !github.event.pull_request.draft && contains(github.event.pull_request.labels.*.name, 'build-image') }} |
||||
steps: |
||||
# Repository needs to be cloned so `git rev-parse` below works |
||||
- name: Clone repository |
||||
uses: actions/checkout@v4 |
||||
- id: version_vars |
||||
run: | |
||||
echo mastodon_version_metadata=pr-${{ github.event.pull_request.number }}-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT |
||||
outputs: |
||||
metadata: ${{ steps.version_vars.outputs.mastodon_version_metadata }} |
||||
|
||||
build-image: |
||||
needs: compute-suffix |
||||
uses: ./.github/workflows/build-container-image.yml |
||||
with: |
||||
platforms: linux/amd64,linux/arm64 |
||||
use_native_arm64_builder: false |
||||
push_to_images: | |
||||
ghcr.io/${{ github.repository_owner }}/mastodon |
||||
version_metadata: ${{ needs.compute-suffix.outputs.metadata }} |
||||
flavor: | |
||||
latest=auto |
||||
tags: | |
||||
type=ref,event=pr |
||||
secrets: inherit |
@ -1,28 +0,0 @@ |
||||
name: Build container release images |
||||
on: |
||||
push: |
||||
tags: |
||||
- '*' |
||||
|
||||
permissions: |
||||
contents: read |
||||
packages: write |
||||
|
||||
jobs: |
||||
build-image: |
||||
uses: ./.github/workflows/build-container-image.yml |
||||
with: |
||||
platforms: linux/amd64,linux/arm64 |
||||
use_native_arm64_builder: false |
||||
push_to_images: | |
||||
ghcr.io/${{ github.repository_owner }}/mastodon |
||||
# Do not use cache when building releases, so apt update is always ran and the release always contain the latest packages |
||||
cache: false |
||||
# Only tag with latest when ran against the latest stable branch |
||||
# This needs to be updated after each minor version release |
||||
flavor: | |
||||
latest=${{ startsWith(github.ref, 'refs/tags/v4.2.') }} |
||||
tags: | |
||||
type=pep440,pattern={{raw}} |
||||
type=pep440,pattern=v{{major}}.{{minor}} |
||||
secrets: inherit |
@ -1,40 +0,0 @@ |
||||
name: Bundler Audit |
||||
on: |
||||
push: |
||||
branches-ignore: |
||||
- 'dependabot/**' |
||||
paths: |
||||
- 'Gemfile*' |
||||
- '.ruby-version' |
||||
- '.bundler-audit.yml' |
||||
- '.github/workflows/bundler-audit.yml' |
||||
|
||||
pull_request: |
||||
paths: |
||||
- 'Gemfile*' |
||||
- '.ruby-version' |
||||
- '.bundler-audit.yml' |
||||
- '.github/workflows/bundler-audit.yml' |
||||
|
||||
schedule: |
||||
- cron: '0 5 * * 1' |
||||
|
||||
jobs: |
||||
security: |
||||
runs-on: ubuntu-latest |
||||
|
||||
steps: |
||||
- name: Clone repository |
||||
uses: actions/checkout@v4 |
||||
|
||||
- name: Install native Ruby dependencies |
||||
run: sudo apt-get install -y libicu-dev libidn11-dev |
||||
|
||||
- name: Set up Ruby |
||||
uses: ruby/setup-ruby@v1 |
||||
with: |
||||
ruby-version: .ruby-version |
||||
bundler-cache: true |
||||
|
||||
- name: Run bundler-audit |
||||
run: bundle exec bundler-audit |
@ -1,78 +0,0 @@ |
||||
name: Crowdin / Download translations |
||||
on: |
||||
schedule: |
||||
- cron: '17 4 * * *' # Every day |
||||
workflow_dispatch: |
||||
|
||||
permissions: |
||||
contents: write |
||||
pull-requests: write |
||||
|
||||
jobs: |
||||
download-translations: |
||||
runs-on: ubuntu-latest |
||||
if: github.repository == 'glitch-soc/mastodon' |
||||
|
||||
steps: |
||||
- name: Checkout |
||||
uses: actions/checkout@v4 |
||||
|
||||
- name: Increase Git http.postBuffer |
||||
# This is needed due to a bug in Ubuntu's cURL version? |
||||
# See https://github.com/orgs/community/discussions/55820 |
||||
run: | |
||||
git config --global http.version HTTP/1.1 |
||||
git config --global http.postBuffer 157286400 |
||||
|
||||
# Download the translation files from Crowdin |
||||
- name: crowdin action |
||||
uses: crowdin/github-action@v1 |
||||
with: |
||||
config: crowdin-glitch.yml |
||||
upload_sources: false |
||||
upload_translations: false |
||||
download_translations: true |
||||
crowdin_branch_name: main |
||||
push_translations: false |
||||
create_pull_request: false |
||||
env: |
||||
CROWDIN_PROJECT_ID: ${{ vars.CROWDIN_PROJECT_ID }} |
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} |
||||
|
||||
# As the files are extracted from a Docker container, they belong to root:root |
||||
# We need to fix this before the next steps |
||||
- name: Fix file permissions |
||||
run: sudo chown -R runner:docker . |
||||
|
||||
# This is needed to run the normalize step |
||||
- name: Install native Ruby dependencies |
||||
run: sudo apt-get install -y libicu-dev libidn11-dev |
||||
|
||||
- name: Set up Ruby |
||||
uses: ruby/setup-ruby@v1 |
||||
with: |
||||
ruby-version: .ruby-version |
||||
bundler-cache: true |
||||
|
||||
- name: Run i18n normalize task |
||||
run: bundle exec i18n-tasks normalize |
||||
|
||||
# Create or update the pull request |
||||
- name: Create Pull Request |
||||
uses: peter-evans/create-pull-request@v5.0.2 |
||||
with: |
||||
commit-message: 'New Crowdin translations' |
||||
title: 'New Crowdin Translations (automated)' |
||||
author: 'GitHub Actions <noreply@github.com>' |
||||
body: | |
||||
New Crowdin translations, automated with Github Actions |
||||
|
||||
See `.github/workflows/crowdin-download.yml` |
||||
|
||||
This PR will be updated every day with new translations. |
||||
|
||||
Due to a limitation in Github Actions, checks are not running on this PR without manual action. |
||||
If you want to run the checks, then close and re-open it. |
||||
branch: i18n/crowdin/translations |
||||
base: main |
||||
labels: i18n |
@ -1,36 +0,0 @@ |
||||
name: Crowdin / Upload translations |
||||
|
||||
on: |
||||
push: |
||||
branches: |
||||
- main |
||||
paths: |
||||
- crowdin.yml |
||||
- app/javascript/mastodon/locales/en.json |
||||
- config/locales/en.yml |
||||
- config/locales/simple_form.en.yml |
||||
- config/locales/activerecord.en.yml |
||||
- config/locales/devise.en.yml |
||||
- config/locales/doorkeeper.en.yml |
||||
- .github/workflows/crowdin-upload.yml |
||||
|
||||
jobs: |
||||
upload-translations: |
||||
runs-on: ubuntu-latest |
||||
|
||||
steps: |
||||
- name: Checkout |
||||
uses: actions/checkout@v4 |
||||
|
||||
- name: crowdin action |
||||
uses: crowdin/github-action@v1 |
||||
with: |
||||
config: crowdin-glitch.yml |
||||
upload_sources: true |
||||
upload_translations: false |
||||
download_translations: false |
||||
crowdin_branch_name: main |
||||
|
||||
env: |
||||
CROWDIN_PROJECT_ID: ${{ vars.CROWDIN_PROJECT_ID }} |
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} |
@ -1,17 +0,0 @@ |
||||
{ |
||||
"problemMatcher": [ |
||||
{ |
||||
"owner": "haml-lint", |
||||
"severity": "warning", |
||||
"pattern": [ |
||||
{ |
||||
"regexp": "^(.*):(\\d+)\\s\\[W]\\s(.*):\\s(.*)$", |
||||
"file": 1, |
||||
"line": 2, |
||||
"code": 3, |
||||
"message": 4 |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
@ -1,52 +0,0 @@ |
||||
name: CSS Linting |
||||
on: |
||||
push: |
||||
branches-ignore: |
||||
- 'dependabot/**' |
||||
- 'renovate/**' |
||||
paths: |
||||
- 'package.json' |
||||
- 'yarn.lock' |
||||
- '.nvmrc' |
||||
- '.prettier*' |
||||
- 'stylelint.config.js' |
||||
- '**/*.css' |
||||
- '**/*.scss' |
||||
- '.github/workflows/lint-css.yml' |
||||
- '.github/stylelint-matcher.json' |
||||
|
||||
pull_request: |
||||
paths: |
||||
- 'package.json' |
||||
- 'yarn.lock' |
||||
- '.nvmrc' |
||||
- '.prettier*' |
||||
- 'stylelint.config.js' |
||||
- '**/*.css' |
||||
- '**/*.scss' |
||||
- '.github/workflows/lint-css.yml' |
||||
- '.github/stylelint-matcher.json' |
||||
|
||||
jobs: |
||||
lint: |
||||
runs-on: ubuntu-latest |
||||
|
||||
steps: |
||||
- name: Clone repository |
||||
uses: actions/checkout@v4 |
||||
|
||||
- name: Set up Node.js |
||||
uses: actions/setup-node@v3 |
||||
with: |
||||
cache: yarn |
||||
node-version-file: '.nvmrc' |
||||
|
||||
- name: Install all yarn packages |
||||
run: yarn --frozen-lockfile |
||||
|
||||
- uses: xt0rted/stylelint-problem-matcher@v1 |
||||
|
||||
- run: echo "::add-matcher::.github/stylelint-matcher.json" |
||||
|
||||
- name: Stylelint |
||||
run: yarn lint:sass |
@ -1,47 +0,0 @@ |
||||
name: Haml Linting |
||||
on: |
||||
push: |
||||
branches-ignore: |
||||
- 'dependabot/**' |
||||
- 'renovate/**' |
||||
paths: |
||||
- '.github/workflows/haml-lint-problem-matcher.json' |
||||
- '.github/workflows/lint-haml.yml' |
||||
- '.haml-lint*.yml' |
||||
- '.rubocop*.yml' |
||||
- '.ruby-version' |
||||
- '**/*.haml' |
||||
- 'Gemfile*' |
||||
|
||||
pull_request: |
||||
paths: |
||||
- '.github/workflows/haml-lint-problem-matcher.json' |
||||
- '.github/workflows/lint-haml.yml' |
||||
- '.haml-lint*.yml' |
||||
- '.rubocop*.yml' |
||||
- '.ruby-version' |
||||
- '**/*.haml' |
||||
- 'Gemfile*' |
||||
|
||||
jobs: |
||||
lint: |
||||
runs-on: ubuntu-latest |
||||
steps: |
||||
- name: Clone repository |
||||
uses: actions/checkout@v4 |
||||
|
||||
- name: Install native Ruby dependencies |
||||
run: | |
||||
sudo apt-get update |
||||
sudo apt-get install -y libicu-dev libidn11-dev |
||||
|
||||
- name: Set up Ruby |
||||
uses: ruby/setup-ruby@v1 |
||||
with: |
||||
ruby-version: .ruby-version |
||||
bundler-cache: true |
||||
|
||||
- name: Run haml-lint |
||||
run: | |
||||
echo "::add-matcher::.github/workflows/haml-lint-problem-matcher.json" |
||||
bundle exec haml-lint |
@ -1,55 +0,0 @@ |
||||
name: JavaScript Linting |
||||
on: |
||||
push: |
||||
branches-ignore: |
||||
- 'dependabot/**' |
||||
- 'renovate/**' |
||||
paths: |
||||
- 'package.json' |
||||
- 'yarn.lock' |
||||
- 'tsconfig.json' |
||||
- '.nvmrc' |
||||
- '.prettier*' |
||||
- '.eslint*' |
||||
- '**/*.js' |
||||
- '**/*.jsx' |
||||
- '**/*.ts' |
||||
- '**/*.tsx' |
||||
- '.github/workflows/lint-js.yml' |
||||
|
||||
pull_request: |
||||
paths: |
||||
- 'package.json' |
||||
- 'yarn.lock' |
||||
- 'tsconfig.json' |
||||
- '.nvmrc' |
||||
- '.prettier*' |
||||
- '.eslint*' |
||||
- '**/*.js' |
||||
- '**/*.jsx' |
||||
- '**/*.ts' |
||||
- '**/*.tsx' |
||||
- '.github/workflows/lint-js.yml' |
||||
|
||||
jobs: |
||||
lint: |
||||
runs-on: ubuntu-latest |
||||
|
||||
steps: |
||||
- name: Clone repository |
||||
uses: actions/checkout@v4 |
||||
|
||||
- name: Set up Node.js |
||||
uses: actions/setup-node@v3 |
||||
with: |
||||
cache: yarn |
||||
node-version-file: '.nvmrc' |
||||
|
||||
- name: Install all yarn packages |
||||
run: yarn --frozen-lockfile |
||||
|
||||
- name: ESLint |
||||
run: yarn lint:js --max-warnings 0 |
||||
|
||||
- name: Typecheck |
||||
run: yarn typecheck |
@ -1,44 +0,0 @@ |
||||
name: JSON Linting |
||||
on: |
||||
push: |
||||
branches-ignore: |
||||
- 'dependabot/**' |
||||
- 'renovate/**' |
||||
paths: |
||||
- 'package.json' |
||||
- 'yarn.lock' |
||||
- '.nvmrc' |
||||
- '.prettier*' |
||||
- '**/*.json' |
||||
- '.github/workflows/lint-json.yml' |
||||
- '!app/javascript/mastodon/locales/*.json' |
||||
|
||||
pull_request: |
||||
paths: |
||||
- 'package.json' |
||||
- 'yarn.lock' |
||||
- '.nvmrc' |
||||
- '.prettier*' |
||||
- '**/*.json' |
||||
- '.github/workflows/lint-json.yml' |
||||
- '!app/javascript/mastodon/locales/*.json' |
||||
|
||||
jobs: |
||||
lint: |
||||
runs-on: ubuntu-latest |
||||
|
||||
steps: |
||||
- name: Clone repository |
||||
uses: actions/checkout@v4 |
||||
|
||||
- name: Set up Node.js |
||||
uses: actions/setup-node@v3 |
||||
with: |
||||
cache: yarn |
||||
node-version-file: '.nvmrc' |
||||
|
||||
- name: Install all yarn packages |
||||
run: yarn --frozen-lockfile |
||||
|
||||
- name: Prettier |
||||
run: yarn lint:json |
@ -1,44 +0,0 @@ |
||||
name: Markdown Linting |
||||
on: |
||||
push: |
||||
branches-ignore: |
||||
- 'dependabot/**' |
||||
- 'renovate/**' |
||||
paths: |
||||
- '.github/workflows/lint-md.yml' |
||||
- '.nvmrc' |
||||
- '.prettier*' |
||||
- '**/*.md' |
||||
- '!AUTHORS.md' |
||||
- 'package.json' |
||||
- 'yarn.lock' |
||||
|
||||
pull_request: |
||||
paths: |
||||
- '.github/workflows/lint-md.yml' |
||||
- '.nvmrc' |
||||
- '.prettier*' |
||||
- '**/*.md' |
||||
- '!AUTHORS.md' |
||||
- 'package.json' |
||||
- 'yarn.lock' |
||||
|
||||
jobs: |
||||
lint: |
||||
runs-on: ubuntu-latest |
||||
|
||||
steps: |
||||
- name: Clone repository |
||||
uses: actions/checkout@v4 |
||||
|
||||
- name: Set up Node.js |
||||
uses: actions/setup-node@v3 |
||||
with: |
||||
cache: yarn |
||||
node-version-file: '.nvmrc' |
||||
|
||||
- name: Install all yarn packages |
||||
run: yarn --frozen-lockfile |
||||
|
||||
- name: Prettier |
||||
run: yarn lint:md |
@ -1,51 +0,0 @@ |
||||
name: Ruby Linting |
||||
on: |
||||
push: |
||||
branches-ignore: |
||||
- 'dependabot/**' |
||||
- 'renovate/**' |
||||
paths: |
||||
- 'Gemfile*' |
||||
- '.rubocop*.yml' |
||||
- '.ruby-version' |
||||
- 'config/brakeman.ignore' |
||||
- '**/*.rb' |
||||
- '**/*.rake' |
||||
- '.github/workflows/lint-ruby.yml' |
||||
|
||||
pull_request: |
||||
paths: |
||||
- 'Gemfile*' |
||||
- '.rubocop*.yml' |
||||
- '.ruby-version' |
||||
- 'config/brakeman.ignore' |
||||
- '**/*.rb' |
||||
- '**/*.rake' |
||||
- '.github/workflows/lint-ruby.yml' |
||||
|
||||
jobs: |
||||
lint: |
||||
runs-on: ubuntu-latest |
||||
|
||||
steps: |
||||
- name: Clone repository |
||||
uses: actions/checkout@v4 |
||||
|
||||
- name: Install native Ruby dependencies |
||||
run: sudo apt-get install -y libicu-dev libidn11-dev |
||||
|
||||
- name: Set up Ruby |
||||
uses: ruby/setup-ruby@v1 |
||||
with: |
||||
ruby-version: .ruby-version |
||||
bundler-cache: true |
||||
|
||||
- name: Set-up RuboCop Problem Matcher |
||||
uses: r7kamura/rubocop-problem-matchers-action@v1 |
||||
|
||||
- name: Run rubocop |
||||
run: bundle exec rubocop |
||||
|
||||
- name: Run brakeman |
||||
if: always() # Run both checks, even if the first failed |
||||
run: bundle exec brakeman |
@ -1,46 +0,0 @@ |
||||
name: YML Linting |
||||
on: |
||||
push: |
||||
branches-ignore: |
||||
- 'dependabot/**' |
||||
- 'renovate/**' |
||||
paths: |
||||
- 'package.json' |
||||
- 'yarn.lock' |
||||
- '.nvmrc' |
||||
- '.prettier*' |
||||
- '**/*.yaml' |
||||
- '**/*.yml' |
||||
- '.github/workflows/lint-yml.yml' |
||||
- '!config/locales/*.yml' |
||||
|
||||
pull_request: |
||||
paths: |
||||
- 'package.json' |
||||
- 'yarn.lock' |
||||
- '.nvmrc' |
||||
- '.prettier*' |
||||
- '**/*.yaml' |
||||
- '**/*.yml' |
||||
- '.github/workflows/lint-yml.yml' |
||||
- '!config/locales/*.yml' |
||||
|
||||
jobs: |
||||
lint: |
||||
runs-on: ubuntu-latest |
||||
|
||||
steps: |
||||
- name: Clone repository |
||||
uses: actions/checkout@v4 |
||||
|
||||
- name: Set up Node.js |
||||
uses: actions/setup-node@v3 |
||||
with: |
||||
cache: yarn |
||||
node-version-file: '.nvmrc' |
||||
|
||||
- name: Install all yarn packages |
||||
run: yarn --frozen-lockfile |
||||
|
||||
- name: Prettier |
||||
run: yarn lint:yml |
@ -0,0 +1,83 @@ |
||||
--- |
||||
################################# |
||||
################################# |
||||
## Super Linter GitHub Actions ## |
||||
################################# |
||||
################################# |
||||
name: Lint Code Base |
||||
|
||||
# |
||||
# Documentation: |
||||
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions |
||||
# |
||||
|
||||
############################# |
||||
# Start the job on all push # |
||||
############################# |
||||
on: |
||||
push: |
||||
branches-ignore: [main] |
||||
# Remove the line above to run when pushing to master |
||||
pull_request: |
||||
branches: [main] |
||||
|
||||
############### |
||||
# Set the Job # |
||||
############### |
||||
permissions: |
||||
checks: write |
||||
contents: read |
||||
pull-requests: write |
||||
statuses: write |
||||
|
||||
jobs: |
||||
build: |
||||
# Name the Job |
||||
name: Lint Code Base |
||||
# Set the agent to run on |
||||
runs-on: ubuntu-latest |
||||
|
||||
################## |
||||
# Load all steps # |
||||
################## |
||||
steps: |
||||
########################## |
||||
# Checkout the code base # |
||||
########################## |
||||
- name: Checkout Code |
||||
uses: actions/checkout@v3 |
||||
with: |
||||
# Full git history is needed to get a proper list of changed files within `super-linter` |
||||
fetch-depth: 0 |
||||
|
||||
- name: Set-up Node.js |
||||
uses: actions/setup-node@v3 |
||||
with: |
||||
node-version: 16.x |
||||
cache: yarn |
||||
- name: Install dependencies |
||||
run: yarn install --frozen-lockfile |
||||
- name: Set-up RuboCop Problem Mathcher |
||||
uses: r7kamura/rubocop-problem-matchers-action@v1 |
||||
- name: Set-up Stylelint Problem Matcher |
||||
uses: xt0rted/stylelint-problem-matcher@v1 |
||||
# https://github.com/xt0rted/stylelint-problem-matcher/issues/360 |
||||
- run: echo "::add-matcher::.github/stylelint-matcher.json" |
||||
|
||||
################################ |
||||
# Run Linter against code base # |
||||
################################ |
||||
- name: Lint Code Base |
||||
uses: github/super-linter@v4 |
||||
env: |
||||
CSS_FILE_NAME: stylelint.config.js |
||||
DEFAULT_BRANCH: main |
||||
NO_COLOR: 1 # https://github.com/xt0rted/stylelint-problem-matcher/issues/360 |
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
||||
JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.js |
||||
LINTER_RULES_PATH: . |
||||
RUBY_CONFIG_FILE: .rubocop.yml |
||||
VALIDATE_ALL_CODEBASE: false |
||||
VALIDATE_CSS: true |
||||
VALIDATE_JAVASCRIPT_ES: true |
||||
VALIDATE_RUBY: true |
@ -1,27 +0,0 @@ |
||||
name: PR Needs Rebase |
||||
|
||||
on: |
||||
schedule: |
||||
- cron: '0 * * * *' |
||||
|
||||
permissions: |
||||
pull-requests: write |
||||
|
||||
jobs: |
||||
label-rebase-needed: |
||||
runs-on: ubuntu-latest |
||||
|
||||
concurrency: |
||||
group: ${{ github.workflow }}-${{ github.ref }} |
||||
cancel-in-progress: true |
||||
|
||||
steps: |
||||
- name: Check for merge conflicts |
||||
uses: eps1lon/actions-label-merge-conflict@releases/2.x |
||||
with: |
||||
dirtyLabel: 'rebase needed :construction:' |
||||
repoToken: '${{ secrets.GITHUB_TOKEN }}' |
||||
commentOnClean: This pull request has resolved merge conflicts and is ready for review. |
||||
commentOnDirty: This pull request has merge conflicts that must be resolved before it can be merged. |
||||
retryMax: 30 |
||||
continueOnMissingPermissions: false |
@ -0,0 +1,138 @@ |
||||
# This is a GitHub workflow defining a set of jobs with a set of steps. |
||||
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions |
||||
# |
||||
name: Test chart |
||||
|
||||
on: |
||||
pull_request: |
||||
paths: |
||||
- "chart/**" |
||||
- "!**.md" |
||||
- ".github/workflows/test-chart.yml" |
||||
push: |
||||
paths: |
||||
- "chart/**" |
||||
- "!**.md" |
||||
- ".github/workflows/test-chart.yml" |
||||
branches-ignore: |
||||
- "dependabot/**" |
||||
workflow_dispatch: |
||||
|
||||
permissions: |
||||
contents: read |
||||
|
||||
defaults: |
||||
run: |
||||
working-directory: chart |
||||
|
||||
jobs: |
||||
lint-templates: |
||||
runs-on: ubuntu-22.04 |
||||
|
||||
steps: |
||||
- uses: actions/checkout@v3 |
||||
- uses: actions/setup-python@v4 |
||||
with: |
||||
python-version: "3.x" |
||||
|
||||
- name: Install dependencies (yamllint) |
||||
run: pip install yamllint |
||||
|
||||
- run: helm dependency update |
||||
|
||||
- name: helm lint |
||||
run: | |
||||
helm lint . \ |
||||
--values dev-values.yaml |
||||
|
||||
- name: helm template |
||||
run: | |
||||
helm template . \ |
||||
--values dev-values.yaml \ |
||||
--output-dir rendered-templates |
||||
|
||||
- name: yamllint (only on templates we manage) |
||||
run: | |
||||
rm -rf rendered-templates/mastodon/charts |
||||
|
||||
yamllint rendered-templates \ |
||||
--config-data "{rules: {indentation: {spaces: 2}, line-length: disable}}" |
||||
|
||||
# This job helps us validate that rendered templates are valid k8s resources |
||||
# against a k8s api-server, via "helm template --validate", but also that a |
||||
# basic configuration can be used to successfully startup mastodon. |
||||
# |
||||
test-install: |
||||
runs-on: ubuntu-22.04 |
||||
timeout-minutes: 15 |
||||
|
||||
strategy: |
||||
fail-fast: false |
||||
matrix: |
||||
include: |
||||
# k3s-channel reference: https://update.k3s.io/v1-release/channels |
||||
- k3s-channel: latest |
||||
- k3s-channel: stable |
||||
|
||||
# This represents the oldest configuration we test against. |
||||
# |
||||
# The k8s version chosen is based on the oldest still supported k8s |
||||
# version among two managed k8s services, GKE, EKS. |
||||
# - GKE: https://endoflife.date/google-kubernetes-engine |
||||
# - EKS: https://endoflife.date/amazon-eks |
||||
# |
||||
# The helm client's version can influence what helper functions is |
||||
# available for use in the templates, currently we need v3.6.0 or |
||||
# higher. |
||||
# |
||||
- k3s-channel: v1.21 |
||||
helm-version: v3.6.0 |
||||
|
||||
steps: |
||||
- uses: actions/checkout@v3 |
||||
|
||||
# This action starts a k8s cluster with NetworkPolicy enforcement and |
||||
# installs both kubectl and helm. |
||||
# |
||||
# ref: https://github.com/jupyterhub/action-k3s-helm#readme |
||||
# |
||||
- uses: jupyterhub/action-k3s-helm@v3 |
||||
with: |
||||
k3s-channel: ${{ matrix.k3s-channel }} |
||||
helm-version: ${{ matrix.helm-version }} |
||||
metrics-enabled: false |
||||
traefik-enabled: false |
||||
docker-enabled: false |
||||
|
||||
- run: helm dependency update |
||||
|
||||
# Validate rendered helm templates against the k8s api-server |
||||
- name: helm template --validate |
||||
run: | |
||||
helm template --validate mastodon . \ |
||||
--values dev-values.yaml |
||||
|
||||
- name: helm install |
||||
run: | |
||||
helm install mastodon . \ |
||||
--values dev-values.yaml \ |
||||
--timeout 10m |
||||
|
||||
# This actions provides a report about the state of the k8s cluster, |
||||
# providing logs etc on anything that has failed and workloads marked as |
||||
# important. |
||||
# |
||||
# ref: https://github.com/jupyterhub/action-k8s-namespace-report#readme |
||||
# |
||||
- name: Kubernetes namespace report |
||||
uses: jupyterhub/action-k8s-namespace-report@v1 |
||||
if: always() |
||||
with: |
||||
important-workloads: >- |
||||
deploy/mastodon-sidekiq |
||||
deploy/mastodon-streaming |
||||
deploy/mastodon-web |
||||
job/mastodon-assets-precompile |
||||
job/mastodon-chewy-upgrade |
||||
job/mastodon-create-admin |
||||
job/mastodon-db-migrate |
@ -1,21 +0,0 @@ |
||||
name: Test container image build |
||||
on: |
||||
pull_request: |
||||
paths: |
||||
- .github/workflows/build-nightly.yml |
||||
- .github/workflows/build-push-pr.yml |
||||
- .github/workflows/build-releases.yml |
||||
- .github/workflows/test-image-build.yml |
||||
- Dockerfile |
||||
permissions: |
||||
contents: read |
||||
|
||||
jobs: |
||||
build-image: |
||||
concurrency: |
||||
group: ${{ github.workflow }}-${{ github.ref }} |
||||
cancel-in-progress: true |
||||
|
||||
uses: ./.github/workflows/build-container-image.yml |
||||
with: |
||||
platforms: linux/amd64 # Testing only on native platform so it is performant |
@ -1,48 +0,0 @@ |
||||
name: JavaScript Testing |
||||
on: |
||||
push: |
||||
branches-ignore: |
||||
- 'dependabot/**' |
||||
- 'renovate/**' |
||||
paths: |
||||
- 'package.json' |
||||
- 'yarn.lock' |
||||
- '.nvmrc' |
||||
- '**/*.js' |
||||
- '**/*.jsx' |
||||
- '**/*.ts' |
||||
- '**/*.tsx' |
||||
- '**/*.snap' |
||||
- '.github/workflows/test-js.yml' |
||||
|
||||
pull_request: |
||||
paths: |
||||
- 'package.json' |
||||
- 'yarn.lock' |
||||
- '.nvmrc' |
||||
- '**/*.js' |
||||
- '**/*.jsx' |
||||
- '**/*.ts' |
||||
- '**/*.tsx' |
||||
- '**/*.snap' |
||||
- '.github/workflows/test-js.yml' |
||||
|
||||
jobs: |
||||
test: |
||||
runs-on: ubuntu-latest |
||||
|
||||
steps: |
||||
- name: Clone repository |
||||
uses: actions/checkout@v4 |
||||
|
||||
- name: Set up Node.js |
||||
uses: actions/setup-node@v3 |
||||
with: |
||||
cache: yarn |
||||
node-version-file: '.nvmrc' |
||||
|
||||
- name: Install all yarn packages |
||||
run: yarn --frozen-lockfile |
||||
|
||||
- name: Jest testing |
||||
run: yarn jest --reporters github-actions summary |
@ -1,111 +0,0 @@ |
||||
name: Test one step migrations |
||||
on: |
||||
push: |
||||
branches-ignore: |
||||
- 'dependabot/**' |
||||
- 'renovate/**' |
||||
pull_request: |
||||
|
||||
jobs: |
||||
pre_job: |
||||
runs-on: ubuntu-latest |
||||
|
||||
outputs: |
||||
should_skip: ${{ steps.skip_check.outputs.should_skip }} |
||||
|
||||
steps: |
||||
- id: skip_check |
||||
uses: fkirc/skip-duplicate-actions@v5 |
||||
with: |
||||
paths: '["Gemfile*", ".ruby-version", "**/*.rb", ".github/workflows/test-migrations-one-step.yml", "lib/tasks/tests.rake"]' |
||||
|
||||
test: |
||||
runs-on: ubuntu-latest |
||||
needs: pre_job |
||||
if: needs.pre_job.outputs.should_skip != 'true' |
||||
|
||||
strategy: |
||||
fail-fast: false |
||||
|
||||
matrix: |
||||
postgres: |
||||
- 14-alpine |
||||
- 15-alpine |
||||
|
||||
services: |
||||
postgres: |
||||
image: postgres:${{ matrix.postgres}} |
||||
env: |
||||
POSTGRES_PASSWORD: postgres |
||||
POSTGRES_USER: postgres |
||||
options: >- |
||||
--health-cmd pg_isready |
||||
--health-interval 10s |
||||
--health-timeout 5s |
||||
--health-retries 5 |
||||
ports: |
||||
- 5432:5432 |
||||
|
||||
redis: |
||||
image: redis:7-alpine |
||||
options: >- |
||||
--health-cmd "redis-cli ping" |
||||
--health-interval 10s |
||||
--health-timeout 5s |
||||
--health-retries 5 |
||||
ports: |
||||
- 6379:6379 |
||||
|
||||
env: |
||||
CONTINUOUS_INTEGRATION: true |
||||
DB_HOST: localhost |
||||
DB_USER: postgres |
||||
DB_PASS: postgres |
||||
DISABLE_SIMPLECOV: true |
||||
RAILS_ENV: test |
||||
BUNDLE_CLEAN: true |
||||
BUNDLE_FROZEN: true |
||||
BUNDLE_WITHOUT: 'development production' |
||||
BUNDLE_JOBS: 3 |
||||
BUNDLE_RETRY: 3 |
||||
|
||||
steps: |
||||
- uses: actions/checkout@v4 |
||||
|
||||
- name: Install native Ruby dependencies |
||||
run: | |
||||
sudo apt-get update |
||||
sudo apt-get install -y libicu-dev libidn11-dev |
||||
|
||||
- name: Set up bundler cache |
||||
uses: ruby/setup-ruby@v1 |
||||
with: |
||||
ruby-version: .ruby-version |
||||
bundler-cache: true |
||||
|
||||
- name: Create database |
||||
run: './bin/rails db:create' |
||||
|
||||
- name: Run migrations up to v2.0.0 |
||||
run: './bin/rails db:migrate VERSION=20171010025614' |
||||
|
||||
- name: Populate database with test data |
||||
run: './bin/rails tests:migrations:populate_v2' |
||||
|
||||
- name: Run migrations up to v2.4.0 |
||||
run: './bin/rails db:migrate VERSION=20180514140000' |
||||
|
||||
- name: Populate database with test data |
||||
run: './bin/rails tests:migrations:populate_v2_4' |
||||
|
||||
- name: Run migrations up to v2.4.3 |
||||
run: './bin/rails db:migrate VERSION=20180707154237' |
||||
|
||||
- name: Populate database with test data |
||||
run: './bin/rails tests:migrations:populate_v2_4_3' |
||||
|
||||
- name: Run all remaining migrations |
||||
run: './bin/rails db:migrate' |
||||
|
||||
- name: Check migration result |
||||
run: './bin/rails tests:migrations:check_database' |
@ -1,119 +0,0 @@ |
||||
name: Test two step migrations |
||||
on: |
||||
push: |
||||
branches-ignore: |
||||
- 'dependabot/**' |
||||
- 'renovate/**' |
||||
pull_request: |
||||
|
||||
jobs: |
||||
pre_job: |
||||
runs-on: ubuntu-latest |
||||
|
||||
outputs: |
||||
should_skip: ${{ steps.skip_check.outputs.should_skip }} |
||||
|
||||
steps: |
||||
- id: skip_check |
||||
uses: fkirc/skip-duplicate-actions@v5 |
||||
with: |
||||
paths: '["Gemfile*", ".ruby-version", "**/*.rb", ".github/workflows/test-migrations-two-step.yml", "lib/tasks/tests.rake"]' |
||||
|
||||
test: |
||||
runs-on: ubuntu-latest |
||||
needs: pre_job |
||||
if: needs.pre_job.outputs.should_skip != 'true' |
||||
|
||||
strategy: |
||||
fail-fast: false |
||||
|
||||
matrix: |
||||
postgres: |
||||
- 14-alpine |
||||
- 15-alpine |
||||
|
||||
services: |
||||
postgres: |
||||
image: postgres:${{ matrix.postgres}} |
||||
env: |
||||
POSTGRES_PASSWORD: postgres |
||||
POSTGRES_USER: postgres |
||||
options: >- |
||||
--health-cmd pg_isready |
||||
--health-interval 10s |
||||
--health-timeout 5s |
||||
--health-retries 5 |
||||
ports: |
||||
- 5432:5432 |
||||
redis: |
||||
image: redis:7-alpine |
||||
options: >- |
||||
--health-cmd "redis-cli ping" |
||||
--health-interval 10s |
||||
--health-timeout 5s |
||||
--health-retries 5 |
||||
ports: |
||||
- 6379:6379 |
||||
|
||||
env: |
||||
CONTINUOUS_INTEGRATION: true |
||||
DB_HOST: localhost |
||||
DB_USER: postgres |
||||
DB_PASS: postgres |
||||
DISABLE_SIMPLECOV: true |
||||
RAILS_ENV: test |
||||
BUNDLE_CLEAN: true |
||||
BUNDLE_FROZEN: true |
||||
BUNDLE_WITHOUT: 'development production' |
||||
BUNDLE_JOBS: 3 |
||||
BUNDLE_RETRY: 3 |
||||
|
||||
steps: |
||||
- uses: actions/checkout@v4 |
||||
|
||||
- name: Install native Ruby dependencies |
||||
run: | |
||||
sudo apt-get update |
||||
sudo apt-get install -y libicu-dev libidn11-dev |
||||
|
||||
- name: Set up bundler cache |
||||
uses: ruby/setup-ruby@v1 |
||||
with: |
||||
ruby-version: .ruby-version |
||||
bundler-cache: true |
||||
|
||||
- name: Create database |
||||
run: './bin/rails db:create' |
||||
|
||||
- name: Run migrations up to v2.0.0 |
||||
run: './bin/rails db:migrate VERSION=20171010025614' |
||||
|
||||
- name: Populate database with test data |
||||
run: './bin/rails tests:migrations:populate_v2' |
||||
|
||||
- name: Run pre-deployment migrations up to v2.4.0 |
||||
run: './bin/rails db:migrate VERSION=20180514140000' |
||||
env: |
||||
SKIP_POST_DEPLOYMENT_MIGRATIONS: true |
||||
|
||||
- name: Populate database with test data |
||||
run: './bin/rails tests:migrations:populate_v2_4' |
||||
|
||||
- name: Run migrations up to v2.4.3 |
||||
run: './bin/rails db:migrate VERSION=20180707154237' |
||||
env: |
||||
SKIP_POST_DEPLOYMENT_MIGRATIONS: true |
||||
|
||||
- name: Populate database with test data |
||||
run: './bin/rails tests:migrations:populate_v2_4_3' |
||||
|
||||
- name: Run all remaining pre-deployment migrations |
||||
run: './bin/rails db:migrate' |
||||
env: |
||||
SKIP_POST_DEPLOYMENT_MIGRATIONS: true |
||||
|
||||
- name: Run all post-deployment migrations |
||||
run: './bin/rails db:migrate' |
||||
|
||||
- name: Check migration result |
||||
run: './bin/rails tests:migrations:check_database' |
@ -1,371 +0,0 @@ |
||||
name: Ruby Testing |
||||
|
||||
on: |
||||
push: |
||||
branches-ignore: |
||||
- 'dependabot/**' |
||||
- 'renovate/**' |
||||
pull_request: |
||||
|
||||
env: |
||||
BUNDLE_CLEAN: true |
||||
BUNDLE_FROZEN: true |
||||
|
||||
concurrency: |
||||
group: ${{ github.workflow }}-${{ github.ref }} |
||||
cancel-in-progress: true |
||||
|
||||
jobs: |
||||
build: |
||||
runs-on: ubuntu-latest |
||||
|
||||
strategy: |
||||
fail-fast: true |
||||
matrix: |
||||
mode: |
||||
- production |
||||
- test |
||||
env: |
||||
RAILS_ENV: ${{ matrix.mode }} |
||||
BUNDLE_WITH: ${{ matrix.mode }} |
||||
OTP_SECRET: precompile_placeholder |
||||
SECRET_KEY_BASE: precompile_placeholder |
||||
|
||||
steps: |
||||
- uses: actions/checkout@v4 |
||||
|
||||
- name: Set up Node.js |
||||
uses: actions/setup-node@v3 |
||||
with: |
||||
cache: yarn |
||||
node-version-file: '.nvmrc' |
||||
|
||||
- name: Install native Ruby dependencies |
||||
run: | |
||||
sudo apt-get update |
||||
sudo apt-get install -y libicu-dev libidn11-dev |
||||
|
||||
- name: Set up bundler cache |
||||
uses: ruby/setup-ruby@v1 |
||||
with: |
||||
ruby-version: .ruby-version |
||||
bundler-cache: true |
||||
|
||||
- run: yarn --frozen-lockfile --production |
||||
- name: Precompile assets |
||||
# Previously had set this, but it's not supported |
||||
# export NODE_OPTIONS=--openssl-legacy-provider |
||||
run: |- |
||||
./bin/rails assets:precompile |
||||
|
||||
- uses: actions/upload-artifact@v3 |
||||
if: matrix.mode == 'test' |
||||
with: |
||||
path: |- |
||||
./public/assets |
||||
./public/packs-test |
||||
name: ${{ github.sha }} |
||||
retention-days: 0 |
||||
|
||||
test: |
||||
runs-on: ubuntu-latest |
||||
|
||||
needs: |
||||
- build |
||||
|
||||
services: |
||||
postgres: |
||||
image: postgres:14-alpine |
||||
env: |
||||
POSTGRES_PASSWORD: postgres |
||||
POSTGRES_USER: postgres |
||||
options: >- |
||||
--health-cmd pg_isready |
||||
--health-interval 10s |
||||
--health-timeout 5s |
||||
--health-retries 5 |
||||
ports: |
||||
- 5432:5432 |
||||
|
||||
redis: |
||||
image: redis:7-alpine |
||||
options: >- |
||||
--health-cmd "redis-cli ping" |
||||
--health-interval 10s |
||||
--health-timeout 5s |
||||
--health-retries 5 |
||||
ports: |
||||
- 6379:6379 |
||||
|
||||
env: |
||||
DB_HOST: localhost |
||||
DB_USER: postgres |
||||
DB_PASS: postgres |
||||
DISABLE_SIMPLECOV: true |
||||
RAILS_ENV: test |
||||
ALLOW_NOPAM: true |
||||
PAM_ENABLED: true |
||||
PAM_DEFAULT_SERVICE: pam_test |
||||
PAM_CONTROLLED_SERVICE: pam_test_controlled |
||||
OIDC_ENABLED: true |
||||
OIDC_SCOPE: read |
||||
SAML_ENABLED: true |
||||
CAS_ENABLED: true |
||||
BUNDLE_WITH: 'pam_authentication test' |
||||
CI_JOBS: ${{ matrix.ci_job }}/4 |
||||
GITHUB_RSPEC: ${{ matrix.ruby-version == '.ruby-version' && github.event.pull_request && 'true' }} |
||||
|
||||
strategy: |
||||
fail-fast: false |
||||
matrix: |
||||
ruby-version: |
||||
- '3.0' |
||||
- '3.1' |
||||
- '.ruby-version' |
||||
ci_job: |
||||
- 1 |
||||
- 2 |
||||
- 3 |
||||
- 4 |
||||
steps: |
||||
- uses: actions/checkout@v4 |
||||
|
||||
- uses: actions/download-artifact@v3 |
||||
with: |
||||
path: './public' |
||||
name: ${{ github.sha }} |
||||
|
||||
- name: Update package index |
||||
run: sudo apt-get update |
||||
|
||||
- name: Install native Ruby dependencies |
||||
run: sudo apt-get install -y libicu-dev libidn11-dev |
||||
|
||||
- name: Install additional system dependencies |
||||
run: sudo apt-get install -y ffmpeg imagemagick libpam-dev |
||||
|
||||
- name: Set up bundler cache |
||||
uses: ruby/setup-ruby@v1 |
||||
with: |
||||
ruby-version: ${{ matrix.ruby-version}} |
||||
bundler-cache: true |
||||
|
||||
- name: Load database schema |
||||
run: './bin/rails db:create db:schema:load db:seed' |
||||
|
||||
- run: bundle exec rake rspec_chunked |
||||
|
||||
test-e2e: |
||||
name: End to End testing |
||||
runs-on: ubuntu-latest |
||||
|
||||
needs: |
||||
- build |
||||
|
||||
services: |
||||
postgres: |
||||
image: postgres:14-alpine |
||||
env: |
||||
POSTGRES_PASSWORD: postgres |
||||
POSTGRES_USER: postgres |
||||
options: >- |
||||
--health-cmd pg_isready |
||||
--health-interval 10s |
||||
--health-timeout 5s |
||||
--health-retries 5 |
||||
ports: |
||||
- 5432:5432 |
||||
|
||||
redis: |
||||
image: redis:7-alpine |
||||
options: >- |
||||
--health-cmd "redis-cli ping" |
||||
--health-interval 10s |
||||
--health-timeout 5s |
||||
--health-retries 5 |
||||
ports: |
||||
- 6379:6379 |
||||
|
||||
env: |
||||
DB_HOST: localhost |
||||
DB_USER: postgres |
||||
DB_PASS: postgres |
||||
DISABLE_SIMPLECOV: true |
||||
RAILS_ENV: test |
||||
BUNDLE_WITH: test |
||||
|
||||
strategy: |
||||
fail-fast: false |
||||
matrix: |
||||
ruby-version: |
||||
- '3.0' |
||||
- '3.1' |
||||
- '.ruby-version' |
||||
|
||||
steps: |
||||
- uses: actions/checkout@v4 |
||||
|
||||
- uses: actions/download-artifact@v3 |
||||
with: |
||||
path: './public' |
||||
name: ${{ github.sha }} |
||||
|
||||
- name: Update package index |
||||
run: sudo apt-get update |
||||
|
||||
- name: Set up Node.js |
||||
uses: actions/setup-node@v3 |
||||
with: |
||||
cache: yarn |
||||
node-version-file: '.nvmrc' |
||||
|
||||
- name: Install native Ruby dependencies |
||||
run: sudo apt-get install -y libicu-dev libidn11-dev |
||||
|
||||
- name: Install additional system dependencies |
||||
run: sudo apt-get install -y ffmpeg imagemagick |
||||
|
||||
- name: Set up bundler cache |
||||
uses: ruby/setup-ruby@v1 |
||||
with: |
||||
ruby-version: ${{ matrix.ruby-version}} |
||||
bundler-cache: true |
||||
|
||||
- run: yarn --frozen-lockfile |
||||
|
||||
- name: Load database schema |
||||
run: './bin/rails db:create db:schema:load db:seed' |
||||
|
||||
- run: bundle exec rake spec:system |
||||
|
||||
- name: Archive logs |
||||
uses: actions/upload-artifact@v3 |
||||
if: failure() |
||||
with: |
||||
name: e2e-logs-${{ matrix.ruby-version }} |
||||
path: log/ |
||||
|
||||
- name: Archive test screenshots |
||||
uses: actions/upload-artifact@v3 |
||||
if: failure() |
||||
with: |
||||
name: e2e-screenshots |
||||
path: tmp/screenshots/ |
||||
|
||||
test-search: |
||||
name: Testing search |
||||
runs-on: ubuntu-latest |
||||
|
||||
needs: |
||||
- build |
||||
|
||||
services: |
||||
postgres: |
||||
image: postgres:14-alpine |
||||
env: |
||||
POSTGRES_PASSWORD: postgres |
||||
POSTGRES_USER: postgres |
||||
options: >- |
||||
--health-cmd pg_isready |
||||
--health-interval 10s |
||||
--health-timeout 5s |
||||
--health-retries 5 |
||||
ports: |
||||
- 5432:5432 |
||||
|
||||
redis: |
||||
image: redis:7-alpine |
||||
options: >- |
||||
--health-cmd "redis-cli ping" |
||||
--health-interval 10s |
||||
--health-timeout 5s |
||||
--health-retries 5 |
||||
ports: |
||||
- 6379:6379 |
||||
|
||||
search: |
||||
image: ${{ matrix.search-image }} |
||||
env: |
||||
discovery.type: single-node |
||||
xpack.security.enabled: false |
||||
options: >- |
||||
--health-cmd "curl http://localhost:9200/_cluster/health" |
||||
--health-interval 10s |
||||
--health-timeout 5s |
||||
--health-retries 10 |
||||
ports: |
||||
- 9200:9200 |
||||
|
||||
env: |
||||
DB_HOST: localhost |
||||
DB_USER: postgres |
||||
DB_PASS: postgres |
||||
DISABLE_SIMPLECOV: true |
||||
RAILS_ENV: test |
||||
BUNDLE_WITH: test |
||||
ES_ENABLED: true |
||||
ES_HOST: localhost |
||||
ES_PORT: 9200 |
||||
|
||||
strategy: |
||||
fail-fast: false |
||||
matrix: |
||||
ruby-version: |
||||
- '3.0' |
||||
- '3.1' |
||||
- '.ruby-version' |
||||
search-image: |
||||
- docker.elastic.co/elasticsearch/elasticsearch:7.17.13 |
||||
include: |
||||
- ruby-version: '.ruby-version' |
||||
search-image: docker.elastic.co/elasticsearch/elasticsearch:8.10.2 |
||||
|
||||
steps: |
||||
- uses: actions/checkout@v4 |
||||
|
||||
- uses: actions/download-artifact@v3 |
||||
with: |
||||
path: './public' |
||||
name: ${{ github.sha }} |
||||
|
||||
- name: Update package index |
||||
run: sudo apt-get update |
||||
|
||||
- name: Set up Node.js |
||||
uses: actions/setup-node@v3 |
||||
with: |
||||
cache: yarn |
||||
node-version-file: '.nvmrc' |
||||
|
||||
- name: Install native Ruby dependencies |
||||
run: sudo apt-get install -y libicu-dev libidn11-dev |
||||
|
||||
- name: Install additional system dependencies |
||||
run: sudo apt-get install -y ffmpeg imagemagick |
||||
|
||||
- name: Set up bundler cache |
||||
uses: ruby/setup-ruby@v1 |
||||
with: |
||||
ruby-version: ${{ matrix.ruby-version}} |
||||
bundler-cache: true |
||||
|
||||
- run: yarn --frozen-lockfile |
||||
|
||||
- name: Load database schema |
||||
run: './bin/rails db:create db:schema:load db:seed' |
||||
|
||||
- run: bundle exec rake spec:search |
||||
|
||||
- name: Archive logs |
||||
uses: actions/upload-artifact@v3 |
||||
if: failure() |
||||
with: |
||||
name: test-search-logs-${{ matrix.ruby-version }} |
||||
path: log/ |
||||
|
||||
- name: Archive test screenshots |
||||
uses: actions/upload-artifact@v3 |
||||
if: failure() |
||||
with: |
||||
name: test-search-screenshots |
||||
path: tmp/screenshots/ |
@ -1,14 +1,108 @@ |
||||
inherits_from: .haml-lint_todo.yml |
||||
# Whether to ignore frontmatter at the beginning of HAML documents for |
||||
# frameworks such as Jekyll/Middleman |
||||
skip_frontmatter: false |
||||
|
||||
exclude: |
||||
- 'vendor/**/*' |
||||
- lib/templates/haml/scaffold/_form.html.haml |
||||
|
||||
require: |
||||
- ./lib/linter/haml_middle_dot.rb |
||||
- 'spec/**/*' |
||||
- 'lib/templates/**/*' |
||||
- 'app/views/kaminari/**/*' |
||||
|
||||
linters: |
||||
AltText: |
||||
enabled: false |
||||
|
||||
ClassAttributeWithStaticValue: |
||||
enabled: true |
||||
|
||||
ClassesBeforeIds: |
||||
enabled: true |
||||
|
||||
ConsecutiveComments: |
||||
enabled: true |
||||
|
||||
ConsecutiveSilentScripts: |
||||
enabled: true |
||||
max_consecutive: 2 |
||||
|
||||
EmptyObjectReference: |
||||
enabled: true |
||||
|
||||
EmptyScript: |
||||
enabled: true |
||||
|
||||
FinalNewline: |
||||
enabled: true |
||||
present: true |
||||
|
||||
HtmlAttributes: |
||||
enabled: true |
||||
|
||||
ImplicitDiv: |
||||
enabled: true |
||||
|
||||
LeadingCommentSpace: |
||||
enabled: true |
||||
|
||||
LineLength: |
||||
enabled: false |
||||
max: 80 |
||||
|
||||
MultilinePipe: |
||||
enabled: true |
||||
|
||||
MultilineScript: |
||||
enabled: true |
||||
|
||||
ObjectReferenceAttributes: |
||||
enabled: true |
||||
|
||||
RuboCop: |
||||
enabled: true |
||||
# These cops are incredibly noisy when it comes to HAML templates, so we |
||||
# ignore them. |
||||
ignored_cops: |
||||
- Lint/BlockAlignment |
||||
- Lint/EndAlignment |
||||
- Lint/Void |
||||
- Metrics/BlockLength |
||||
- Metrics/LineLength |
||||
- Style/AlignParameters |
||||
- Style/BlockNesting |
||||
- Style/ElseAlignment |
||||
- Style/EndOfLine |
||||
- Style/FileName |
||||
- Style/FinalNewline |
||||
- Style/FrozenStringLiteralComment |
||||
- Style/IfUnlessModifier |
||||
- Style/IndentationWidth |
||||
- Style/Next |
||||
- Style/TrailingBlankLines |
||||
- Style/TrailingWhitespace |
||||
- Style/WhileUntilModifier |
||||
|
||||
RubyComments: |
||||
enabled: true |
||||
|
||||
SpaceBeforeScript: |
||||
enabled: true |
||||
MiddleDot: |
||||
|
||||
SpaceInsideHashAttributes: |
||||
enabled: true |
||||
style: space |
||||
|
||||
Indentation: |
||||
enabled: true |
||||
character: space # or tab |
||||
|
||||
TagName: |
||||
enabled: true |
||||
|
||||
TrailingWhitespace: |
||||
enabled: true |
||||
|
||||
UnnecessaryInterpolation: |
||||
enabled: true |
||||
|
||||
UnnecessaryStringOutput: |
||||
enabled: true |
||||
|
@ -1,33 +0,0 @@ |
||||
# This configuration was generated by |
||||
# `haml-lint --auto-gen-config` |
||||
# on 2023-10-11 11:31:24 -0400 using Haml-Lint version 0.51.0. |
||||
# The point is for the user to remove these configuration records |
||||
# one by one as the lints are removed from the code base. |
||||
# Note that changes in the inspected code, or installation of new |
||||
# versions of Haml-Lint, may require this file to be generated again. |
||||
|
||||
linters: |
||||
# Offense count: 946 |
||||
LineLength: |
||||
enabled: false |
||||
|
||||
# Offense count: 22 |
||||
UnnecessaryStringOutput: |
||||
enabled: false |
||||
|
||||
# Offense count: 44 |
||||
RuboCop: |
||||
enabled: false |
||||
|
||||
# Offense count: 3 |
||||
ViewLength: |
||||
exclude: |
||||
- 'app/views/admin/accounts/show.html.haml' |
||||
- 'app/views/admin/reports/show.html.haml' |
||||
- 'app/views/disputes/strikes/show.html.haml' |
||||
|
||||
# Offense count: 2 |
||||
IdNames: |
||||
exclude: |
||||
- 'app/views/oauth/authorizations/error.html.haml' |
||||
- 'app/views/shared/_error_messages.html.haml' |
@ -1,4 +0,0 @@ |
||||
#!/bin/sh |
||||
. "$(dirname "$0")/_/husky.sh" |
||||
|
||||
yarn lint-staged |
@ -1,4 +1,3 @@ |
||||
module.exports = { |
||||
singleQuote: true, |
||||
jsxSingleQuote: true |
||||
singleQuote: true |
||||
} |
||||
|
@ -1 +1 @@ |
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/app/.apt/lib/x86_64-linux-gnu:/app/.apt/usr/lib/x86_64-linux-gnu/mesa:/app/.apt/usr/lib/x86_64-linux-gnu/pulseaudio:/app/.apt/usr/lib/x86_64-linux-gnu/openblas-pthread |
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/app/.apt/lib/x86_64-linux-gnu:/app/.apt/usr/lib/x86_64-linux-gnu/mesa:/app/.apt/usr/lib/x86_64-linux-gnu/pulseaudio |
||||
|
@ -1,197 +1,309 @@ |
||||
# Can be removed once all rules are addressed or moved to this file as documented overrides |
||||
inherit_from: .rubocop_todo.yml |
||||
|
||||
# Used for merging with exclude lists with .rubocop_todo.yml |
||||
inherit_mode: |
||||
merge: |
||||
- Exclude |
||||
|
||||
require: |
||||
- rubocop-rails |
||||
- rubocop-rspec |
||||
- rubocop-performance |
||||
- rubocop-capybara |
||||
- ./lib/linter/rubocop_middle_dot |
||||
|
||||
AllCops: |
||||
TargetRubyVersion: 3.0 # Set to minimum supported version of CI |
||||
DisplayCopNames: true |
||||
DisplayStyleGuide: true |
||||
ExtraDetails: true |
||||
UseCache: true |
||||
CacheRootDirectory: tmp |
||||
NewCops: enable # Opt-in to newly added rules |
||||
TargetRubyVersion: 2.5 |
||||
NewCops: disable |
||||
Exclude: |
||||
- db/schema.rb |
||||
- 'spec/**/*' |
||||
- 'db/**/*' |
||||
- 'app/views/**/*' |
||||
- 'config/**/*' |
||||
- 'bin/*' |
||||
- 'Rakefile' |
||||
- 'node_modules/**/*' |
||||
- 'Vagrantfile' |
||||
- 'vendor/**/*' |
||||
- 'lib/json_ld/*' # Generated files |
||||
- 'lib/mastodon/migration_helpers.rb' # Vendored from GitLab |
||||
- 'lib/json_ld/*' |
||||
- 'lib/templates/**/*' |
||||
|
||||
# Reason: Prefer Hashes without extreme indentation |
||||
# https://docs.rubocop.org/rubocop/cops_layout.html#layoutfirsthashelementindentation |
||||
Bundler/OrderedGems: |
||||
Enabled: false |
||||
|
||||
Layout/AccessModifierIndentation: |
||||
EnforcedStyle: indent |
||||
|
||||
Layout/EmptyLineAfterMagicComment: |
||||
Enabled: false |
||||
|
||||
Layout/EmptyLineAfterGuardClause: |
||||
Enabled: false |
||||
|
||||
Layout/EmptyLineBetweenDefs: |
||||
AllowAdjacentOneLineDefs: true |
||||
|
||||
Layout/EmptyLinesAroundAttributeAccessor: |
||||
Enabled: true |
||||
|
||||
Layout/FirstHashElementIndentation: |
||||
EnforcedStyle: consistent |
||||
|
||||
# Reason: Currently disabled in .rubocop_todo.yml |
||||
# https://docs.rubocop.org/rubocop/cops_layout.html#layoutlinelength |
||||
Layout/LineLength: |
||||
Max: 320 # Default of 120 causes a duplicate entry in generated todo file |
||||
Layout/HashAlignment: |
||||
Enabled: false |
||||
|
||||
Layout/SpaceAroundMethodCallOperator: |
||||
Enabled: true |
||||
|
||||
Layout/SpaceInsideHashLiteralBraces: |
||||
EnforcedStyle: space |
||||
|
||||
Lint/DeprecatedOpenSSLConstant: |
||||
Enabled: true |
||||
|
||||
Lint/DuplicateElsifCondition: |
||||
Enabled: true |
||||
|
||||
Lint/MixedRegexpCaptureTypes: |
||||
Enabled: true |
||||
|
||||
Lint/RaiseException: |
||||
Enabled: true |
||||
|
||||
Lint/StructNewOverride: |
||||
Enabled: true |
||||
|
||||
# Reason: |
||||
# https://docs.rubocop.org/rubocop/cops_lint.html#lintuselessaccessmodifier |
||||
Lint/UselessAccessModifier: |
||||
ContextCreatingMethods: |
||||
- class_methods |
||||
|
||||
## Disable most Metrics/*Length cops |
||||
# Reason: those are often triggered and force significant refactors when this happend |
||||
# but the team feel they are not really improving the code quality. |
||||
Metrics/AbcSize: |
||||
Max: 115 |
||||
Exclude: |
||||
- 'lib/mastodon/*_cli.rb' |
||||
|
||||
# https://docs.rubocop.org/rubocop/cops_metrics.html#metricsblocklength |
||||
Metrics/BlockLength: |
||||
Enabled: false |
||||
Max: 55 |
||||
Exclude: |
||||
- 'lib/tasks/**/*' |
||||
- 'lib/mastodon/*_cli.rb' |
||||
|
||||
Metrics/BlockNesting: |
||||
Max: 3 |
||||
Exclude: |
||||
- 'lib/mastodon/*_cli.rb' |
||||
|
||||
# https://docs.rubocop.org/rubocop/cops_metrics.html#metricsclasslength |
||||
Metrics/ClassLength: |
||||
CountComments: false |
||||
Max: 500 |
||||
Exclude: |
||||
- 'lib/mastodon/*_cli.rb' |
||||
|
||||
Metrics/CyclomaticComplexity: |
||||
Max: 25 |
||||
Exclude: |
||||
- 'lib/mastodon/*_cli.rb' |
||||
|
||||
Layout/LineLength: |
||||
AllowURI: true |
||||
Enabled: false |
||||
|
||||
# https://docs.rubocop.org/rubocop/cops_metrics.html#metricsmethodlength |
||||
Metrics/MethodLength: |
||||
Enabled: false |
||||
CountComments: false |
||||
Max: 65 |
||||
Exclude: |
||||
- 'lib/mastodon/*_cli.rb' |
||||
|
||||
# https://docs.rubocop.org/rubocop/cops_metrics.html#metricsmodulelength |
||||
Metrics/ModuleLength: |
||||
CountComments: false |
||||
Max: 200 |
||||
|
||||
Metrics/ParameterLists: |
||||
Max: 5 |
||||
CountKeywordArgs: true |
||||
|
||||
Metrics/PerceivedComplexity: |
||||
Max: 25 |
||||
|
||||
Naming/MemoizedInstanceVariableName: |
||||
Enabled: false |
||||
|
||||
## End Disable Metrics/*Length cops |
||||
Naming/MethodParameterName: |
||||
Enabled: true |
||||
|
||||
# Reason: Currently disabled in .rubocop_todo.yml |
||||
# https://docs.rubocop.org/rubocop/cops_metrics.html#metricsabcsize |
||||
Metrics/AbcSize: |
||||
Exclude: |
||||
- 'lib/mastodon/cli/*.rb' |
||||
- db/*migrate/**/* |
||||
Rails: |
||||
Enabled: true |
||||
|
||||
# Reason: Currently disabled in .rubocop_todo.yml |
||||
# https://docs.rubocop.org/rubocop/cops_metrics.html#metricscyclomaticcomplexity |
||||
Metrics/CyclomaticComplexity: |
||||
Rails/ApplicationController: |
||||
Enabled: false |
||||
Exclude: |
||||
- lib/mastodon/cli/*.rb |
||||
- db/*migrate/**/* |
||||
- 'app/controllers/well_known/**/*.rb' |
||||
|
||||
# Reason: |
||||
# https://docs.rubocop.org/rubocop/cops_metrics.html#metricsparameterlists |
||||
Metrics/ParameterLists: |
||||
CountKeywordArgs: false |
||||
Rails/BelongsTo: |
||||
Enabled: false |
||||
|
||||
# Reason: Prevailing style is argument file paths |
||||
# https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsfilepath |
||||
Rails/FilePath: |
||||
EnforcedStyle: arguments |
||||
Rails/ContentTag: |
||||
Enabled: false |
||||
|
||||
# Reason: Prevailing style uses numeric status codes, matches RSpec/Rails/HttpStatus |
||||
# https://docs.rubocop.org/rubocop-rails/cops_rails.html#railshttpstatus |
||||
Rails/HttpStatus: |
||||
EnforcedStyle: numeric |
||||
Rails/EnumHash: |
||||
Enabled: false |
||||
|
||||
# Reason: Allowed in `tootctl` CLI code and in boot ENV checker |
||||
# https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsexit |
||||
Rails/Exit: |
||||
Exclude: |
||||
- 'config/boot.rb' |
||||
- 'lib/mastodon/cli/*.rb' |
||||
|
||||
# Reason: Some single letter camel case files shouldn't be split |
||||
# https://docs.rubocop.org/rubocop-rspec/cops_rspec.html#rspecfilepath |
||||
RSpec/FilePath: |
||||
CustomTransform: |
||||
ActivityPub: activitypub # Ignore the snake_case due to the amount of files to rename |
||||
DeepL: deepl |
||||
FetchOEmbedService: fetch_oembed_service |
||||
JsonLdHelper: jsonld_helper |
||||
OEmbedController: oembed_controller |
||||
OStatus: ostatus |
||||
NodeInfoController: nodeinfo_controller # NodeInfo isn't snake_cased for any of the instances |
||||
Exclude: |
||||
- 'spec/config/initializers/rack_attack_spec.rb' # namespaces usually have separate folder |
||||
- 'spec/lib/sanitize_config_spec.rb' # namespaces usually have separate folder |
||||
|
||||
# Reason: |
||||
# https://docs.rubocop.org/rubocop-rspec/cops_rspec.html#rspecnamedsubject |
||||
RSpec/NamedSubject: |
||||
EnforcedStyle: named_only |
||||
|
||||
# Reason: Prevailing style choice |
||||
# https://docs.rubocop.org/rubocop-rspec/cops_rspec.html#rspecnottonot |
||||
RSpec/NotToNot: |
||||
EnforcedStyle: to_not |
||||
|
||||
# Reason: Prevailing style uses numeric status codes, matches Rails/HttpStatus |
||||
# https://docs.rubocop.org/rubocop-rspec/cops_rspec_rails.html#rspecrailshttpstatus |
||||
RSpec/Rails/HttpStatus: |
||||
EnforcedStyle: numeric |
||||
|
||||
# Reason: |
||||
# https://docs.rubocop.org/rubocop/cops_style.html#styleclassandmodulechildren |
||||
- 'lib/mastodon/*' |
||||
- 'lib/cli.rb' |
||||
|
||||
Rails/FilePath: |
||||
Enabled: false |
||||
|
||||
Rails/HasAndBelongsToMany: |
||||
Enabled: false |
||||
|
||||
Rails/HasManyOrHasOneDependent: |
||||
Enabled: false |
||||
|
||||
Rails/HelperInstanceVariable: |
||||
Enabled: false |
||||
|
||||
Rails/HttpStatus: |
||||
Enabled: false |
||||
|
||||
Rails/IndexBy: |
||||
Enabled: false |
||||
|
||||
Rails/InverseOf: |
||||
Enabled: false |
||||
|
||||
Rails/LexicallyScopedActionFilter: |
||||
Enabled: false |
||||
|
||||
Rails/OutputSafety: |
||||
Enabled: true |
||||
|
||||
Rails/RakeEnvironment: |
||||
Enabled: false |
||||
|
||||
Rails/RedundantForeignKey: |
||||
Enabled: false |
||||
|
||||
Rails/SkipsModelValidations: |
||||
Enabled: false |
||||
|
||||
Rails/UniqueValidationWithoutIndex: |
||||
Enabled: false |
||||
|
||||
Style/AccessorGrouping: |
||||
Enabled: true |
||||
|
||||
Style/AccessModifierDeclarations: |
||||
Enabled: false |
||||
|
||||
Style/ArrayCoercion: |
||||
Enabled: true |
||||
|
||||
Style/BisectedAttrAccessor: |
||||
Enabled: true |
||||
|
||||
Style/CaseLikeIf: |
||||
Enabled: false |
||||
|
||||
Style/ClassAndModuleChildren: |
||||
Enabled: false |
||||
|
||||
# Reason: Classes mostly self-document with their names |
||||
# https://docs.rubocop.org/rubocop/cops_style.html#styledocumentation |
||||
Style/CollectionMethods: |
||||
Enabled: true |
||||
PreferredMethods: |
||||
find_all: 'select' |
||||
|
||||
Style/Documentation: |
||||
Enabled: false |
||||
|
||||
# Reason: Enforce modern Ruby style |
||||
# https://docs.rubocop.org/rubocop/cops_style.html#stylehashsyntax |
||||
Style/HashSyntax: |
||||
EnforcedStyle: ruby19_no_mixed_keys |
||||
Style/DoubleNegation: |
||||
Enabled: true |
||||
|
||||
Style/ExpandPathArguments: |
||||
Enabled: false |
||||
|
||||
Style/ExponentialNotation: |
||||
Enabled: true |
||||
|
||||
# Reason: |
||||
# https://docs.rubocop.org/rubocop/cops_style.html#stylenumericliterals |
||||
Style/NumericLiterals: |
||||
AllowedPatterns: |
||||
- \d{4}_\d{2}_\d{2}_\d{6} # For DB migration date version number readability |
||||
Style/FormatString: |
||||
Enabled: false |
||||
|
||||
Style/FormatStringToken: |
||||
Enabled: false |
||||
|
||||
Style/FrozenStringLiteralComment: |
||||
Enabled: true |
||||
|
||||
Style/GuardClause: |
||||
Enabled: false |
||||
|
||||
Style/HashAsLastArrayItem: |
||||
Enabled: false |
||||
|
||||
Style/HashEachMethods: |
||||
Enabled: true |
||||
|
||||
Style/HashLikeCase: |
||||
Enabled: true |
||||
|
||||
Style/HashTransformKeys: |
||||
Enabled: true |
||||
|
||||
Style/HashTransformValues: |
||||
Enabled: false |
||||
|
||||
Style/IfUnlessModifier: |
||||
Enabled: false |
||||
|
||||
Style/InverseMethods: |
||||
Enabled: false |
||||
|
||||
Style/Lambda: |
||||
Enabled: false |
||||
|
||||
Style/MutableConstant: |
||||
Enabled: false |
||||
|
||||
# Reason: |
||||
# https://docs.rubocop.org/rubocop/cops_style.html#stylepercentliteraldelimiters |
||||
Style/PercentLiteralDelimiters: |
||||
PreferredDelimiters: |
||||
'%i': '()' |
||||
'%w': '()' |
||||
|
||||
# Reason: Prefer less indentation in conditional assignments |
||||
# https://docs.rubocop.org/rubocop/cops_style.html#styleredundantbegin |
||||
Style/PerlBackrefs: |
||||
AutoCorrect: false |
||||
|
||||
Style/RedundantAssignment: |
||||
Enabled: false |
||||
|
||||
Style/RedundantFetchBlock: |
||||
Enabled: true |
||||
|
||||
Style/RedundantFileExtensionInRequire: |
||||
Enabled: true |
||||
|
||||
Style/RedundantRegexpCharacterClass: |
||||
Enabled: false |
||||
|
||||
Style/RedundantRegexpEscape: |
||||
Enabled: false |
||||
|
||||
Style/RedundantReturn: |
||||
Enabled: true |
||||
|
||||
Style/RedundantBegin: |
||||
Enabled: false |
||||
|
||||
# Reason: Overridden to reduce implicit StandardError rescues |
||||
# https://docs.rubocop.org/rubocop/cops_style.html#stylerescuestandarderror |
||||
Style/RegexpLiteral: |
||||
Enabled: false |
||||
|
||||
Style/RescueStandardError: |
||||
EnforcedStyle: implicit |
||||
Enabled: false |
||||
|
||||
# Reason: Simplify some spec layouts |
||||
# https://docs.rubocop.org/rubocop/cops_style.html#stylesemicolon |
||||
Style/Semicolon: |
||||
AllowAsExpressionSeparator: true |
||||
Style/SignalException: |
||||
Enabled: false |
||||
|
||||
Style/SlicingWithRange: |
||||
Enabled: true |
||||
|
||||
# Reason: Originally disabled for CodeClimate, and no config consensus has been found |
||||
# https://docs.rubocop.org/rubocop/cops_style.html#stylesymbolarray |
||||
Style/SymbolArray: |
||||
Enabled: false |
||||
|
||||
# Reason: |
||||
# https://docs.rubocop.org/rubocop/cops_style.html#styletrailingcommainarrayliteral |
||||
Style/TrailingCommaInArrayLiteral: |
||||
EnforcedStyleForMultiline: 'comma' |
||||
|
||||
# Reason: |
||||
# https://docs.rubocop.org/rubocop/cops_style.html#styletrailingcommainhashliteral |
||||
Style/TrailingCommaInHashLiteral: |
||||
EnforcedStyleForMultiline: 'comma' |
||||
|
||||
Style/MiddleDot: |
||||
Enabled: true |
||||
Style/UnpackFirst: |
||||
Enabled: false |
||||
|
@ -1,760 +0,0 @@ |
||||
# This configuration was generated by |
||||
# `rubocop --auto-gen-config --auto-gen-only-exclude --no-exclude-limit --no-offense-counts --no-auto-gen-timestamp` |
||||
# using RuboCop version 1.56.1. |
||||
# The point is for the user to remove these configuration records |
||||
# one by one as the offenses are removed from the code base. |
||||
# Note that changes in the inspected code, or installation of new |
||||
# versions of RuboCop, may require this file to be generated again. |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include. |
||||
# Include: **/*.gemfile, **/Gemfile, **/gems.rb |
||||
Bundler/OrderedGems: |
||||
Exclude: |
||||
- 'Gemfile' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. |
||||
# URISchemes: http, https |
||||
Layout/LineLength: |
||||
Exclude: |
||||
- 'app/models/account.rb' |
||||
|
||||
# Configuration parameters: AllowComments, AllowEmptyLambdas. |
||||
Lint/EmptyBlock: |
||||
Exclude: |
||||
- 'spec/controllers/api/v2/search_controller_spec.rb' |
||||
- 'spec/fabricators/access_token_fabricator.rb' |
||||
- 'spec/fabricators/conversation_fabricator.rb' |
||||
- 'spec/fabricators/system_key_fabricator.rb' |
||||
- 'spec/lib/activitypub/adapter_spec.rb' |
||||
- 'spec/models/user_role_spec.rb' |
||||
|
||||
Lint/NonLocalExitFromIterator: |
||||
Exclude: |
||||
- 'app/helpers/jsonld_helper.rb' |
||||
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all). |
||||
Lint/OrAssignmentToConstant: |
||||
Exclude: |
||||
- 'lib/sanitize_ext/sanitize_config.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. |
||||
Lint/UnusedBlockArgument: |
||||
Exclude: |
||||
- 'config/initializers/content_security_policy.rb' |
||||
- 'config/initializers/doorkeeper.rb' |
||||
- 'config/initializers/paperclip.rb' |
||||
- 'config/initializers/simple_form.rb' |
||||
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. |
||||
Metrics/AbcSize: |
||||
Max: 144 |
||||
Exclude: |
||||
- 'app/serializers/initial_state_serializer.rb' |
||||
|
||||
# Configuration parameters: CountBlocks, Max. |
||||
Metrics/BlockNesting: |
||||
Exclude: |
||||
- 'lib/tasks/mastodon.rake' |
||||
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns. |
||||
Metrics/CyclomaticComplexity: |
||||
Max: 25 |
||||
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns. |
||||
Metrics/PerceivedComplexity: |
||||
Max: 27 |
||||
|
||||
Performance/MapMethodChain: |
||||
Exclude: |
||||
- 'app/models/feed.rb' |
||||
- 'lib/mastodon/cli/maintenance.rb' |
||||
- 'spec/services/bulk_import_service_spec.rb' |
||||
- 'spec/services/import_service_spec.rb' |
||||
|
||||
RSpec/AnyInstance: |
||||
Exclude: |
||||
- 'spec/controllers/activitypub/inboxes_controller_spec.rb' |
||||
- 'spec/controllers/admin/accounts_controller_spec.rb' |
||||
- 'spec/controllers/admin/resets_controller_spec.rb' |
||||
- 'spec/controllers/admin/settings/branding_controller_spec.rb' |
||||
- 'spec/controllers/api/v1/media_controller_spec.rb' |
||||
- 'spec/controllers/auth/sessions_controller_spec.rb' |
||||
- 'spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb' |
||||
- 'spec/controllers/settings/two_factor_authentication/recovery_codes_controller_spec.rb' |
||||
- 'spec/lib/request_spec.rb' |
||||
- 'spec/lib/status_filter_spec.rb' |
||||
- 'spec/models/account_spec.rb' |
||||
- 'spec/models/setting_spec.rb' |
||||
- 'spec/services/activitypub/process_collection_service_spec.rb' |
||||
- 'spec/validators/follow_limit_validator_spec.rb' |
||||
- 'spec/workers/activitypub/delivery_worker_spec.rb' |
||||
- 'spec/workers/web/push_notification_worker_spec.rb' |
||||
|
||||
# Configuration parameters: CountAsOne. |
||||
RSpec/ExampleLength: |
||||
Max: 22 |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: EnforcedStyle. |
||||
# SupportedStyles: implicit, each, example |
||||
RSpec/HookArgument: |
||||
Exclude: |
||||
- 'spec/controllers/api/v1/streaming_controller_spec.rb' |
||||
- 'spec/controllers/well_known/webfinger_controller_spec.rb' |
||||
- 'spec/helpers/instance_helper_spec.rb' |
||||
- 'spec/models/user_spec.rb' |
||||
- 'spec/rails_helper.rb' |
||||
- 'spec/serializers/activitypub/note_serializer_spec.rb' |
||||
- 'spec/serializers/activitypub/update_poll_serializer_spec.rb' |
||||
- 'spec/services/import_service_spec.rb' |
||||
|
||||
# Configuration parameters: AssignmentOnly. |
||||
RSpec/InstanceVariable: |
||||
Exclude: |
||||
- 'spec/controllers/api/v1/streaming_controller_spec.rb' |
||||
- 'spec/controllers/auth/confirmations_controller_spec.rb' |
||||
- 'spec/controllers/auth/passwords_controller_spec.rb' |
||||
- 'spec/controllers/auth/sessions_controller_spec.rb' |
||||
- 'spec/controllers/concerns/export_controller_concern_spec.rb' |
||||
- 'spec/controllers/home_controller_spec.rb' |
||||
- 'spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb' |
||||
- 'spec/controllers/statuses_cleanup_controller_spec.rb' |
||||
- 'spec/models/concerns/account_finder_concern_spec.rb' |
||||
- 'spec/models/concerns/account_interactions_spec.rb' |
||||
- 'spec/models/public_feed_spec.rb' |
||||
- 'spec/serializers/activitypub/note_serializer_spec.rb' |
||||
- 'spec/serializers/activitypub/update_poll_serializer_spec.rb' |
||||
- 'spec/services/remove_status_service_spec.rb' |
||||
- 'spec/services/search_service_spec.rb' |
||||
- 'spec/services/unblock_domain_service_spec.rb' |
||||
|
||||
RSpec/LetSetup: |
||||
Exclude: |
||||
- 'spec/controllers/admin/accounts_controller_spec.rb' |
||||
- 'spec/controllers/admin/action_logs_controller_spec.rb' |
||||
- 'spec/controllers/admin/instances_controller_spec.rb' |
||||
- 'spec/controllers/admin/reports/actions_controller_spec.rb' |
||||
- 'spec/controllers/admin/statuses_controller_spec.rb' |
||||
- 'spec/controllers/api/v1/accounts/statuses_controller_spec.rb' |
||||
- 'spec/controllers/api/v1/filters_controller_spec.rb' |
||||
- 'spec/controllers/api/v2/admin/accounts_controller_spec.rb' |
||||
- 'spec/controllers/api/v2/filters/keywords_controller_spec.rb' |
||||
- 'spec/controllers/api/v2/filters/statuses_controller_spec.rb' |
||||
- 'spec/controllers/auth/confirmations_controller_spec.rb' |
||||
- 'spec/controllers/auth/passwords_controller_spec.rb' |
||||
- 'spec/controllers/auth/sessions_controller_spec.rb' |
||||
- 'spec/controllers/follower_accounts_controller_spec.rb' |
||||
- 'spec/controllers/following_accounts_controller_spec.rb' |
||||
- 'spec/controllers/oauth/authorized_applications_controller_spec.rb' |
||||
- 'spec/controllers/oauth/tokens_controller_spec.rb' |
||||
- 'spec/controllers/settings/imports_controller_spec.rb' |
||||
- 'spec/lib/activitypub/activity/delete_spec.rb' |
||||
- 'spec/lib/vacuum/applications_vacuum_spec.rb' |
||||
- 'spec/lib/vacuum/preview_cards_vacuum_spec.rb' |
||||
- 'spec/models/account_spec.rb' |
||||
- 'spec/models/account_statuses_cleanup_policy_spec.rb' |
||||
- 'spec/models/canonical_email_block_spec.rb' |
||||
- 'spec/models/status_spec.rb' |
||||
- 'spec/models/user_spec.rb' |
||||
- 'spec/services/account_statuses_cleanup_service_spec.rb' |
||||
- 'spec/services/activitypub/fetch_featured_collection_service_spec.rb' |
||||
- 'spec/services/activitypub/fetch_remote_status_service_spec.rb' |
||||
- 'spec/services/activitypub/process_account_service_spec.rb' |
||||
- 'spec/services/activitypub/process_collection_service_spec.rb' |
||||
- 'spec/services/batched_remove_status_service_spec.rb' |
||||
- 'spec/services/block_domain_service_spec.rb' |
||||
- 'spec/services/bulk_import_service_spec.rb' |
||||
- 'spec/services/delete_account_service_spec.rb' |
||||
- 'spec/services/import_service_spec.rb' |
||||
- 'spec/services/notify_service_spec.rb' |
||||
- 'spec/services/remove_status_service_spec.rb' |
||||
- 'spec/services/report_service_spec.rb' |
||||
- 'spec/services/resolve_account_service_spec.rb' |
||||
- 'spec/services/suspend_account_service_spec.rb' |
||||
- 'spec/services/unallow_domain_service_spec.rb' |
||||
- 'spec/services/unsuspend_account_service_spec.rb' |
||||
- 'spec/workers/scheduler/user_cleanup_scheduler_spec.rb' |
||||
|
||||
RSpec/MessageChain: |
||||
Exclude: |
||||
- 'spec/controllers/api/v1/media_controller_spec.rb' |
||||
- 'spec/models/concerns/remotable_spec.rb' |
||||
- 'spec/models/session_activation_spec.rb' |
||||
- 'spec/models/setting_spec.rb' |
||||
|
||||
# Configuration parameters: EnforcedStyle. |
||||
# SupportedStyles: have_received, receive |
||||
RSpec/MessageSpies: |
||||
Exclude: |
||||
- 'spec/controllers/admin/accounts_controller_spec.rb' |
||||
- 'spec/helpers/admin/account_moderation_notes_helper_spec.rb' |
||||
- 'spec/lib/webfinger_resource_spec.rb' |
||||
- 'spec/models/admin/account_action_spec.rb' |
||||
- 'spec/models/concerns/remotable_spec.rb' |
||||
- 'spec/models/follow_request_spec.rb' |
||||
- 'spec/models/identity_spec.rb' |
||||
- 'spec/models/session_activation_spec.rb' |
||||
- 'spec/models/setting_spec.rb' |
||||
- 'spec/services/activitypub/fetch_replies_service_spec.rb' |
||||
- 'spec/services/activitypub/process_collection_service_spec.rb' |
||||
- 'spec/spec_helper.rb' |
||||
- 'spec/validators/status_length_validator_spec.rb' |
||||
|
||||
RSpec/MultipleExpectations: |
||||
Max: 8 |
||||
|
||||
# Configuration parameters: AllowSubject. |
||||
RSpec/MultipleMemoizedHelpers: |
||||
Max: 21 |
||||
|
||||
# Configuration parameters: AllowedGroups. |
||||
RSpec/NestedGroups: |
||||
Max: 6 |
||||
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all). |
||||
Rails/ApplicationController: |
||||
Exclude: |
||||
- 'app/controllers/health_controller.rb' |
||||
|
||||
# Configuration parameters: Include. |
||||
# Include: db/**/*.rb |
||||
Rails/CreateTableWithTimestamps: |
||||
Exclude: |
||||
- 'db/migrate/20170508230434_create_conversation_mutes.rb' |
||||
- 'db/migrate/20170823162448_create_status_pins.rb' |
||||
- 'db/migrate/20171116161857_create_list_accounts.rb' |
||||
- 'db/migrate/20180929222014_create_account_conversations.rb' |
||||
- 'db/migrate/20181007025445_create_pghero_space_stats.rb' |
||||
- 'db/migrate/20190103124649_create_scheduled_statuses.rb' |
||||
- 'db/migrate/20220824233535_create_status_trends.rb' |
||||
- 'db/migrate/20221006061337_create_preview_card_trends.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: Severity. |
||||
Rails/DuplicateAssociation: |
||||
Exclude: |
||||
- 'app/serializers/activitypub/collection_serializer.rb' |
||||
- 'app/serializers/activitypub/note_serializer.rb' |
||||
|
||||
# Configuration parameters: Include. |
||||
# Include: app/models/**/*.rb |
||||
Rails/HasAndBelongsToMany: |
||||
Exclude: |
||||
- 'app/models/concerns/account_associations.rb' |
||||
- 'app/models/preview_card.rb' |
||||
- 'app/models/status.rb' |
||||
- 'app/models/tag.rb' |
||||
|
||||
# Configuration parameters: Include. |
||||
# Include: app/models/**/*.rb |
||||
Rails/HasManyOrHasOneDependent: |
||||
Exclude: |
||||
- 'app/models/concerns/account_counters.rb' |
||||
- 'app/models/conversation.rb' |
||||
- 'app/models/custom_emoji.rb' |
||||
- 'app/models/custom_emoji_category.rb' |
||||
- 'app/models/domain_block.rb' |
||||
- 'app/models/invite.rb' |
||||
- 'app/models/status.rb' |
||||
- 'app/models/user.rb' |
||||
- 'app/models/web/push_subscription.rb' |
||||
|
||||
Rails/I18nLocaleTexts: |
||||
Exclude: |
||||
- 'lib/tasks/mastodon.rake' |
||||
- 'spec/helpers/flashes_helper_spec.rb' |
||||
|
||||
# Configuration parameters: Include. |
||||
# Include: app/controllers/**/*.rb, app/mailers/**/*.rb |
||||
Rails/LexicallyScopedActionFilter: |
||||
Exclude: |
||||
- 'app/controllers/auth/passwords_controller.rb' |
||||
- 'app/controllers/auth/registrations_controller.rb' |
||||
- 'app/controllers/auth/sessions_controller.rb' |
||||
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all). |
||||
Rails/NegateInclude: |
||||
Exclude: |
||||
- 'app/controllers/concerns/signature_verification.rb' |
||||
- 'app/helpers/jsonld_helper.rb' |
||||
- 'app/lib/activitypub/activity/create.rb' |
||||
- 'app/lib/activitypub/activity/move.rb' |
||||
- 'app/lib/feed_manager.rb' |
||||
- 'app/lib/link_details_extractor.rb' |
||||
- 'app/models/concerns/attachmentable.rb' |
||||
- 'app/models/concerns/remotable.rb' |
||||
- 'app/models/custom_filter.rb' |
||||
- 'app/services/activitypub/process_status_update_service.rb' |
||||
- 'app/services/fetch_link_card_service.rb' |
||||
- 'app/services/search_service.rb' |
||||
- 'app/workers/web/push_notification_worker.rb' |
||||
- 'lib/paperclip/color_extractor.rb' |
||||
|
||||
Rails/OutputSafety: |
||||
Exclude: |
||||
- 'config/initializers/simple_form.rb' |
||||
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all). |
||||
# Configuration parameters: Include. |
||||
# Include: **/Rakefile, **/*.rake |
||||
Rails/RakeEnvironment: |
||||
Exclude: |
||||
- 'lib/tasks/auto_annotate_models.rake' |
||||
- 'lib/tasks/db.rake' |
||||
- 'lib/tasks/emojis.rake' |
||||
- 'lib/tasks/mastodon.rake' |
||||
- 'lib/tasks/repo.rake' |
||||
- 'lib/tasks/statistics.rake' |
||||
|
||||
# Configuration parameters: Include. |
||||
# Include: db/**/*.rb |
||||
Rails/ReversibleMigration: |
||||
Exclude: |
||||
- 'db/migrate/20160223164502_make_uris_nullable_in_statuses.rb' |
||||
- 'db/migrate/20161122163057_remove_unneeded_indexes.rb' |
||||
- 'db/migrate/20170205175257_remove_devices.rb' |
||||
- 'db/migrate/20170322143850_change_primary_key_to_bigint_on_statuses.rb' |
||||
- 'db/migrate/20170520145338_change_language_filter_to_opt_out.rb' |
||||
- 'db/migrate/20170609145826_remove_default_language_from_statuses.rb' |
||||
- 'db/migrate/20170711225116_fix_null_booleans.rb' |
||||
- 'db/migrate/20171129172043_add_index_on_stream_entries.rb' |
||||
- 'db/migrate/20171212195226_remove_duplicate_indexes_in_lists.rb' |
||||
- 'db/migrate/20171226094803_more_faster_index_on_notifications.rb' |
||||
- 'db/migrate/20180106000232_add_index_on_statuses_for_api_v1_accounts_account_id_statuses.rb' |
||||
- 'db/migrate/20180617162849_remove_unused_indexes.rb' |
||||
- 'db/migrate/20220827195229_change_canonical_email_blocks_nullable.rb' |
||||
|
||||
# Configuration parameters: ForbiddenMethods, AllowedMethods. |
||||
# ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all |
||||
Rails/SkipsModelValidations: |
||||
Exclude: |
||||
- 'app/controllers/admin/invites_controller.rb' |
||||
- 'app/controllers/concerns/session_tracking_concern.rb' |
||||
- 'app/models/concerns/account_merging.rb' |
||||
- 'app/models/concerns/expireable.rb' |
||||
- 'app/models/status.rb' |
||||
- 'app/models/trends/links.rb' |
||||
- 'app/models/trends/preview_card_batch.rb' |
||||
- 'app/models/trends/preview_card_provider_batch.rb' |
||||
- 'app/models/trends/status_batch.rb' |
||||
- 'app/models/trends/statuses.rb' |
||||
- 'app/models/trends/tag_batch.rb' |
||||
- 'app/models/trends/tags.rb' |
||||
- 'app/models/user.rb' |
||||
- 'app/services/activitypub/process_status_update_service.rb' |
||||
- 'app/services/approve_appeal_service.rb' |
||||
- 'app/services/block_domain_service.rb' |
||||
- 'app/services/delete_account_service.rb' |
||||
- 'app/services/process_mentions_service.rb' |
||||
- 'app/services/unallow_domain_service.rb' |
||||
- 'app/services/unblock_domain_service.rb' |
||||
- 'app/services/update_status_service.rb' |
||||
- 'app/workers/activitypub/post_upgrade_worker.rb' |
||||
- 'app/workers/move_worker.rb' |
||||
- 'app/workers/scheduler/ip_cleanup_scheduler.rb' |
||||
- 'app/workers/scheduler/scheduled_statuses_scheduler.rb' |
||||
- 'db/migrate/20161203164520_add_from_account_id_to_notifications.rb' |
||||
- 'db/migrate/20170105224407_add_shortcode_to_media_attachments.rb' |
||||
- 'db/migrate/20170209184350_add_reply_to_statuses.rb' |
||||
- 'db/migrate/20170304202101_add_type_to_media_attachments.rb' |
||||
- 'db/migrate/20180528141303_fix_accounts_unique_index.rb' |
||||
- 'db/migrate/20180609104432_migrate_web_push_subscriptions2.rb' |
||||
- 'db/migrate/20181207011115_downcase_custom_emoji_domains.rb' |
||||
- 'db/migrate/20190511134027_add_silenced_at_suspended_at_to_accounts.rb' |
||||
- 'db/migrate/20191007013357_update_pt_locales.rb' |
||||
- 'db/migrate/20220316233212_update_kurdish_locales.rb' |
||||
- 'db/post_migrate/20190511152737_remove_suspended_silenced_account_fields.rb' |
||||
- 'db/post_migrate/20200917193528_migrate_notifications_type.rb' |
||||
- 'db/post_migrate/20201017234926_fill_account_suspension_origin.rb' |
||||
- 'db/post_migrate/20220617202502_migrate_roles.rb' |
||||
- 'db/post_migrate/20221101190723_backfill_admin_action_logs.rb' |
||||
- 'db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb' |
||||
- 'lib/mastodon/cli/accounts.rb' |
||||
- 'lib/mastodon/cli/main.rb' |
||||
- 'lib/mastodon/cli/maintenance.rb' |
||||
- 'spec/lib/activitypub/activity/follow_spec.rb' |
||||
- 'spec/services/follow_service_spec.rb' |
||||
- 'spec/services/update_account_service_spec.rb' |
||||
|
||||
# Configuration parameters: Include. |
||||
# Include: db/**/*.rb |
||||
Rails/ThreeStateBooleanColumn: |
||||
Exclude: |
||||
- 'db/migrate/20160325130944_add_admin_to_users.rb' |
||||
- 'db/migrate/20161123093447_add_sensitive_to_statuses.rb' |
||||
- 'db/migrate/20170123203248_add_reject_media_to_domain_blocks.rb' |
||||
- 'db/migrate/20170127165745_add_devise_two_factor_to_users.rb' |
||||
- 'db/migrate/20170209184350_add_reply_to_statuses.rb' |
||||
- 'db/migrate/20170330163835_create_imports.rb' |
||||
- 'db/migrate/20170905165803_add_local_to_statuses.rb' |
||||
- 'db/migrate/20171210213213_add_local_only_flag_to_statuses.rb' |
||||
- 'db/migrate/20181203021853_add_discoverable_to_accounts.rb' |
||||
- 'db/migrate/20190509164208_add_by_moderator_to_tombstone.rb' |
||||
- 'db/migrate/20190805123746_add_capabilities_to_tags.rb' |
||||
- 'db/migrate/20191212163405_add_hide_collections_to_accounts.rb' |
||||
- 'db/migrate/20200309150742_add_forwarded_to_reports.rb' |
||||
- 'db/migrate/20210609202149_create_login_activities.rb' |
||||
- 'db/migrate/20210621221010_add_skip_sign_in_token_to_users.rb' |
||||
- 'db/migrate/20211031031021_create_preview_card_providers.rb' |
||||
- 'db/migrate/20211115032527_add_trendable_to_preview_cards.rb' |
||||
- 'db/migrate/20220202200743_add_trendable_to_accounts.rb' |
||||
- 'db/migrate/20220202200926_add_trendable_to_statuses.rb' |
||||
- 'db/migrate/20220303000827_add_ordered_media_attachment_ids_to_status_edits.rb' |
||||
|
||||
# Configuration parameters: Include. |
||||
# Include: app/models/**/*.rb |
||||
Rails/UniqueValidationWithoutIndex: |
||||
Exclude: |
||||
- 'app/models/account_alias.rb' |
||||
- 'app/models/custom_filter_status.rb' |
||||
- 'app/models/identity.rb' |
||||
- 'app/models/webauthn_credential.rb' |
||||
|
||||
# Configuration parameters: Include. |
||||
# Include: app/models/**/*.rb |
||||
Rails/UnusedIgnoredColumns: |
||||
Exclude: |
||||
- 'app/models/account.rb' |
||||
- 'app/models/account_stat.rb' |
||||
- 'app/models/admin/action_log.rb' |
||||
- 'app/models/custom_filter.rb' |
||||
- 'app/models/email_domain_block.rb' |
||||
- 'app/models/report.rb' |
||||
- 'app/models/status_edit.rb' |
||||
- 'app/models/user.rb' |
||||
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all). |
||||
# Configuration parameters: EnforcedStyle. |
||||
# SupportedStyles: exists, where |
||||
Rails/WhereExists: |
||||
Exclude: |
||||
- 'app/controllers/activitypub/inboxes_controller.rb' |
||||
- 'app/controllers/admin/email_domain_blocks_controller.rb' |
||||
- 'app/controllers/auth/registrations_controller.rb' |
||||
- 'app/lib/activitypub/activity/create.rb' |
||||
- 'app/lib/delivery_failure_tracker.rb' |
||||
- 'app/lib/feed_manager.rb' |
||||
- 'app/lib/status_cache_hydrator.rb' |
||||
- 'app/lib/suspicious_sign_in_detector.rb' |
||||
- 'app/models/concerns/account_interactions.rb' |
||||
- 'app/models/featured_tag.rb' |
||||
- 'app/models/poll.rb' |
||||
- 'app/models/session_activation.rb' |
||||
- 'app/models/status.rb' |
||||
- 'app/models/user.rb' |
||||
- 'app/policies/status_policy.rb' |
||||
- 'app/serializers/rest/announcement_serializer.rb' |
||||
- 'app/serializers/rest/tag_serializer.rb' |
||||
- 'app/services/activitypub/fetch_remote_status_service.rb' |
||||
- 'app/services/app_sign_up_service.rb' |
||||
- 'app/services/vote_service.rb' |
||||
- 'app/validators/reaction_validator.rb' |
||||
- 'app/validators/vote_validator.rb' |
||||
- 'app/workers/move_worker.rb' |
||||
- 'db/migrate/20190529143559_preserve_old_layout_for_existing_users.rb' |
||||
- 'lib/tasks/tests.rake' |
||||
- 'spec/models/account_spec.rb' |
||||
- 'spec/services/activitypub/process_collection_service_spec.rb' |
||||
- 'spec/services/purge_domain_service_spec.rb' |
||||
- 'spec/services/unallow_domain_service_spec.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: AllowOnConstant, AllowOnSelfClass. |
||||
Style/CaseEquality: |
||||
Exclude: |
||||
- 'config/initializers/trusted_proxies.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: AllowedMethods, AllowedPatterns. |
||||
# AllowedMethods: ==, equal?, eql? |
||||
Style/ClassEqualityComparison: |
||||
Exclude: |
||||
- 'app/helpers/jsonld_helper.rb' |
||||
- 'app/serializers/activitypub/outbox_serializer.rb' |
||||
|
||||
Style/ClassVars: |
||||
Exclude: |
||||
- 'config/initializers/devise.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: AllowedVars. |
||||
Style/FetchEnvVar: |
||||
Exclude: |
||||
- 'app/lib/redis_configuration.rb' |
||||
- 'app/lib/translation_service.rb' |
||||
- 'config/environments/development.rb' |
||||
- 'config/environments/production.rb' |
||||
- 'config/initializers/2_limited_federation_mode.rb' |
||||
- 'config/initializers/3_omniauth.rb' |
||||
- 'config/initializers/blacklists.rb' |
||||
- 'config/initializers/cache_buster.rb' |
||||
- 'config/initializers/content_security_policy.rb' |
||||
- 'config/initializers/devise.rb' |
||||
- 'config/initializers/paperclip.rb' |
||||
- 'config/initializers/vapid.rb' |
||||
- 'lib/mastodon/premailer_webpack_strategy.rb' |
||||
- 'lib/mastodon/redis_config.rb' |
||||
- 'lib/tasks/repo.rake' |
||||
- 'spec/features/profile_spec.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: EnforcedStyle, MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns. |
||||
# SupportedStyles: annotated, template, unannotated |
||||
# AllowedMethods: redirect |
||||
Style/FormatStringToken: |
||||
Exclude: |
||||
- 'app/models/privacy_policy.rb' |
||||
- 'config/initializers/devise.rb' |
||||
- 'lib/paperclip/color_extractor.rb' |
||||
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all). |
||||
Style/GlobalStdStream: |
||||
Exclude: |
||||
- 'config/boot.rb' |
||||
- 'config/environments/development.rb' |
||||
- 'config/environments/production.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. |
||||
Style/GuardClause: |
||||
Exclude: |
||||
- 'app/controllers/admin/confirmations_controller.rb' |
||||
- 'app/controllers/auth/confirmations_controller.rb' |
||||
- 'app/controllers/auth/passwords_controller.rb' |
||||
- 'app/controllers/settings/two_factor_authentication/webauthn_credentials_controller.rb' |
||||
- 'app/lib/activitypub/activity/block.rb' |
||||
- 'app/lib/request.rb' |
||||
- 'app/lib/request_pool.rb' |
||||
- 'app/lib/webfinger.rb' |
||||
- 'app/lib/webfinger_resource.rb' |
||||
- 'app/models/concerns/account_counters.rb' |
||||
- 'app/models/concerns/ldap_authenticable.rb' |
||||
- 'app/models/tag.rb' |
||||
- 'app/models/user.rb' |
||||
- 'app/services/fan_out_on_write_service.rb' |
||||
- 'app/services/post_status_service.rb' |
||||
- 'app/services/process_hashtags_service.rb' |
||||
- 'app/workers/move_worker.rb' |
||||
- 'app/workers/redownload_avatar_worker.rb' |
||||
- 'app/workers/redownload_header_worker.rb' |
||||
- 'app/workers/redownload_media_worker.rb' |
||||
- 'app/workers/remote_account_refresh_worker.rb' |
||||
- 'config/initializers/devise.rb' |
||||
- 'db/migrate/20170901141119_truncate_preview_cards.rb' |
||||
- 'db/post_migrate/20220704024901_migrate_settings_to_user_roles.rb' |
||||
- 'lib/devise/two_factor_ldap_authenticatable.rb' |
||||
- 'lib/devise/two_factor_pam_authenticatable.rb' |
||||
- 'lib/mastodon/cli/accounts.rb' |
||||
- 'lib/mastodon/cli/maintenance.rb' |
||||
- 'lib/mastodon/cli/media.rb' |
||||
- 'lib/paperclip/attachment_extensions.rb' |
||||
- 'lib/tasks/repo.rake' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: EnforcedStyle. |
||||
# SupportedStyles: braces, no_braces |
||||
Style/HashAsLastArrayItem: |
||||
Exclude: |
||||
- 'app/controllers/admin/statuses_controller.rb' |
||||
- 'app/controllers/api/v1/statuses_controller.rb' |
||||
- 'app/models/concerns/account_counters.rb' |
||||
- 'app/models/concerns/status_threading_concern.rb' |
||||
- 'app/models/status.rb' |
||||
- 'app/services/batched_remove_status_service.rb' |
||||
- 'app/services/notify_service.rb' |
||||
- 'db/migrate/20181024224956_migrate_account_conversations.rb' |
||||
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all). |
||||
Style/HashTransformValues: |
||||
Exclude: |
||||
- 'app/serializers/rest/web_push_subscription_serializer.rb' |
||||
- 'app/services/import_service.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
Style/IfUnlessModifier: |
||||
Exclude: |
||||
- 'config/environments/production.rb' |
||||
- 'config/initializers/devise.rb' |
||||
- 'config/initializers/ffmpeg.rb' |
||||
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all). |
||||
# Configuration parameters: InverseMethods, InverseBlocks. |
||||
Style/InverseMethods: |
||||
Exclude: |
||||
- 'app/models/custom_filter.rb' |
||||
- 'app/services/update_account_service.rb' |
||||
- 'spec/controllers/activitypub/replies_controller_spec.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: EnforcedStyle. |
||||
# SupportedStyles: line_count_dependent, lambda, literal |
||||
Style/Lambda: |
||||
Exclude: |
||||
- 'config/initializers/simple_form.rb' |
||||
- 'config/routes.rb' |
||||
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all). |
||||
Style/MapToHash: |
||||
Exclude: |
||||
- 'app/models/status.rb' |
||||
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all). |
||||
# Configuration parameters: EnforcedStyle. |
||||
# SupportedStyles: literals, strict |
||||
Style/MutableConstant: |
||||
Exclude: |
||||
- 'app/models/tag.rb' |
||||
- 'app/services/delete_account_service.rb' |
||||
- 'lib/mastodon/migration_warning.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
Style/NilLambda: |
||||
Exclude: |
||||
- 'config/initializers/paperclip.rb' |
||||
|
||||
# Configuration parameters: AllowedMethods. |
||||
# AllowedMethods: respond_to_missing? |
||||
Style/OptionalBooleanParameter: |
||||
Exclude: |
||||
- 'app/helpers/admin/account_moderation_notes_helper.rb' |
||||
- 'app/helpers/jsonld_helper.rb' |
||||
- 'app/lib/admin/system_check/message.rb' |
||||
- 'app/lib/request.rb' |
||||
- 'app/lib/webfinger.rb' |
||||
- 'app/services/block_domain_service.rb' |
||||
- 'app/services/fetch_resource_service.rb' |
||||
- 'app/workers/domain_block_worker.rb' |
||||
- 'app/workers/unfollow_follow_worker.rb' |
||||
- 'lib/mastodon/redis_config.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: PreferredDelimiters. |
||||
Style/PercentLiteralDelimiters: |
||||
Exclude: |
||||
- 'config/deploy.rb' |
||||
- 'config/initializers/doorkeeper.rb' |
||||
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all). |
||||
# Configuration parameters: EnforcedStyle. |
||||
# SupportedStyles: short, verbose |
||||
Style/PreferredHashMethods: |
||||
Exclude: |
||||
- 'config/initializers/paperclip.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
Style/RedundantConstantBase: |
||||
Exclude: |
||||
- 'config/environments/production.rb' |
||||
- 'config/initializers/sidekiq.rb' |
||||
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all). |
||||
# Configuration parameters: SafeForConstants. |
||||
Style/RedundantFetchBlock: |
||||
Exclude: |
||||
- 'config/initializers/1_hosts.rb' |
||||
- 'config/initializers/chewy.rb' |
||||
- 'config/initializers/devise.rb' |
||||
- 'config/initializers/paperclip.rb' |
||||
- 'config/puma.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: AllowMultipleReturnValues. |
||||
Style/RedundantReturn: |
||||
Exclude: |
||||
- 'app/controllers/api/v1/directories_controller.rb' |
||||
- 'app/controllers/auth/confirmations_controller.rb' |
||||
- 'app/lib/ostatus/tag_manager.rb' |
||||
- 'app/models/form/import.rb' |
||||
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all). |
||||
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength. |
||||
# AllowedMethods: present?, blank?, presence, try, try! |
||||
Style/SafeNavigation: |
||||
Exclude: |
||||
- 'app/models/concerns/account_finder_concern.rb' |
||||
- 'app/models/status.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: EnforcedStyle. |
||||
# SupportedStyles: only_raise, only_fail, semantic |
||||
Style/SignalException: |
||||
Exclude: |
||||
- 'lib/devise/two_factor_ldap_authenticatable.rb' |
||||
- 'lib/devise/two_factor_pam_authenticatable.rb' |
||||
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all). |
||||
Style/SingleArgumentDig: |
||||
Exclude: |
||||
- 'lib/webpacker/manifest_extensions.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: EnforcedStyle. |
||||
# SupportedStyles: require_parentheses, require_no_parentheses |
||||
Style/StabbyLambdaParentheses: |
||||
Exclude: |
||||
- 'config/environments/production.rb' |
||||
- 'config/initializers/content_security_policy.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
Style/StderrPuts: |
||||
Exclude: |
||||
- 'config/boot.rb' |
||||
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all). |
||||
# Configuration parameters: Mode. |
||||
Style/StringConcatenation: |
||||
Exclude: |
||||
- 'config/initializers/paperclip.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. |
||||
# SupportedStyles: single_quotes, double_quotes |
||||
Style/StringLiterals: |
||||
Exclude: |
||||
- 'config/environments/production.rb' |
||||
- 'config/initializers/backtrace_silencers.rb' |
||||
- 'config/initializers/http_client_proxy.rb' |
||||
- 'config/initializers/rack_attack.rb' |
||||
- 'config/initializers/webauthn.rb' |
||||
- 'config/routes.rb' |
||||
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all). |
||||
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments. |
||||
# AllowedMethods: define_method, mail, respond_to |
||||
Style/SymbolProc: |
||||
Exclude: |
||||
- 'config/initializers/3_omniauth.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: EnforcedStyle, AllowSafeAssignment. |
||||
# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex |
||||
Style/TernaryParentheses: |
||||
Exclude: |
||||
- 'config/environments/development.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: EnforcedStyleForMultiline. |
||||
# SupportedStylesForMultiline: comma, consistent_comma, no_comma |
||||
Style/TrailingCommaInArguments: |
||||
Exclude: |
||||
- 'config/initializers/paperclip.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: EnforcedStyleForMultiline. |
||||
# SupportedStylesForMultiline: comma, consistent_comma, no_comma |
||||
Style/TrailingCommaInHashLiteral: |
||||
Exclude: |
||||
- 'config/environments/production.rb' |
||||
- 'config/environments/test.rb' |
||||
|
||||
# This cop supports safe autocorrection (--autocorrect). |
||||
# Configuration parameters: EnforcedStyle, MinSize, WordRegex. |
||||
# SupportedStyles: percent, brackets |
||||
Style/WordArray: |
||||
Exclude: |
||||
- 'app/helpers/languages_helper.rb' |
||||
- 'spec/controllers/settings/imports_controller_spec.rb' |
||||
- 'spec/models/form/import_spec.rb' |
@ -1 +1 @@ |
||||
3.2.2 |
||||
3.0.4 |
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,26 @@ |
||||
ffmpeg |
||||
libopenblas0-pthread |
||||
libicu[0-9][0-9] |
||||
libicu-dev |
||||
libidn12 |
||||
libidn-dev |
||||
libpq-dev |
||||
libxdamage1 |
||||
libxfixes3 |
||||
zlib1g-dev |
||||
libcairo2 |
||||
libcroco3 |
||||
libdatrie1 |
||||
libgdk-pixbuf2.0-0 |
||||
libgraphite2-3 |
||||
libharfbuzz0b |
||||
libpango-1.0-0 |
||||
libpangocairo-1.0-0 |
||||
libpangoft2-1.0-0 |
||||
libpixman-1-0 |
||||
librsvg2-2 |
||||
libthai-data |
||||
libthai0 |
||||
libvpx[5-9] |
||||
libxcb-render0 |
||||
libxcb-shm0 |
||||
libxrender1 |
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,14 @@ |
||||
# frozen_string_literal: true |
||||
require 'capistrano/setup' |
||||
require 'capistrano/deploy' |
||||
require 'capistrano/scm/git' |
||||
|
||||
install_plugin Capistrano::SCM::Git |
||||
|
||||
require 'capistrano/rbenv' |
||||
require 'capistrano/bundler' |
||||
require 'capistrano/yarn' |
||||
require 'capistrano/rails/assets' |
||||
require 'capistrano/rails/migrations' |
||||
|
||||
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } |
@ -1,105 +1,121 @@ |
||||
# syntax=docker/dockerfile:1.4 |
||||
# This needs to be bookworm-slim because the Ruby image is built on bookworm-slim |
||||
ARG NODE_VERSION="20.8-bookworm-slim" |
||||
|
||||
FROM ghcr.io/moritzheiber/ruby-jemalloc:3.2.2-slim as ruby |
||||
FROM node:${NODE_VERSION} as build |
||||
FROM ubuntu:20.04 as build-dep |
||||
|
||||
# Use bash for the shell |
||||
SHELL ["/bin/bash", "-c"] |
||||
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections |
||||
|
||||
# Install Node v16 (LTS) |
||||
ENV NODE_VER="16.17.1" |
||||
RUN ARCH= && \ |
||||
dpkgArch="$(dpkg --print-architecture)" && \ |
||||
case "${dpkgArch##*-}" in \ |
||||
amd64) ARCH='x64';; \ |
||||
ppc64el) ARCH='ppc64le';; \ |
||||
s390x) ARCH='s390x';; \ |
||||
arm64) ARCH='arm64';; \ |
||||
armhf) ARCH='armv7l';; \ |
||||
i386) ARCH='x86';; \ |
||||
*) echo "unsupported architecture"; exit 1 ;; \ |
||||
esac && \ |
||||
echo "Etc/UTC" > /etc/localtime && \ |
||||
apt-get update && \ |
||||
apt-get install -y --no-install-recommends ca-certificates wget python3 apt-utils && \ |
||||
cd ~ && \ |
||||
wget -q https://nodejs.org/download/release/v$NODE_VER/node-v$NODE_VER-linux-$ARCH.tar.gz && \ |
||||
tar xf node-v$NODE_VER-linux-$ARCH.tar.gz && \ |
||||
rm node-v$NODE_VER-linux-$ARCH.tar.gz && \ |
||||
mv node-v$NODE_VER-linux-$ARCH /opt/node |
||||
|
||||
# Install Ruby 3.0 |
||||
ENV RUBY_VER="3.0.4" |
||||
RUN apt-get update && \ |
||||
apt-get install -y --no-install-recommends build-essential \ |
||||
bison libyaml-dev libgdbm-dev libreadline-dev libjemalloc-dev \ |
||||
libncurses5-dev libffi-dev zlib1g-dev libssl-dev && \ |
||||
cd ~ && \ |
||||
wget https://cache.ruby-lang.org/pub/ruby/${RUBY_VER%.*}/ruby-$RUBY_VER.tar.gz && \ |
||||
tar xf ruby-$RUBY_VER.tar.gz && \ |
||||
cd ruby-$RUBY_VER && \ |
||||
./configure --prefix=/opt/ruby \ |
||||
--with-jemalloc \ |
||||
--with-shared \ |
||||
--disable-install-doc && \ |
||||
make -j"$(nproc)" > /dev/null && \ |
||||
make install && \ |
||||
rm -rf ../ruby-$RUBY_VER.tar.gz ../ruby-$RUBY_VER |
||||
|
||||
ENV PATH="${PATH}:/opt/ruby/bin:/opt/node/bin" |
||||
|
||||
RUN npm install -g npm@latest && \ |
||||
npm install -g yarn && \ |
||||
gem install bundler && \ |
||||
apt-get update && \ |
||||
apt-get install -y --no-install-recommends git libicu-dev libidn11-dev \ |
||||
libpq-dev shared-mime-info |
||||
|
||||
COPY --link --from=ruby /opt/ruby /opt/ruby |
||||
COPY Gemfile* package.json yarn.lock /opt/mastodon/ |
||||
|
||||
ENV DEBIAN_FRONTEND="noninteractive" \ |
||||
PATH="${PATH}:/opt/ruby/bin" |
||||
RUN cd /opt/mastodon && \ |
||||
bundle config set --local deployment 'true' && \ |
||||
bundle config set --local without 'development test' && \ |
||||
bundle config set silence_root_warning true && \ |
||||
bundle install -j"$(nproc)" && \ |
||||
yarn install --pure-lockfile |
||||
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] |
||||
FROM ubuntu:20.04 |
||||
|
||||
WORKDIR /opt/mastodon |
||||
COPY Gemfile* package.json yarn.lock /opt/mastodon/ |
||||
# Copy over all the langs needed for runtime |
||||
COPY --from=build-dep /opt/node /opt/node |
||||
COPY --from=build-dep /opt/ruby /opt/ruby |
||||
|
||||
# hadolint ignore=DL3008 |
||||
RUN apt-get update && \ |
||||
apt-get -yq dist-upgrade && \ |
||||
apt-get install -y --no-install-recommends build-essential \ |
||||
git \ |
||||
libicu-dev \ |
||||
libidn-dev \ |
||||
libpq-dev \ |
||||
libjemalloc-dev \ |
||||
zlib1g-dev \ |
||||
libgdbm-dev \ |
||||
libgmp-dev \ |
||||
libssl-dev \ |
||||
libyaml-0-2 \ |
||||
ca-certificates \ |
||||
libreadline8 \ |
||||
python3 \ |
||||
shared-mime-info && \ |
||||
bundle config set --local deployment 'true' && \ |
||||
bundle config set --local without 'development test' && \ |
||||
bundle config set silence_root_warning true && \ |
||||
bundle install -j"$(nproc)" && \ |
||||
yarn install --pure-lockfile --production --network-timeout 600000 && \ |
||||
yarn cache clean |
||||
|
||||
FROM node:${NODE_VERSION} |
||||
|
||||
# Use those args to specify your own version flags & suffixes |
||||
ARG MASTODON_VERSION_PRERELEASE="" |
||||
ARG MASTODON_VERSION_METADATA="" |
||||
|
||||
ARG UID="991" |
||||
ARG GID="991" |
||||
|
||||
COPY --link --from=ruby /opt/ruby /opt/ruby |
||||
# Add more PATHs to the PATH |
||||
ENV PATH="${PATH}:/opt/ruby/bin:/opt/node/bin:/opt/mastodon/bin" |
||||
|
||||
# Create the mastodon user |
||||
ARG UID=991 |
||||
ARG GID=991 |
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] |
||||
|
||||
ENV DEBIAN_FRONTEND="noninteractive" \ |
||||
PATH="${PATH}:/opt/ruby/bin:/opt/mastodon/bin" |
||||
|
||||
# Ignoring these here since we don't want to pin any versions and the Debian image removes apt-get content after use |
||||
# hadolint ignore=DL3008,DL3009 |
||||
RUN apt-get update && \ |
||||
echo "Etc/UTC" > /etc/localtime && \ |
||||
groupadd -g "${GID}" mastodon && \ |
||||
useradd -l -u "$UID" -g "${GID}" -m -d /opt/mastodon mastodon && \ |
||||
apt-get -y --no-install-recommends install whois \ |
||||
wget \ |
||||
procps \ |
||||
libssl3 \ |
||||
libpq5 \ |
||||
imagemagick \ |
||||
ffmpeg \ |
||||
libjemalloc2 \ |
||||
libicu72 \ |
||||
libidn12 \ |
||||
libyaml-0-2 \ |
||||
file \ |
||||
ca-certificates \ |
||||
tzdata \ |
||||
libreadline8 \ |
||||
tini && \ |
||||
ln -s /opt/mastodon /mastodon |
||||
|
||||
# Note: no, cleaning here since Debian does this automatically |
||||
# See the file /etc/apt/apt.conf.d/docker-clean within the Docker image's filesystem |
||||
|
||||
echo "Etc/UTC" > /etc/localtime && \ |
||||
apt-get install -y --no-install-recommends whois wget && \ |
||||
addgroup --gid $GID mastodon && \ |
||||
useradd -m -u $UID -g $GID -d /opt/mastodon mastodon && \ |
||||
echo "mastodon:$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 | mkpasswd -s -m sha-256)" | chpasswd && \ |
||||
rm -rf /var/lib/apt/lists/* |
||||
|
||||
# Install mastodon runtime deps |
||||
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections |
||||
RUN apt-get update && \ |
||||
apt-get -y --no-install-recommends install \ |
||||
libssl1.1 libpq5 imagemagick ffmpeg libjemalloc2 \ |
||||
libicu66 libidn11 libyaml-0-2 \ |
||||
file ca-certificates tzdata libreadline8 gcc tini apt-utils && \ |
||||
ln -s /opt/mastodon /mastodon && \ |
||||
gem install bundler && \ |
||||
rm -rf /var/cache && \ |
||||
rm -rf /var/lib/apt/lists/* |
||||
|
||||
# Copy over mastodon source, and dependencies from building, and set permissions |
||||
COPY --chown=mastodon:mastodon . /opt/mastodon |
||||
COPY --chown=mastodon:mastodon --from=build /opt/mastodon /opt/mastodon |
||||
COPY --from=build-dep --chown=mastodon:mastodon /opt/mastodon /opt/mastodon |
||||
|
||||
# Run mastodon services in prod mode |
||||
ENV RAILS_ENV="production" |
||||
ENV NODE_ENV="production" |
||||
|
||||
ENV RAILS_ENV="production" \ |
||||
NODE_ENV="production" \ |
||||
RAILS_SERVE_STATIC_FILES="true" \ |
||||
BIND="0.0.0.0" \ |
||||
MASTODON_VERSION_PRERELEASE="${MASTODON_VERSION_PRERELEASE}" \ |
||||
MASTODON_VERSION_METADATA="${MASTODON_VERSION_METADATA}" |
||||
# Tell rails to serve static files |
||||
ENV RAILS_SERVE_STATIC_FILES="true" |
||||
ENV BIND="0.0.0.0" |
||||
|
||||
# Set the run user |
||||
USER mastodon |
||||
WORKDIR /opt/mastodon |
||||
|
||||
# Precompile assets |
||||
RUN OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder rails assets:precompile |
||||
RUN cd ~ && \ |
||||
OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder rails assets:precompile && \ |
||||
yarn cache clean |
||||
|
||||
# Set the work dir and the container entry point |
||||
WORKDIR /opt/mastodon |
||||
ENTRYPOINT ["/usr/bin/tini", "--"] |
||||
EXPOSE 3000 4000 |
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@ |
||||
web: env PORT=3000 RAILS_ENV=development bundle exec puma -C config/puma.rb |
||||
sidekiq: env PORT=3000 RAILS_ENV=development bundle exec sidekiq |
||||
stream: env PORT=4000 yarn run start |
||||
webpack: bin/webpack-dev-server |
||||
webpack: ./bin/webpack-dev-server --listen-host 0.0.0.0 |
||||
|
@ -1,8 +1,6 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
# Add your own tasks in files placed in lib/tasks ending in .rake, |
||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. |
||||
|
||||
require File.expand_path('config/application', __dir__) |
||||
require File.expand_path('../config/application', __FILE__) |
||||
|
||||
Rails.application.load_tasks |
||||
|
@ -1,12 +0,0 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
class InstancesIndex < Chewy::Index |
||||
settings index: index_preset(refresh_interval: '30s') |
||||
|
||||
index_scope ::Instance.searchable |
||||
|
||||
root date_detection: false do |
||||
field :domain, type: 'text', index_prefixes: { min_chars: 1, max_chars: 5 } |
||||
field :accounts_count, type: 'long' |
||||
end |
||||
end |
@ -1,67 +0,0 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
class PublicStatusesIndex < Chewy::Index |
||||
settings index: index_preset(refresh_interval: '30s', number_of_shards: 5), analysis: { |
||||
filter: { |
||||
english_stop: { |
||||
type: 'stop', |
||||
stopwords: '_english_', |
||||
}, |
||||
|
||||
english_stemmer: { |
||||
type: 'stemmer', |
||||
language: 'english', |
||||
}, |
||||
|
||||
english_possessive_stemmer: { |
||||
type: 'stemmer', |
||||
language: 'possessive_english', |
||||
}, |
||||
}, |
||||
|
||||
analyzer: { |
||||
verbatim: { |
||||
tokenizer: 'uax_url_email', |
||||
filter: %w(lowercase), |
||||
}, |
||||
|
||||
content: { |
||||
tokenizer: 'standard', |
||||
filter: %w( |
||||
lowercase |
||||
asciifolding |
||||
cjk_width |
||||
elision |
||||
english_possessive_stemmer |
||||
english_stop |
||||
english_stemmer |
||||
), |
||||
}, |
||||
|
||||
hashtag: { |
||||
tokenizer: 'keyword', |
||||
filter: %w( |
||||
word_delimiter_graph |
||||
lowercase |
||||
asciifolding |
||||
cjk_width |
||||
), |
||||
}, |
||||
}, |
||||
} |
||||
|
||||
index_scope ::Status.unscoped |
||||
.kept |
||||
.indexable |
||||
.includes(:media_attachments, :preloadable_poll, :preview_cards, :tags) |
||||
|
||||
root date_detection: false do |
||||
field(:id, type: 'long') |
||||
field(:account_id, type: 'long') |
||||
field(:text, type: 'text', analyzer: 'verbatim', value: ->(status) { status.searchable_text }) { field(:stemmed, type: 'text', analyzer: 'content') } |
||||
field(:tags, type: 'text', analyzer: 'hashtag', value: ->(status) { status.tags.map(&:display_name) }) |
||||
field(:language, type: 'keyword') |
||||
field(:properties, type: 'keyword', value: ->(status) { status.searchable_properties }) |
||||
field(:created_at, type: 'date') |
||||
end |
||||
end |
@ -1,65 +1,75 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
class StatusesIndex < Chewy::Index |
||||
settings index: index_preset(refresh_interval: '30s', number_of_shards: 5), analysis: { |
||||
include FormattingHelper |
||||
|
||||
settings index: { refresh_interval: '30s' }, analysis: { |
||||
filter: { |
||||
english_stop: { |
||||
type: 'stop', |
||||
stopwords: '_english_', |
||||
}, |
||||
|
||||
english_stemmer: { |
||||
type: 'stemmer', |
||||
language: 'english', |
||||
}, |
||||
|
||||
english_possessive_stemmer: { |
||||
type: 'stemmer', |
||||
language: 'possessive_english', |
||||
}, |
||||
}, |
||||
|
||||
analyzer: { |
||||
verbatim: { |
||||
tokenizer: 'uax_url_email', |
||||
filter: %w(lowercase), |
||||
}, |
||||
|
||||
content: { |
||||
tokenizer: 'standard', |
||||
tokenizer: 'uax_url_email', |
||||
filter: %w( |
||||
english_possessive_stemmer |
||||
lowercase |
||||
asciifolding |
||||
cjk_width |
||||
elision |
||||
english_possessive_stemmer |
||||
english_stop |
||||
english_stemmer |
||||
), |
||||
}, |
||||
|
||||
hashtag: { |
||||
tokenizer: 'keyword', |
||||
filter: %w( |
||||
word_delimiter_graph |
||||
lowercase |
||||
asciifolding |
||||
cjk_width |
||||
), |
||||
}, |
||||
}, |
||||
} |
||||
|
||||
index_scope ::Status.unscoped.kept.without_reblogs.includes(:media_attachments, :preview_cards, :local_mentioned, :local_favorited, :local_reblogged, :local_bookmarked, :tags, preloadable_poll: :local_voters), delete_if: ->(status) { status.searchable_by.empty? } |
||||
# We do not use delete_if option here because it would call a method that we |
||||
# expect to be called with crutches without crutches, causing n+1 queries |
||||
index_scope ::Status.unscoped.kept.without_reblogs.includes(:media_attachments, :preloadable_poll) |
||||
|
||||
crutch :mentions do |collection| |
||||
data = ::Mention.where(status_id: collection.map(&:id)).where(account: Account.local, silent: false).pluck(:status_id, :account_id) |
||||
data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) } |
||||
end |
||||
|
||||
crutch :favourites do |collection| |
||||
data = ::Favourite.where(status_id: collection.map(&:id)).where(account: Account.local).pluck(:status_id, :account_id) |
||||
data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) } |
||||
end |
||||
|
||||
crutch :reblogs do |collection| |
||||
data = ::Status.where(reblog_of_id: collection.map(&:id)).where(account: Account.local).pluck(:reblog_of_id, :account_id) |
||||
data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) } |
||||
end |
||||
|
||||
crutch :bookmarks do |collection| |
||||
data = ::Bookmark.where(status_id: collection.map(&:id)).where(account: Account.local).pluck(:status_id, :account_id) |
||||
data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) } |
||||
end |
||||
|
||||
crutch :votes do |collection| |
||||
data = ::PollVote.joins(:poll).where(poll: { status_id: collection.map(&:id) }).where(account: Account.local).pluck(:status_id, :account_id) |
||||
data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) } |
||||
end |
||||
|
||||
root date_detection: false do |
||||
field(:id, type: 'long') |
||||
field(:account_id, type: 'long') |
||||
field(:text, type: 'text', analyzer: 'verbatim', value: ->(status) { status.searchable_text }) { field(:stemmed, type: 'text', analyzer: 'content') } |
||||
field(:tags, type: 'text', analyzer: 'hashtag', value: ->(status) { status.tags.map(&:display_name) }) |
||||
field(:searchable_by, type: 'long', value: ->(status) { status.searchable_by }) |
||||
field(:language, type: 'keyword') |
||||
field(:properties, type: 'keyword', value: ->(status) { status.searchable_properties }) |
||||
field(:created_at, type: 'date') |
||||
field :id, type: 'long' |
||||
field :account_id, type: 'long' |
||||
|
||||
field :text, type: 'text', value: ->(status) { status.searchable_text } do |
||||
field :stemmed, type: 'text', analyzer: 'content' |
||||
end |
||||
|
||||
field :searchable_by, type: 'long', value: ->(status, crutches) { status.searchable_by(crutches) } |
||||
end |
||||
end |
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue