Rate limit the bot's channel.send #284
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_ROOT_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
ports: | |
- 3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 pytest mock pytest-cov pytest-asyncio requests BeautifulSoup4 mysql-connector-python pymongo | |
pip install -U py-cord --pre | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Setup database | |
run: | | |
mysql -h127.0.0.1 -P${{ job.services.mysql.ports['3306'] }} -uroot -p${{ secrets.DB_PASSWORD }} < /home/runner/work/Aiess/Aiess/schema.sql | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --extend-ignore=F722 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test with pytest & generate coverage | |
env: | |
BNSITE_HEADER_USERNAME: ${{ secrets.BNSITE_HEADER_USERNAME }} | |
BNSITE_HEADER_SECRET: ${{ secrets.BNSITE_HEADER_SECRET }} | |
OSU_API_KEY: ${{ secrets.OSU_API_KEY }} | |
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
DB_PORT: ${{ job.services.mysql.ports['3306'] }} | |
ROOT_PATH: /home/runner/work/Aiess/Aiess/ | |
run: | | |
pytest --cov=./ --cov-report=xml | |
- name: Upload coverage to Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml |