Skip to content

Commit

Permalink
Bump dependencies and speedup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Dec 8, 2022
1 parent 71b10cb commit dafcd0c
Show file tree
Hide file tree
Showing 14 changed files with 183 additions and 159 deletions.
69 changes: 66 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,69 @@
# Reconsider Dependabot if they ever add grouped updates: https://github.com/dependabot/dependabot-core/issues/1190

# 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: "npm"
directory: "/**"
allow:
- dependency-type: "production"
directory: "/tournament-scheduler"
target-branch: "develop"
schedule:
interval: "weekly"
labels:
- "dependencies"
- "tournament-scheduler"
assignees:
- "Avasam"
reviewers:
- "Avasam"
ignore:
- dependency-name: "*"
# Temporarily adding version-update:semver-minor to the ignore as dependabot
# still wants to increase the minor version in the lockfile only despite
# versioning-strategy: increase-if-necessary. This is a know issue:
# https://github.com/dependabot/dependabot-core/issues/3891
update-types:
["version-update:semver-patch", "version-update:semver-minor"]
versioning-strategy: increase-if-necessary

- package-ecosystem: "npm"
directory: "/global-scoreboard"
target-branch: "develop"
schedule:
interval: "weekly"
labels:
- "dependencies"
assignees:
- "Avasam"
reviewers:
- "Avasam"
ignore:
- dependency-name: "*"
# Temporarily adding version-update:semver-minor to the ignore as dependabot
# still wants to increase the minor version in the lockfile only despite
# versioning-strategy: increase-if-necessary. This is a know issue:
# https://github.com/dependabot/dependabot-core/issues/3891
update-types:
["version-update:semver-patch", "version-update:semver-minor"]
versioning-strategy: increase-if-necessary

- package-ecosystem: "pip"
directory: "/scripts"
target-branch: "develop"
schedule:
interval: "weekly"
labels:
- "dependencies"
assignees:
- "Avasam"
reviewers:
- "Avasam"

# Check for updates to GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
57 changes: 0 additions & 57 deletions .github/disabled-dependabot.yml

This file was deleted.

58 changes: 29 additions & 29 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ name: "CodeQL"

on:
push:
branches: [ main, develop ]
branches: [main, develop]
pull_request:
# The branches below must be a subset of the branches above
branches: [ develop ]
branches: [develop]
schedule:
- cron: '26 13 * * 6'
- cron: "26 13 * * 6"

