diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml new file mode 100644 index 0000000..836ddbd --- /dev/null +++ b/.github/workflows/mypy.yml @@ -0,0 +1,23 @@ +name: mypy + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.11"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Set up environment + run: | + bash venv.sh + - name: Analysing the code with mypy + run: | + . .venv/bin/activate + mypy bot/TypoBot.py diff --git a/.gitignore b/.gitignore index 92f9969..fc371da 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ config.py __pycache__/ .venv/ storage.json +.mypy_cache/ diff --git a/venv.sh b/venv.sh index d1c0c76..504e6e5 100755 --- a/venv.sh +++ b/venv.sh @@ -9,7 +9,7 @@ function activate { source $VENV_DIR/bin/activate } -if [[ ! -f "$CONFIG_FILE" ]] then +if [ ! -f "$CONFIG_FILE" ]; then # Create example config file echo "DISCORD_TOKEN = \"token here\"" >> $CONFIG_FILE echo "STORAGE_FILE = \"storage.json\"" >> $CONFIG_FILE @@ -17,10 +17,11 @@ if [[ ! -f "$CONFIG_FILE" ]] then echo "STARBOARD_MINIMUM_STARS = 5" >> $CONFIG_FILE fi -if [[ ! -d "$VENV_DIR" ]] then +if [ ! -d "$VENV_DIR" ]; then # Create virtual environment and install required packages $PYTHON -m venv "$VENV_DIR" activate + pip install --upgrade pip pip install -r "$REQUIREMENTS" else activate