Skip to content

fix: Ignore Non-Messageable Channels #1036

fix: Ignore Non-Messageable Channels

fix: Ignore Non-Messageable Channels #1036

name: ClemBot.Bot-integration
on:
push:
branches: [ master ]
paths:
- "ClemBot.Bot/**"
pull_request:
branches: [ master ]
paths:
- "ClemBot.Bot/**"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ClemBot.Bot
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10.6"
- name: install poetry
uses: snok/install-poetry@v1
with:
version: 1.1.14
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
- name: load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: ClemBot.Bot/.venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('**/ClemBot.Bot-Integration.yml') }}
- name: install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install
- name: Validate static typing
id: static-typing-ci
continue-on-error: true
run: poetry run python -m mypy
- name: Create lint error folder
shell: bash
run: |
mkdir lint_errors
- name: Static typing lint failure comment
shell: bash
if: steps.static-typing-ci.outcome != 'success' && github.event_name == 'pull_request'
run: |
echo "${{github.event.number}}|**Static type linting failed:** Please see CI error output for details and fix the PRs typing" >> lint_errors/mypy-error.txt
- name: Check if Black would make any changes
id: black-ci
continue-on-error: true
run: poetry run python -m black bot --check
- name: Check if isort would make any changes
id: isort-ci
continue-on-error: true
run: poetry run python -m isort --check-only .
- name: Black lint failure comment
shell: bash
if: steps.black-ci.outcome != 'success' && github.event_name == 'pull_request'
run: |
echo "${{github.event.number}}|**Black linting failed:** Please run \`\`\`poetry run black bot\`\`\` from the \`ClemBot.Bot\` folder" >> lint_errors/black-error.txt
- name: Isort lint failure comment
shell: bash
if: steps.isort-ci.outcome != 'success' && github.event_name == 'pull_request'
run: |
echo "${{github.event.number}}|**isort linting failed:** Please run \`\`\`poetry run isort .\`\`\` from the \`ClemBot.Bot\` folder" >> lint_errors/isort-error.txt
- name: Upload lint errors
uses: actions/upload-artifact@v3
if: (steps.isort-ci.outcome != 'success' || steps.black-ci.outcome != 'success' || steps.static-typing-ci.outcome != 'success') && github.event_name == 'pull_request'
with:
name: lint-errors
path: ClemBot.Bot/lint_errors
- name: Fail PR if linting failed
uses: actions/github-script@v3
if: (steps.isort-ci.outcome != 'success' || steps.black-ci.outcome != 'success' || steps.static-typing-ci.outcome != 'success') && github.event_name == 'pull_request'
with:
script: |
core.setFailed('Linting failed, please see PR comment for details')
- name: Lint with pylint
run: |
poetry run python -m pylint bot -E -r y
- name: Test with pytest
run: |
poetry run python -m pytest