added lichess bot
This commit is contained in:
29
lichess_bot/.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
29
lichess_bot/.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a bug report
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Run lichess-bot with '...' commands [e.g. `python lichess-bot.py -v`]
|
||||
2. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Logs**
|
||||
Upload `lichess_bot_auto_logs\old.log`, `lichess_bot_auto_logs\recent.log`, and other logs/screenshots of the error.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. Windows]
|
||||
- Python Version [e.g. 3.11]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
20
lichess_bot/.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
lichess_bot/.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
16
lichess_bot/.github/dependabot.yml
vendored
Normal file
16
lichess_bot/.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "pip" # See documentation for possible values
|
||||
directory: "/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "daily"
|
||||
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
20
lichess_bot/.github/pull_request_template.md
vendored
Normal file
20
lichess_bot/.github/pull_request_template.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
## Type of pull request:
|
||||
- [ ] Bug fix
|
||||
- [ ] Feature
|
||||
- [ ] Other
|
||||
|
||||
## Description:
|
||||
|
||||
[Provide a brief description of the changes introduced by this pull request.]
|
||||
|
||||
## Related Issues:
|
||||
|
||||
[Reference any related issues that this pull request addresses or closes. Use the syntax `Closes #issue_number` to automatically close the linked issue upon merging.]
|
||||
|
||||
## Checklist:
|
||||
|
||||
- [ ] I have read and followed the [contribution guidelines](/CONTRIBUTING.md).
|
||||
- [ ] I have added necessary documentation (if applicable).
|
||||
- [ ] The changes pass all existing tests.
|
||||
|
||||
## Screenshots/logs (if applicable):
|
||||
32
lichess_bot/.github/workflows/mypy.yml
vendored
Normal file
32
lichess_bot/.github/workflows/mypy.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
# This workflow will install Python dependencies and run mypy
|
||||
|
||||
name: Mypy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
mypy:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-latest]
|
||||
python: [3.9, "3.11"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python ${{ matrix.python }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
pip install -r test_bot/test-requirements.txt
|
||||
- name: Run mypy
|
||||
run: |
|
||||
mypy --strict .
|
||||
44
lichess_bot/.github/workflows/python-build.yml
vendored
Normal file
44
lichess_bot/.github/workflows/python-build.yml
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# This workflow will install Python dependencies and lint
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
||||
|
||||
name: Python Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
python: [3.9, "3.10", "3.11"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python ${{ matrix.python }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
pip install -r test_bot/test-requirements.txt
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide.
|
||||
# W503 and W504 are mutually exclusive. W504 is considered the best practice now.
|
||||
flake8 . --count --max-complexity=10 --max-line-length=127 --statistics --ignore=D,W503
|
||||
- name: Lint with flake8-markdown
|
||||
run: |
|
||||
flake8-markdown "*.md"
|
||||
flake8-markdown "wiki/*.md"
|
||||
- name: Lint with flake8-docstrings
|
||||
run: |
|
||||
flake8 . --count --max-line-length=127 --statistics --select=D
|
||||
48
lichess_bot/.github/workflows/python-test.yml
vendored
Normal file
48
lichess_bot/.github/workflows/python-test.yml
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
# This workflow will install Python dependencies and run tests
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
||||
|
||||
name: Python Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
python: [3.9, "3.11"]
|
||||
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python ${{ matrix.python }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
pip install -r test_bot/test-requirements.txt
|
||||
- name: Restore engines
|
||||
id: cache-temp-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
TEMP
|
||||
key: ${{ matrix.os }}-engines
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
pytest --log-cli-level=10
|
||||
- name: Save engines
|
||||
id: cache-temp-save
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
TEMP
|
||||
key: ${{ steps.cache-temp-restore.outputs.cache-primary-key }}
|
||||
65
lichess_bot/.github/workflows/sync-wiki.yml
vendored
Normal file
65
lichess_bot/.github/workflows/sync-wiki.yml
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
name: Sync wiki
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'wiki/**'
|
||||
- 'README.md'
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
if: github.repository == 'lichess_bot-devs/lichess_bot'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Checkout wiki
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: "${{ github.repository }}.wiki"
|
||||
path: "lichess_bot.wiki"
|
||||
- name: Set path
|
||||
uses: dorny/paths-filter@v2
|
||||
id: changes
|
||||
with:
|
||||
filters: |
|
||||
wiki:
|
||||
- 'wiki/**'
|
||||
home:
|
||||
- 'wiki/Home.md'
|
||||
readme:
|
||||
- 'README.md'
|
||||
- name: Prevent Conflicts
|
||||
if: |
|
||||
steps.changes.outputs.home == 'true' &&
|
||||
steps.changes.outputs.readme == 'true'
|
||||
run: |
|
||||
echo "Error: Conflicting changes. Edit either the README.md file or the wiki/Home.md file, not both."
|
||||
exit 1
|
||||
- name: Set github bot global config
|
||||
run: |
|
||||
git config --global user.email "actions@github.com"
|
||||
git config --global user.name "actions-user"
|
||||
- name: Sync README.md to wiki/Home.md
|
||||
if: steps.changes.outputs.readme == 'true'
|
||||
run: |
|
||||
cp -r $GITHUB_WORKSPACE/README.md $GITHUB_WORKSPACE/wiki/Home.md
|
||||
git add wiki/Home.md
|
||||
git commit -m "Auto update wiki/Home.md"
|
||||
git push
|
||||
- name: Sync wiki/Home.md to README.md
|
||||
if: steps.changes.outputs.home == 'true'
|
||||
run: |
|
||||
cp -r $GITHUB_WORKSPACE/wiki/Home.md $GITHUB_WORKSPACE/README.md
|
||||
git add README.md
|
||||
git commit -m "Auto update README.md"
|
||||
git push
|
||||
- name: Sync all files to wiki
|
||||
run: |
|
||||
cp -r $GITHUB_WORKSPACE/wiki/* $GITHUB_WORKSPACE/lichess-bot.wiki
|
||||
cd $GITHUB_WORKSPACE/lichess-bot.wiki
|
||||
git add .
|
||||
git commit -m "Auto update wiki"
|
||||
git push
|
||||
26
lichess_bot/.github/workflows/update_version.py
vendored
Normal file
26
lichess_bot/.github/workflows/update_version.py
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"""Automatically updates the lichess_bot version."""
|
||||
import yaml
|
||||
import datetime
|
||||
import os
|
||||
|
||||
with open("lib/versioning.yml") as version_file:
|
||||
versioning_info = yaml.safe_load(version_file)
|
||||
|
||||
current_version = versioning_info["lichess_bot_version"]
|
||||
|
||||
utc_datetime = datetime.datetime.utcnow()
|
||||
new_version = f"{utc_datetime.year}.{utc_datetime.month}.{utc_datetime.day}."
|
||||
if current_version.startswith(new_version):
|
||||
current_version_list = current_version.split(".")
|
||||
current_version_list[-1] = str(int(current_version_list[-1]) + 1)
|
||||
new_version = ".".join(current_version_list)
|
||||
else:
|
||||
new_version += "1"
|
||||
|
||||
versioning_info["lichess_bot_version"] = new_version
|
||||
|
||||
with open("lib/versioning.yml", "w") as version_file:
|
||||
yaml.dump(versioning_info, version_file, sort_keys=False)
|
||||
|
||||
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
|
||||
print(f"new_version={new_version}", file=fh)
|
||||
30
lichess_bot/.github/workflows/versioning.yml
vendored
Normal file
30
lichess_bot/.github/workflows/versioning.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
name: Versioning
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
versioning:
|
||||
if: github.repository == 'lichess_bot-devs/lichess_bot'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python 3.11
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install PyYAML
|
||||
- name: Update version
|
||||
id: new-version
|
||||
run: python .github/workflows/update_version.py
|
||||
- name: Auto update version
|
||||
run: |
|
||||
git config --global user.email "actions@github.com"
|
||||
git config --global user.name "actions-user"
|
||||
git add lib/versioning.yml
|
||||
git commit -m "Auto update version to ${{ steps.new-version.outputs.new_version }}"
|
||||
git push origin HEAD:master
|
||||
Reference in New Issue
Block a user