diff options
-rw-r--r-- | .github/workflows/wee-slack.yml | 28 | ||||
-rw-r--r-- | slack/slack_emoji.py | 22 |
2 files changed, 36 insertions, 14 deletions
diff --git a/.github/workflows/wee-slack.yml b/.github/workflows/wee-slack.yml index 7decad2..9baf5ba 100644 --- a/.github/workflows/wee-slack.yml +++ b/.github/workflows/wee-slack.yml @@ -2,7 +2,7 @@ name: wee-slack on: [push, pull_request] jobs: - build: + test: if: > github.event_name == 'push' || ( github.event_name == 'pull_request' && @@ -11,6 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] @@ -31,8 +32,33 @@ jobs: - run: poetry run pytest tests + build: + if: > + github.event_name == 'push' || ( + github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name != github.repository + ) + + needs: test + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Install WeeChat, tmux and python3-websocket + run: | + sudo apt-get update + sudo apt-get install weechat-headless tmux python3-websocket + - run: ./build.sh + - name: Load slack.py in WeeChat + run: | + WEECHAT_DIR=$(mktemp -d) + tmux new-session -d "weechat-headless --dir $WEECHAT_DIR -r '/script load $PWD/build/slack.py; /quit'" + while pidof -q tmux; do :; done + cat $WEECHAT_DIR/logs/core.weechat.weechatlog + grep -q 'python: registered script "slack"' $WEECHAT_DIR/logs/core.weechat.weechatlog + - uses: actions/upload-artifact@v3 with: name: slack.py diff --git a/slack/slack_emoji.py b/slack/slack_emoji.py index e2b9b11..d6247c3 100644 --- a/slack/slack_emoji.py +++ b/slack/slack_emoji.py @@ -2,7 +2,7 @@ from __future__ import annotations import json import os -from typing import TYPE_CHECKING, Any, Dict +from typing import TYPE_CHECKING, Dict import weechat @@ -11,20 +11,16 @@ from slack.log import print_error if TYPE_CHECKING: from typing_extensions import NotRequired, TypedDict -else: - TypedDict = Any + class EmojiSkinVariation(TypedDict): + name: str + unicode: str -class EmojiSkinVariation(TypedDict): - name: str - unicode: str - - -class Emoji(TypedDict): - aliasOf: NotRequired[str] - name: str - skinVariations: NotRequired[Dict[str, EmojiSkinVariation]] - unicode: str + class Emoji(TypedDict): + aliasOf: NotRequired[str] + name: str + skinVariations: NotRequired[Dict[str, EmojiSkinVariation]] + unicode: str def load_standard_emojis() -> Dict[str, Emoji]: |