Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
252 commits
Select commit Hold shift + click to select a range
bbe6000
Delete .github/workflows/testing.yml
houndlord Oct 2, 2023
9383651
Create formatting_testing.yml
houndlord Oct 2, 2023
11811a1
Merge pull request #20 from houndlord/dev
houndlord Oct 2, 2023
2de92b2
Merge pull request #19 from houndlord/jobs
houndlord Oct 2, 2023
bfa2974
nice group chat nux POC (#25)
alexeyqu Oct 5, 2023
9af812f
group nux no whois, avoid slow /start via hack (#26)
alexeyqu Oct 17, 2023
7667ab1
support adding multiple users
alexeyqu Oct 17, 2023
c493626
update whois
alexeyqu Oct 17, 2023
97a161e
Do things better, faster, stronger
houndlord Oct 19, 2023
6ff8a15
Merge pull request #27 from houndlord/dev
houndlord Oct 19, 2023
118b7ed
New UX
houndlord Oct 20, 2023
6b0ba8f
Merge pull request #28 from houndlord/dev
houndlord Oct 20, 2023
3f3c185
New UX backend
houndlord Oct 21, 2023
3f7d3bd
Merge pull request #29 from houndlord/dev
houndlord Oct 23, 2023
210abaf
reducing the number of open DB connections
alexeyqu Oct 23, 2023
7dd4bf0
get all users as list of users, not Query[User]
alexeyqu Oct 23, 2023
0eb349c
more logs, expunge User objects in get_chats_list
alexeyqu Oct 23, 2023
f8fcc79
cleanup
alexeyqu Oct 23, 2023
33b120a
don't log if failed to call get_chat_member
alexeyqu Oct 23, 2023
cb42546
copy and paste is not a design pattern. quality of code improvements
houndlord Oct 25, 2023
1d8c0c8
Merge pull request #30 from houndlord/dev
houndlord Oct 25, 2023
894decc
remove default values from DB schema
houndlord Oct 25, 2023
0df3f75
remove default values from DB schema (#31)
houndlord Oct 26, 2023
18c0bd8
fix UX wrong buttons
houndlord Oct 27, 2023
d208d18
Merge branch 'alexeyqu:dev' into dev
houndlord Oct 27, 2023
5d369e0
fix UX bug (#33)
houndlord Oct 27, 2023
0a3ab31
fix @admin
alexeyqu Oct 27, 2023
07d8a79
Merge branch 'alexeyqu:dev' into dev
houndlord Oct 27, 2023
fefad30
fix #update flow
alexeyqu Oct 27, 2023
9268975
some fixes
alexeyqu Oct 27, 2023
e041949
fix missing variable
alexeyqu Oct 27, 2023
0af07b7
better new chat message
alexeyqu Oct 27, 2023
a0facd9
fix help msg
alexeyqu Oct 27, 2023
b4bc3e5
change texts when navigating
alexeyqu Oct 27, 2023
c13c87d
add a missing button
alexeyqu Oct 27, 2023
3c862c2
merge sess with chat
alexeyqu Oct 27, 2023
cc1231e
update messages
alexeyqu Oct 27, 2023
94bf052
add missing button handlers
alexeyqu Oct 27, 2023
5c39b35
more msg updates
alexeyqu Oct 27, 2023
db75ffe
add chat name
alexeyqu Oct 27, 2023
6aa6a09
get chat name hack
alexeyqu Oct 28, 2023
74daa9b
fix msg for setting whois length
alexeyqu Oct 28, 2023
b418a5e
fix typo
alexeyqu Oct 28, 2023
010657f
fix #update hashtag
alexeyqu Oct 28, 2023
0113840
Merge pull request #40 from alexeyqu/dev
houndlord Oct 28, 2023
c47eeea
last fixes
alexeyqu Oct 28, 2023
f776f76
Update README.md
alexeyqu Oct 28, 2023
f3bbfce
Merge pull request #34 from alexeyqu/dev
alexeyqu Oct 28, 2023
8072382
bugfix: remove any messages after 1h
alexeyqu Oct 28, 2023
a308f85
bugfix: remove any messages after 1h (#35)
alexeyqu Oct 28, 2023
db5e8ac
bugfix: fix missing var in _delete_message calls
alexeyqu Oct 28, 2023
a9dd342
Merge branch 'master' into dev
alexeyqu Oct 30, 2023
0a892b1
feat: pickle persistence (#36)
alexeyqu Oct 30, 2023
a521c1a
feat: add debug cmds (listjobs) + minimal gating infra (#37)
alexeyqu Oct 30, 2023
75d0776
last fixes
alexeyqu Oct 28, 2023
aba0309
Update README.md
alexeyqu Oct 28, 2023
5e48eed
bugfix: remove any messages after 1h (#35)
alexeyqu Oct 28, 2023
7d107c3
feat: introduce new way for getting texts with help of new 'texts' fi…
houndlord Oct 30, 2023
95b49c0
Merge branch 'dev' into dev
houndlord Oct 31, 2023
352dff0
Merge pull request #43 from alexeyqu/dev
houndlord Oct 31, 2023
49d754e
fix: change overseen constants to new texts api
houndlord Oct 31, 2023
556d387
Merge pull request #39 from houndlord/dev
houndlord Oct 31, 2023
7a329bb
add job persistent updater
alexeyqu Nov 1, 2023
8bf924d
fix: restore deleted code
alexeyqu Nov 1, 2023
ca4fe80
fix: one more missing message
alexeyqu Nov 1, 2023
bfbcd40
fix: help message
alexeyqu Nov 1, 2023
400e130
feat: better error handler logs
alexeyqu Nov 1, 2023
bdf166b
fix: bind jobs storage to disk file
alexeyqu Nov 1, 2023
abd5fdd
fix: change bind path for jobs.json
alexeyqu Nov 1, 2023
4f92524
fix: ensure python process gets the SIGTERM from docker stop cmd
alexeyqu Nov 1, 2023
edc305d
chore: touch jobs.json in Github Actions
alexeyqu Nov 1, 2023
60a9ceb
fix: add \ to %USER_MENTION% to make it work with Markdown
alexeyqu Nov 1, 2023
517b212
fix: remove extra slashes in %USER_MENTION%
alexeyqu Nov 1, 2023
1c9fbc8
fix: remove backslash when storing USER_MENTION in DB
alexeyqu Nov 1, 2023
39fbb49
Merge pull request #44 from alexeyqu/dev
houndlord Nov 1, 2023
590cf38
fix: sort out back to %USER\_MENTION%
alexeyqu Nov 1, 2023
680a528
fix: rm RH constants
alexeyqu Nov 1, 2023
c298186
chore: refactor send_message_with_deletion
alexeyqu Nov 1, 2023
b5ff64c
chore: remove default arguments
alexeyqu Nov 1, 2023
0d653c3
chore: rename some vars
alexeyqu Nov 1, 2023
337fe6a
chore: rename function
alexeyqu Nov 1, 2023
b3c4c65
chore: black
alexeyqu Nov 1, 2023
645a707
fix: don't ask to update the admin with empty whois
alexeyqu Nov 1, 2023
fad4cd3
fix: pretties USER_MENTION display in settings
alexeyqu Nov 1, 2023
9171fc3
chore: remove user_id from delete_message job
alexeyqu Nov 1, 2023
8882e6f
fix: fix display of settings
alexeyqu Nov 1, 2023
0bf5f1c
fix job removal
alexeyqu Nov 1, 2023
671d0b7
fix: pass envs to docker
alexeyqu Nov 1, 2023
6702bb6
fix: properly get DEBUG var
alexeyqu Nov 1, 2023
ca5f261
properly pass team tg ids
alexeyqu Nov 1, 2023
29a5db1
temporary log team ids
alexeyqu Nov 1, 2023
da37ca7
Revert "temporary log team ids"
alexeyqu Nov 1, 2023
3f7dd91
Merge pull request #40 from alexeyqu/dev
alexeyqu Nov 1, 2023
47296a6
fix: fetch proper whois update message
alexeyqu Nov 2, 2023
1f8c1e3
fix: properly get on_introduce_message_update
alexeyqu Nov 3, 2023
32a8038
refactor: migration to asyncio
houndlord Nov 6, 2023
9c7058b
Merge branch 'dev' into dev
houndlord Nov 8, 2023
ef078c2
Merge pull request #41 from houndlord/dev
houndlord Nov 8, 2023
bdcc906
fix: await create_chats_list_keyboard
alexeyqu Nov 12, 2023
8871085
fix: send startup message before run_polling
alexeyqu Nov 12, 2023
27936e8
fix: re-add PicklePersistence
alexeyqu Nov 12, 2023
991e37a
fix: delete welcome message even if kick_timeout == 0, decople deleti…
alexeyqu Nov 16, 2023
fe2040a
fix: decompose awaiting for parsed entities and getting result
houndlord Nov 17, 2023
8883a3c
Merge pull request #43 from houndlord/fix
houndlord Nov 17, 2023
0df3046
fix: fix help cmd
alexeyqu Dec 3, 2023
b35d746
fix: rm duplicated /help text
alexeyqu Dec 3, 2023
38cfde0
feat: initial testing infrastructure
houndlord Nov 11, 2023
afd5fe5
Merge pull request #42 from houndlord/dev
houndlord Dec 6, 2023
f2d675b
feat: log exceptions to sentry
alexeyqu Dec 10, 2023
1aab3a9
feat: add postgres persistence for jobs
alexeyqu Dec 11, 2023
8e49cfa
misc
alexeyqu Dec 11, 2023
2ceea85
Merge pull request #44 from alexeyqu/feature/add-postgres-persistence…
alexeyqu Dec 11, 2023
52c07e3
chore: rename POSTGRES_URL to DATABASE_URL in workflows
alexeyqu Dec 11, 2023
49bf80a
fix: fix sentry
alexeyqu Dec 11, 2023
058c234
fix: send WARN to sentry
alexeyqu Dec 11, 2023
bdfbb58
feat: persistence db for prod
alexeyqu Dec 16, 2023
fcbe06a
feat: additional tests
houndlord Dec 17, 2023
1da541f
Merge pull request #45 from houndlord/dev
alexeyqu Dec 18, 2023
9400082
feat: otlp & uptrace monitoring
alexeyqu Dec 19, 2023
f627b70
fix: better logging of exceptions from on_kick_timeout
alexeyqu Jan 1, 2024
c2a0212
chore: rename testing* to test* to work better with pytest
alexeyqu Jan 8, 2024
b7db724
fix: patch get_uri before import, remove TESTING env var
alexeyqu Jan 8, 2024
800a8d1
feat: test onboarding a new chat
alexeyqu Jan 8, 2024
522b866
feat: fix failing group tests, minor changes to group handler to make…
houndlord Jan 9, 2024
a4f7df0
Merge pull request #46 from houndlord/dev
houndlord Jan 13, 2024
63e98b3
Merge branch 'master' into dev
alexeyqu Jan 14, 2024
6ce421b
fix: rm sentry code
alexeyqu Jan 14, 2024
078c013
feat: add DEPLOYMENT_ENVIRONMENT to group uptrace logs
alexeyqu Jan 14, 2024
961f54c
fix: pass UPTRACE_DSN for testing
alexeyqu Jan 14, 2024
84f34e7
chore: rm SENTRY_DSN
alexeyqu Jan 14, 2024
96e5c94
fix: move Update to extra for logging
alexeyqu Jan 14, 2024
bfbfbda
Revert "fix: move Update to extra for logging"
alexeyqu Jan 14, 2024
af70ba4
fix: fix /help
alexeyqu Jan 14, 2024
38da4af
fix: fix typo in _send_message_with_deletion
alexeyqu Jan 20, 2024
6bf0820
fix: fix problem with migrations, alembic is refactored to work with …
houndlord Jan 31, 2024
cee8d9f
fix: fix bug in _send_message_with_deletion()
houndlord Jan 31, 2024
5710f46
fix: fix bug with not working markdown substitution
houndlord Feb 2, 2024
20be8fd
fix: add missing await
alexeyqu Feb 18, 2024
8915593
fix: fix problem with migrations, alembic is refactored to work with …
houndlord Jan 31, 2024
e03027d
fix: fix bug in _send_message_with_deletion()
houndlord Jan 31, 2024
1b236d9
fix: fix bug with not working markdown substitution
houndlord Feb 2, 2024
d084581
fix: consistency with USER_MENTION
alexeyqu Feb 18, 2024
8d70de8
fix: set to now() in rescheduler helper
alexeyqu Feb 18, 2024
1ca8118
fix: no chat_id key in job data
alexeyqu Feb 18, 2024
8b587ea
Merge branch 'alexeyqu:dev' into dev
houndlord Feb 18, 2024
784c313
Merge pull request #47 from alexeyqu/dev
alexeyqu Feb 18, 2024
91b3c3e
fix: update.message handling of edited messages
alexeyqu Feb 18, 2024
c466ecc
fix: rm filters.Entity
alexeyqu Feb 18, 2024
3a84c5d
chore: remove old persistence class
alexeyqu Feb 19, 2024
ff6c9dc
fix: use update.effective_message
alexeyqu Feb 19, 2024
33e040f
fix: handle #update message properly
alexeyqu Feb 19, 2024
0fe424d
fix: streamline setting defaults for a new chat
alexeyqu Feb 19, 2024
df44a10
chore: fix .env handling
alexeyqu Feb 19, 2024
f34b0cd
fix: fix cls in get_new_chat
alexeyqu Feb 19, 2024
f6056a8
Merge pull request #49 from alexeyqu/master
houndlord Feb 20, 2024
0752c06
Merge branch 'alexeyqu:dev' into dev
houndlord Feb 20, 2024
ef95981
fix: use data to pass chat_id and user_id to jobs
alexeyqu Feb 20, 2024
c8bc77d
chore: remove jobs.json
alexeyqu Feb 20, 2024
3a41114
fix: handle missing user_id key in job data
alexeyqu Feb 22, 2024
8f6269d
feat: better list jobs
alexeyqu Feb 22, 2024
60f27fa
fix: correct timeout for deleting on_new_chat_member_message
alexeyqu Feb 22, 2024
43bd7ba
fix: unpack status difference if there is none
alexeyqu Feb 22, 2024
2ae4616
fix: return all jobs if listjobs arg is none
alexeyqu Feb 22, 2024
879f507
fix: correctly handle negative deletion timeouts
alexeyqu Feb 22, 2024
dc083fc
fix: only reschedule jobs belonging to chat
alexeyqu Feb 22, 2024
eebbc8c
fix: await remove_user_jobs_from_queue
alexeyqu Feb 22, 2024
cd24d09
fix: default the deletion of welcome message to 36h
alexeyqu Mar 29, 2024
b0f2be6
remove #update flow
houndlord Apr 5, 2024
3fac0d6
Merge pull request #50 from houndlord/dev
alexeyqu Apr 6, 2024
66e902f
Merge pull request #51 from alexeyqu/master
houndlord Apr 6, 2024
fd82099
Merge pull request #52 from alexeyqu/dev
alexeyqu Apr 7, 2024
5afaf82
Initial support for 'new_member' metric
houndlord Apr 13, 2024
fd6870e
Merge branch 'dev' into metrics
houndlord Apr 14, 2024
8f562bd
Merge pull request #53 from houndlord/metrics
houndlord Apr 14, 2024
3846501
fix broken Pipfile
houndlord Apr 14, 2024
5aa05f7
Merge branch 'metrics' of https://github.com/houndlord/wachter_bot in…
houndlord Apr 14, 2024
46c0dd0
Merge pull request #54 from houndlord/metrics
houndlord Apr 14, 2024
0f89c23
feat: more counters
houndlord Apr 15, 2024
d7f3768
fix
houndlord Apr 15, 2024
f5cc843
Merge pull request #48 from alexeyqu/dev
houndlord Apr 16, 2024
a689df2
update group_handler.py
houndlord Apr 16, 2024
2848fd8
Merge pull request #55 from houndlord/metrics
houndlord Apr 16, 2024
ecbd276
Merge pull request #56 from alexeyqu/dev
alexeyqu Apr 16, 2024
41d54b4
feat: add chat_id to new_member counter
houndlord May 7, 2024
83b3fb6
Merge pull request #57 from houndlord/metrics
alexeyqu May 21, 2024
60437bc
fix: write whois to DB
alexeyqu May 29, 2024
31918ab
feat: add chats metric exporter
houndlord Jun 9, 2024
7185609
feat: add total users and unique users metrics
houndlord Jun 10, 2024
98aef39
Merge pull request #58 from houndlord/metric-job
alexeyqu Jun 10, 2024
2efdd81
fix: update formatting_testing.yml
houndlord Jun 13, 2024
3aee800
Merge pull request #60 from houndlord/dev
houndlord Jun 13, 2024
21fb4b3
fix: fix tests
houndlord Jun 24, 2024
99b109c
fix: write whois to DB
alexeyqu May 29, 2024
24f0d3d
formatting
houndlord Jun 24, 2024
252c1ce
formatting
houndlord Jun 24, 2024
3a4b834
ci: add testing.yml
houndlord Jun 24, 2024
1fa6cf3
ci: change python version in testing.yml
houndlord Jun 24, 2024
6be0340
ci: fix testing.yml
houndlord Jun 24, 2024
1945730
ci: fix testing.yml, add caching
houndlord Jun 24, 2024
abfb790
Merge pull request #61 from houndlord/fix-tests
houndlord Jul 11, 2024
71b2726
Merge pull request #62 from houndlord/dev
houndlord Jul 11, 2024
0261c29
fix: switch to a less noisy package for TG logging
alexeyqu Oct 18, 2024
3f6059d
fix: forgot to delete experiment
alexeyqu Oct 18, 2024
69bce3c
fix: fix improper markdown rendering. Migrate to MARKDOWN_V2
houndlord Dec 6, 2024
2ce3761
Merge branch 'dev' into master
alexeyqu Dec 10, 2024
b70e3e7
Merge pull request #64 from alexeyqu/master
alexeyqu Dec 10, 2024
0ffcb3e
fix: fix escaping of keys inside curly brackets in texts
houndlord Dec 20, 2024
f1d88b1
feat: benchmark get_chats_list timings
alexeyqu Jan 15, 2025
1c960f3
Merge branch 'dev' of github.com:alexeyqu/wachter_bot into dev
alexeyqu Jan 15, 2025
ee9745f
feat: move cloud db to local docker container
alexeyqu Jan 15, 2025
7e5f38e
fix: get alembic url from env variables
alexeyqu Jan 15, 2025
bf8fa57
fix: set ini option for db URL in alembic config
alexeyqu Jan 15, 2025
01e9ba4
fix: retrieve sql uri for alembic from env variables
alexeyqu Jan 15, 2025
92cd04a
fix: route ports for local db containers
alexeyqu Jan 15, 2025
407aa5d
fix: clean up testing compose yml
alexeyqu Jan 18, 2025
f265b1a
fix: explicitly use internal network for db containers
alexeyqu Jan 18, 2025
e857e53
fix: rename testing services to separate them from prod
alexeyqu Jan 18, 2025
6298f8f
feat: prepare for prod db migration
alexeyqu Jan 19, 2025
0a14937
Merge branch 'master' into dev
alexeyqu Jan 19, 2025
d018db5
Merge pull request #66 from alexeyqu/dev
alexeyqu Jan 19, 2025
785089f
fix: ack that job.data is optional
alexeyqu Jan 19, 2025
938f2c0
Merge pull request #65 from houndlord/dev
alexeyqu Jan 19, 2025
41bb4dd
Merge branch 'master' into dev
alexeyqu Jan 19, 2025
968fe4d
fix: proper but ugly mentions
alexeyqu Jan 19, 2025
98f1c73
Merge pull request #67 from alexeyqu/dev
alexeyqu Jan 19, 2025
8cf7a49
fix: mentions massacre
alexeyqu Jan 19, 2025
ada80b2
Merge pull request #68 from alexeyqu/dev
alexeyqu Jan 19, 2025
b8ee688
fix: log final message_mention for debug
alexeyqu Jan 19, 2025
0653e7c
fix: tmp go back to MARKDOWN v1
alexeyqu Jan 20, 2025
8ab159a
fix: setup metric collection job once
alexeyqu May 6, 2025
21b34ca
feat: add manual CI runs option
alexeyqu Jun 18, 2025
d660708
Merge pull request #72 from wachter-org/master
alexeyqu Nov 6, 2025
c6bbce9
dummy
alexeyqu Nov 6, 2025
fca89a8
Revert "dummy"
alexeyqu Nov 6, 2025
66cc1c2
feat: pin postgres to 16-alpine
alexeyqu Nov 6, 2025
3cff810
feat: pin postgres to 17-alpine
alexeyqu Nov 6, 2025
150e67b
fix: error handler
alexeyqu Nov 7, 2025
6fb8246
fix: make error handler async
alexeyqu Nov 7, 2025
7610b56
fix: error handler
alexeyqu Nov 7, 2025
893b3dc
fix: very safe logging
alexeyqu Nov 7, 2025
bf6e278
fix: switch to wachter-org images
alexeyqu Nov 7, 2025
ae517dc
fix: docker login
alexeyqu Nov 7, 2025
c0168ba
fix: docker login
alexeyqu Nov 7, 2025
c28d3dc
fix: use GITHUB_TOKEN
alexeyqu Nov 7, 2025
092485c
fix: image name
alexeyqu Nov 7, 2025
ad6b372
fix: db_metrics_reader_helper
alexeyqu Nov 7, 2025
27fadbd
fix: better persistence
alexeyqu Nov 7, 2025
f6a09b8
fix: param
alexeyqu Nov 7, 2025
a585159
fix: param
alexeyqu Nov 7, 2025
66dd483
fix: param
alexeyqu Nov 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/formatting_testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Formatting check on pull requests

on:
pull_request:
branches:
- dev

jobs:
pre_commit:
runs-on: ubuntu-latest
environment:
name: testing

steps:
- name: checkout repository
uses: actions/checkout@v2

- name: set up Python
uses: actions/setup-python@v2

- name: install pre-commit
run: python -m pip install pre-commit
shell: bash

- name: pip freeze
run: python -m pip freeze --local
shell: bash

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44

- name: run pre-commit
run: |
FILES="${{ steps.changed-files.outputs.all_changed_files }}"
if [ -n "$FILES" ]; then
echo "$FILES" | xargs pre-commit run --files
else
echo "No files to check."
fi
shell: bash
26 changes: 21 additions & 5 deletions .github/workflows/publish_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
# Publish `master` as Docker `prod` image.
branches:
- master

workflow_dispatch:

env:
IMAGE_NAME: wachterbot
Expand Down Expand Up @@ -61,24 +63,38 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE_NAME: ${{ env.IMAGE_NAME }}
ROOT_DIR: /home/${{ secrets.DO_USER }}/${{ env.PACKAGE_LABEL }}
POSTGRES_URL: ${{ secrets.POSTGRES_URL }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
DATABASE_USER: ${{ secrets.DATABASE_USER }}
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
PERSISTENCE_DATABASE_URL: ${{ secrets.PERSISTENCE_DATABASE_URL }}
PERSISTENCE_DATABASE_USER: ${{ secrets.PERSISTENCE_DATABASE_USER }}
PERSISTENCE_DATABASE_PASSWORD: ${{ secrets.PERSISTENCE_DATABASE_PASSWORD }}
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
UPTRACE_DSN: ${{ secrets.UPTRACE_DSN }}
TELEGRAM_ERROR_CHAT_ID: ${{ secrets.TELEGRAM_ERROR_CHAT_ID }}
TEAM_TELEGRAM_IDS: ${{ secrets.TEAM_TELEGRAM_IDS }}
with:
host: ${{ secrets.DO_HOST }}
username: ${{ secrets.DO_USER }}
passphrase: ${{ secrets.DO_SSH_KEY_PASSWORD }}
key: ${{ secrets.DO_SSH_KEY }}
port: ${{ secrets.DO_PORT }}
envs: GITHUB_USERNAME, GITHUB_TOKEN, ROOT_DIR, POSTGRES_URL, TELEGRAM_TOKEN
envs: GITHUB_USERNAME, GITHUB_TOKEN, ROOT_DIR, DATABASE_URL, PERSISTENCE_DATABASE_URL, TELEGRAM_TOKEN, TEAM_TELEGRAM_IDS, UPTRACE_DSN, DATABASE_USER, DATABASE_PASSWORD, PERSISTENCE_DATABASE_USER, PERSISTENCE_DATABASE_PASSWORD
script: |
export CR_PAT=${{ secrets.GH_PAT_READ_PACKAGE }}
echo $CR_PAT | docker login ghcr.io -u $GITHUB_USERNAME
echo "$GITHUB_TOKEN" | docker login ghcr.io -u "$GITHUB_USERNAME" --password-stdin || exit 1
cd ${{ env.ROOT_DIR }}
touch .env
echo POSTGRES_URL=${{ env.POSTGRES_URL }} >> .env
echo DATABASE_URL=${{ env.DATABASE_URL }} >> .env
echo DATABASE_USER=${{ env.DATABASE_USER }} >> .env
echo DATABASE_PASSWORD=${{ env.DATABASE_PASSWORD }} >> .env
echo PERSISTENCE_DATABASE_URL=${{ env.PERSISTENCE_DATABASE_URL }} >> .env
echo PERSISTENCE_DATABASE_USER=${{ env.PERSISTENCE_DATABASE_USER }} >> .env
echo PERSISTENCE_DATABASE_PASSWORD=${{ env.PERSISTENCE_DATABASE_PASSWORD }} >> .env
echo TELEGRAM_TOKEN=${{ env.TELEGRAM_TOKEN }} >> .env
echo UPTRACE_DSN=${{ env.UPTRACE_DSN }} >> .env
echo TELEGRAM_ERROR_CHAT_ID=${{ env.TELEGRAM_ERROR_CHAT_ID }} >> .env
echo DEBUG=False >> .env
echo TEAM_TELEGRAM_IDS=${{ env.TEAM_TELEGRAM_IDS }} >> .env
docker-compose -f docker-compose.${{ env.PACKAGE_LABEL }}.yml stop
docker-compose -f docker-compose.${{ env.PACKAGE_LABEL }}.yml pull
docker-compose -f docker-compose.${{ env.PACKAGE_LABEL }}.yml up --force-recreate -d
Expand Down
26 changes: 21 additions & 5 deletions .github/workflows/publish_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
branches:
- dev

workflow_dispatch:

env:
IMAGE_NAME: wachterbot
GITHUB_USERNAME: alexeyqu
Expand Down Expand Up @@ -61,24 +63,38 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE_NAME: ${{ env.IMAGE_NAME }}
ROOT_DIR: /home/${{ secrets.DO_USER }}/${{ env.PACKAGE_LABEL }}
POSTGRES_URL: ${{ secrets.POSTGRES_URL }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
DATABASE_USER: ${{ secrets.DATABASE_USER }}
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
PERSISTENCE_DATABASE_URL: ${{ secrets.PERSISTENCE_DATABASE_URL }}
PERSISTENCE_DATABASE_USER: ${{ secrets.PERSISTENCE_DATABASE_USER }}
PERSISTENCE_DATABASE_PASSWORD: ${{ secrets.PERSISTENCE_DATABASE_PASSWORD }}
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
TELEGRAM_ERROR_CHAT_ID: ${{ secrets.TELEGRAM_ERROR_CHAT_ID }}
TEAM_TELEGRAM_IDS: ${{ secrets.TEAM_TELEGRAM_IDS }}
UPTRACE_DSN: ${{ secrets.UPTRACE_DSN }}
with:
host: ${{ secrets.DO_HOST }}
username: ${{ secrets.DO_USER }}
passphrase: ${{ secrets.DO_SSH_KEY_PASSWORD }}
key: ${{ secrets.DO_SSH_KEY }}
port: ${{ secrets.DO_PORT }}
envs: GITHUB_USERNAME, GITHUB_TOKEN, ROOT_DIR, POSTGRES_URL, TELEGRAM_TOKEN
envs: GITHUB_USERNAME, GITHUB_TOKEN, ROOT_DIR, DATABASE_URL, PERSISTENCE_DATABASE_URL, TELEGRAM_TOKEN, TEAM_TELEGRAM_IDS, UPTRACE_DSN, DATABASE_USER, DATABASE_PASSWORD, PERSISTENCE_DATABASE_USER, PERSISTENCE_DATABASE_PASSWORD
script: |
export CR_PAT=${{ secrets.GH_PAT_READ_PACKAGE }}
echo $CR_PAT | docker login ghcr.io -u $GITHUB_USERNAME
echo "$GITHUB_TOKEN" | docker login ghcr.io -u "$GITHUB_USERNAME" --password-stdin || exit 1
cd ${{ env.ROOT_DIR }}
touch .env
echo POSTGRES_URL=${{ env.POSTGRES_URL }} >> .env
echo DATABASE_URL=${{ env.DATABASE_URL }} >> .env
echo DATABASE_USER=${{ env.DATABASE_USER }} >> .env
echo DATABASE_PASSWORD=${{ env.DATABASE_PASSWORD }} >> .env
echo PERSISTENCE_DATABASE_URL=${{ env.PERSISTENCE_DATABASE_URL }} >> .env
echo PERSISTENCE_DATABASE_USER=${{ env.PERSISTENCE_DATABASE_USER }} >> .env
echo PERSISTENCE_DATABASE_PASSWORD=${{ env.PERSISTENCE_DATABASE_PASSWORD }} >> .env
echo TELEGRAM_TOKEN=${{ env.TELEGRAM_TOKEN }} >> .env
echo TELEGRAM_ERROR_CHAT_ID=${{ env.TELEGRAM_ERROR_CHAT_ID }} >> .env
echo UPTRACE_DSN=${{ env.UPTRACE_DSN }} >> .env
echo DEBUG=False >> .env
echo TEAM_TELEGRAM_IDS=${{ env.TEAM_TELEGRAM_IDS }} >> .env
docker-compose -f docker-compose.${{ env.PACKAGE_LABEL }}.yml stop
docker-compose -f docker-compose.${{ env.PACKAGE_LABEL }}.yml pull
docker-compose -f docker-compose.${{ env.PACKAGE_LABEL }}.yml up --force-recreate -d
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
pull_request:
branches:
- dev

jobs:
tests:
runs-on: ubuntu-latest

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

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9 # required by Pipfile

- name: Cache pipenv dependencies
uses: actions/cache@v2
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pipenv-

- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install pipenv
run: pip install pipenv

- name: Install dependencies
run: pipenv install

- name: Install pytest explicitly (failes without)
run: pipenv run pip install pytest

- name: Install asyncio (we doing it in Dockerfile)
run: pipenv run pip install 'httpcore[asyncio]'

- name: Run tests
run: pipenv run python -m pytest ./test -x -s
shell: bash
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ __pycache__/
.DS_Store
.vscode
data/
persistent_storage.pickle
11 changes: 3 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:

- repo: local
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
name: black
entry: bash -c 'pipenv run black $@' --
language: system
types: [python]
args: []
exclude: ^(.+)/migrations/.*\.py


7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ RUN pip install "setuptools<46" && pip install pipenv
COPY Pipfile /Pipfile
COPY Pipfile.lock /Pipfile.lock

RUN pipenv install --system
RUN pip install "httpcore[asyncio]"

RUN pipenv install --deploy --system

COPY . /app
WORKDIR /app

CMD alembic upgrade head && python -m app
RUN ["chmod", "+x", "/app/entrypoint.sh"]
ENTRYPOINT ["/app/entrypoint.sh"]
20 changes: 16 additions & 4 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,29 @@ verify_ssl = true
name = "pypi"

[packages]
"psycopg2-binary" = "*"
python-telegram-bot = {version = "~=13.11"}
sqlalchemy = "*"
alembic = "*"
pre-commit = "*"
pylint = "*"
black = "*"
pyTelegramLogger = "*"
python-telegram-handler = "*"
pytest = "*"
pytest-mock = "*"
httpcore = {extras = ["asyncio"], version = "*"}
asyncio = "*"
asyncpg = "*"
python-telegram-bot = {extras = ["job-queue"], version = "*"}
ptbcontrib = {extras = ["ptb_jobstores_sqlalchemy"], git = "git+https://github.com/python-telegram-bot/ptbcontrib.git@main"}
"psycopg2-binary" = "*" # need for ptb_jobstores_sqlalchemy
pytest-asyncio = "*"
aiosqlite = "*"
grpcio = "*"
opentelemetry-sdk = "*"
opentelemetry-exporter-otlp = "*"
opentelemetry-api = "*"

[dev-packages]
"autopep8" = "*"

[requires]
python_version = "3.9"
python_version = "3.9"
Loading