jobs:
analyze:
Expand All @@ -28,40 +28,40 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript', 'python' ]
language: ["javascript", "python"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

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

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
7 changes: 5 additions & 2 deletions .github/workflows/lint-and-build-global-scoreboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ on:
push:
branches:
- main
- develop
paths:
- 'global-scoreboard/**'
- "global-scoreboard/**"
- ".github/workflows/lint-and-build-global-scoreboard.yml"
pull_request:
branches:
- main
- develop
paths:
- 'global-scoreboard/**'
- "global-scoreboard/**"
- ".github/workflows/lint-and-build-global-scoreboard.yml"
jobs:
ESLint:
runs-on: ubuntu-latest
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/lint-and-build-tournament-scheduler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ on:
push:
branches:
- main
- develop
paths:
- 'tournament-scheduler/**'
- "tournament-scheduler/**"
- ".github/workflows/lint-and-build-tournament-scheduler.yml"
pull_request:
branches:
- main
- develop
paths:
- 'tournament-scheduler/**'
- "tournament-scheduler/**"
- ".github/workflows/lint-and-build-tournament-scheduler.yml"
jobs:
ESLint:
runs-on: ubuntu-latest
Expand Down
45 changes: 23 additions & 22 deletions .github/workflows/lint-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,30 @@ on:
push:
branches:
- main
- develop
paths:
- "**.py"
- "**.pyi"
- ".github/workflows/lint-python.yml"
pull_request:
branches:
- main
- develop
paths:
- "**.py"
- "**.pyi"
- ".github/workflows/lint-python.yml"

env:
# https://help.pythonanywhere.com/pages/ChangingSystemImage/#available-python-versions-for-system-images
python-version: "3.10"
# https://help.pythonanywhere.com/pages/ChangingSystemImage/#base-ubuntu-version-for-each-system-image
pythonanywhere-image: "ubuntu-20.04"

jobs:
# Jobs that don't need dependencies installed
isort:
runs-on: ubuntu-latest
runs-on: ${{ env.pythonanywhere-image }}
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
Expand All @@ -29,15 +36,12 @@ jobs:
with:
python-version: ${{ env.python-version }}
cache: "pip"
cache-dependency-path: "scripts/requirements*.txt"
- name: Install dependencies
run: |
pip install wheel
pip install -r "scripts/requirements.txt"
cache-dependency-path: "scripts/requirements-dev.txt"
- run: pip install isort
- name: Analysing the code with ${{ job.name }}
run: isort backend/ typings/ --check-only
add-trailing-comma:
runs-on: ubuntu-latest
runs-on: ${{ env.pythonanywhere-image }}
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
Expand All @@ -46,12 +50,12 @@ jobs:
with:
python-version: ${{ env.python-version }}
cache: "pip"
cache-dependency-path: "scripts/requirements*.txt"
cache-dependency-path: "scripts/requirements-dev.txt"
- run: pip install add-trailing-comma
- name: Analysing the code with ${{ job.name }}
run: add-trailing-comma $(git ls-files '**.py*') --py36-plus
Bandit:
runs-on: ubuntu-latest
runs-on: ${{ env.pythonanywhere-image }}
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
Expand All @@ -60,13 +64,14 @@ jobs:
with:
python-version: ${{ env.python-version }}
cache: "pip"
cache-dependency-path: "scripts/requirements*.txt"
cache-dependency-path: "scripts/requirements-dev.txt"
- run: pip install bandit
- run: mv backend/configs.template.py backend/configs.py
- name: Analysing the code with ${{ job.name }}
run: bandit -n 1 --severity-level medium --recursive backend

# Jobs that do need dependencies installed
Pyright:
runs-on: ubuntu-latest
runs-on: ${{ env.pythonanywhere-image }}
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
Expand All @@ -79,15 +84,15 @@ jobs:
- name: Install dependencies
run: |
pip install wheel
pip install -r "scripts/requirements.txt"
pip install -r "scripts/requirements-dev.txt"
- run: mv backend/configs.template.py backend/configs.py
- name: Analysing the code with ${{ job.name }}
uses: jakebailey/pyright-action@v1
with:
working-directory: backend/
extra-args: --warnings
Pylint:
runs-on: ubuntu-latest
runs-on: ${{ env.pythonanywhere-image }}
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
Expand All @@ -100,12 +105,12 @@ jobs:
- name: Install dependencies
run: |
pip install wheel
pip install -r "scripts/requirements.txt"
pip install -r "scripts/requirements-dev.txt"
- run: mv backend/configs.template.py backend/configs.py
- name: Analysing the code with ${{ job.name }}
run: pylint backend/ --reports=y --output-format=colorized
Flake8:
runs-on: ubuntu-latest
runs-on: ${{ env.pythonanywhere-image }}
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
Expand All @@ -114,11 +119,7 @@ jobs:
with:
python-version: ${{ env.python-version }}
cache: "pip"
cache-dependency-path: "scripts/requirements*.txt"
- name: Install dependencies
run: |
pip install wheel
pip install -r "scripts/requirements.txt"
- run: mv backend/configs.template.py backend/configs.py
cache-dependency-path: "scripts/requirements-dev.txt"
- run: pip install -r "scripts/requirements-dev.txt"
- name: Analysing the code with ${{ job.name }}
run: flake8 backend/ typings/
2 changes: 1 addition & 1 deletion backend/api/global_scoreboard_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def update_player(name_or_id: str):
if configs.bypass_update_restrictions:
return __do_update_player_bypass_restrictions(name_or_id)
# pylint: disable=no-value-for-parameter # TODO: Raise this issue upstream
return __do_update_player(name_or_id) # type: ignore # TODO: Raise this issue upstream
return __do_update_player(name_or_id) # pyright: ignore[reportGeneralTypeIssues]
except UserUpdaterError as exception:
error_message = f"Error: {exception.args[0]['error']}\n{exception.args[0]['details']}"
return error_message, 424
Expand Down
Loading

0 comments on commit dafcd0c

Please sign in to comment.