Skip to content

Commit

Permalink
Merge branch 'V3/develop' of github.com:Cog-Creators/Red-DiscordBot i…
Browse files Browse the repository at this point in the history
…nto V3/testing
  • Loading branch information
KaguneAstra committed Feb 4, 2025
2 parents 685602a + 769c319 commit ece78ab
Show file tree
Hide file tree
Showing 474 changed files with 47,145 additions and 41,457 deletions.
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@
"Category: Core - API - App Commands Package":
# Source
- redbot/core/app_commands/*
# Docs
- docs/framework_app_commands.rst
# Tests
- tests/core/test_app_commands.py
"Category: Core - API - Commands Package":
Expand All @@ -160,6 +162,7 @@
- any:
- redbot/core/_drivers/**/*
- "!redbot/core/_drivers/**/locales/*"
- redbot/core/_config.py
- redbot/core/config.py
# Docs
- docs/framework_config.rst
Expand Down Expand Up @@ -213,6 +216,7 @@
- redbot/core/commands/help.py
"Category: Core - i18n":
# Source
- redbot/core/_i18n.py
- redbot/core/i18n.py
# Locale files
- redbot/**/locales/*
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_label_pattern_exhaustiveness.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
Expand All @@ -34,14 +34,13 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: 'python'
# Override the default behavior so that the action doesn't attempt
# to auto-install Python dependencies
# Learn more...
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#analyzing-python-dependencies
setup-python-dependencies: false

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -55,4 +54,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
2 changes: 1 addition & 1 deletion .github/workflows/crowdin_upload_strings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
if: github.repository == 'Cog-Creators/Red-DiscordBot'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/lint_python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ jobs:
name: Lint Python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ env.ref }}
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- run: "python -m pip install git+https://github.com/pycqa/pyflakes@1911c20#egg=pyflakes git+https://github.com/pycqa/pycodestyle@d219c68#egg=pycodestyle git+https://github.com/pycqa/[email protected]#egg=flake8"
- run: >
python -m pip install
'pyflakes @ https://github.com/pycqa/pyflakes/tarball/1911c20'
'pycodestyle @ https://github.com/pycqa/pycodestyle/tarball/d219c68'
'flake8 @ https://github.com/pycqa/flake8/tarball/3.7.9'
name: Install Flake8
- run: "python -m flake8 . --count --select=E9,F7,F82 --show-source"
name: Flake8 Linting
4 changes: 2 additions & 2 deletions .github/workflows/prepare_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
needs: pr_stable_bump
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
milestone_number: ${{ steps.get_milestone_number.outputs.result }}
steps:
# Checkout repository and install Python
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down
51 changes: 46 additions & 5 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
# Checkout repository and install Python
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
name: Build package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
Expand All @@ -75,27 +75,68 @@ jobs:
run: python -m twine check dist/*

- name: Upload packaged distributions
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: build-output
path: ./dist

generate_default_ll_server_config:
name: Generate default application.yml
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Install script's dependencies
run: python -m pip install PyYAML

- name: Generate default application.yml
env:
APP_YML_FILE: "Red-DiscordBot-${{ github.ref_name }}-default-lavalink-application.yml"
run: |
mkdir -p release_assets
python .github/workflows/scripts/get_default_ll_server_config.py "release_assets/$APP_YML_FILE"
- name: Upload default application.yml
uses: actions/upload-artifact@v4
with:
name: ll-default-server-config
path: ./release_assets

release_to_pypi:
needs:
- release_information
- build
- generate_default_ll_server_config
environment: Release
name: Release to PyPI
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Download packaged distributions
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: build-output
path: dist/

- name: Download default application.yml
uses: actions/download-artifact@v4
with:
name: ll-default-server-config
path: release_assets/

- name: Upload dists to GitHub Release
env:
GITHUB_TOKEN: "${{ github.token }}"
run: |
gh release upload "$GITHUB_REF_NAME" dist/* release_assets/* --repo "$GITHUB_REPOSITORY"
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand All @@ -119,7 +160,7 @@ jobs:
run: |
echo "BASE_BRANCH=${TAG_BASE_BRANCH#'refs/heads/'}" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ env.BASE_BRANCH }}
- name: Set up Python
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/run_pip_compile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- macos-latest
steps:
- name: Checkout the repository.
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python 3.8.
uses: actions/setup-python@v4
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
python .github/workflows/scripts/compile_requirements.py
- name: Upload requirements files.
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ steps.compile_requirements.outputs.sys_platform }}
path: requirements/${{ steps.compile_requirements.outputs.sys_platform }}-*.txt
Expand All @@ -59,7 +59,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository.
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python 3.8.
uses: actions/setup-python@v4
Expand All @@ -71,17 +71,17 @@ jobs:
python -m pip install -U "packaging>=22.0"
- name: Download Windows requirements.
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: win32
path: requirements
- name: Download Linux requirements.
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: linux
path: requirements
- name: Download macOS requirements.
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: darwin
path: requirements
Expand All @@ -91,7 +91,7 @@ jobs:
python .github/workflows/scripts/merge_requirements.py
- name: Upload merged requirements files.
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: merged
path: |
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/scripts/compile_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ def pip_compile(version: str, name: str) -> None:
if EXCLUDE_STEM_RE.fullmatch(stem):
return

constraint_flags = [
arg
for file in REQUIREMENTS_FOLDER.glob(f"{sys.platform}-3.8-*.txt")
for arg in ("-c", file.name)
]

executable = ("py", f"-{version}") if sys.platform == "win32" else (f"python{version}",)
subprocess.check_call(
(
Expand All @@ -30,6 +36,7 @@ def pip_compile(version: str, name: str) -> None:
f"{name}.in",
"--output-file",
f"{stem}.txt",
*constraint_flags,
)
)

Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/scripts/get_default_ll_server_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import sys
from pathlib import Path

import yaml

ROOT_FOLDER = Path(__file__).parents[3].absolute()
AUDIO_FOLDER = ROOT_FOLDER / "redbot/cogs/audio"

# We want to import `redbot.cogs.audio.managed_node` package as if it were top-level package
# so we have to the `redbot/cogs/audio` directory to Python's path.
sys.path.insert(0, str(AUDIO_FOLDER))


def main() -> int:
try:
output_file = sys.argv[1]
except IndexError:
print("Usage:", sys.argv[0], "<output_file>", file=sys.stderr)
return 2

import managed_node

server_config = managed_node.get_default_server_config()
with open(output_file, "w", encoding="utf-8") as fp:
yaml.safe_dump(server_config, fp)

return 0


if __name__ == "__main__":
raise SystemExit(main())
2 changes: 2 additions & 0 deletions .github/workflows/scripts/merge_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def get_requirements(fp: TextIO) -> List[RequirementData]:
via_prefix = "via "
if source.startswith(via_prefix):
source = source[len(via_prefix) :]
if source.startswith("-c ") and source != "-c base.txt":
continue
current.comments.add(source)
elif line and not line.startswith(("#", " ")):
current = RequirementData(line)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
fail-fast: false
name: Tox - ${{ matrix.friendly_name }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ env.ref }}
- name: Set up Python
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ env.ref }}
- name: Set up Python
Expand Down
9 changes: 0 additions & 9 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ unsafe-load-any-extension=no
# run arbitrary code
extension-pkg-whitelist=

# Allow optimization of some AST trees. This will activate a peephole AST
# optimizer, which will apply various small optimizations. For instance, it can
# be used to obtain the result of joining multiple strings with the addition
# operator. Joining a lot of strings can lead to a maximum recursion error in
# Pylint and this flag can prevent that. It has one side effect, the resulting
# AST will be different than the one from reality.
optimize-ast=no


[MESSAGES CONTROL]

Expand Down Expand Up @@ -66,7 +58,6 @@ disable=C, # black is enforcing this for us already, incompatibly
[REPORTS]

output-format=parseable
files-output=no
reports=no


Expand Down
6 changes: 6 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ build:
os: "ubuntu-22.04"
tools:
python: "3.8"
jobs:
install:
- pip install .[doc]

sphinx:
configuration: docs/conf.py

python:
install:
Expand Down
Loading

0 comments on commit ece78ab

Please sign in to comment.