Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Courageous Comets #3

Open
wants to merge 169 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
6812c62
Initial commit
thijsfranck Jul 15, 2024
60e0397
chore: initial commit
thijsfranck Jul 15, 2024
7998a79
ci: ensure actions use bash
thijsfranck Jul 15, 2024
b761ecc
bump: version 0.0.0 → 0.0.1
thijsfranck Jul 15, 2024
b8cb2b1
docs: add logo and favicon (#1)
thijsfranck Jul 16, 2024
e1270fd
ci: set up secrets management to support development token (#2)
thijsfranck Jul 16, 2024
7d68bd1
bump: version 0.0.1 → 0.0.2
thijsfranck Jul 16, 2024
105fedd
docs: update installation instructions for sop on linux (#3)
elfkuzco Jul 16, 2024
099cab8
docs: add video installation guide
thijsfranck Jul 16, 2024
150df91
docs: embed video controls as html elements
thijsfranck Jul 16, 2024
07b749f
bump: version 0.0.2 → 0.0.3
thijsfranck Jul 16, 2024
16514ef
docs: restructure setup guide
thijsfranck Jul 16, 2024
8886bea
bump: version 0.0.3 → 0.0.4
thijsfranck Jul 16, 2024
db63bb8
ci: switch to age for better secrets management (#4)
thijsfranck Jul 17, 2024
c68cea5
bump: version 0.0.4 → 0.0.5
thijsfranck Jul 17, 2024
1608132
chore: add key to ACL
thijsfranck Jul 17, 2024
7ac17a3
ci: set up docker build (#9)
thijsfranck Jul 18, 2024
b21efe5
ci: add redis to devcontainer (#7)
thijsfranck Jul 18, 2024
9cfcdf5
ci: Add age key to .sops.yaml and re-encrypt .env
isaa-ctaylor Jul 18, 2024
af36cd2
ci: add docker image metadata
thijsfranck Jul 19, 2024
db8fb43
docs: add admin guide and installation link on home page
thijsfranck Jul 19, 2024
f22079f
bump: version 0.0.5 → 0.0.6
thijsfranck Jul 19, 2024
3ce32a7
Set up global redis connection (#13)
elfkuzco Jul 19, 2024
f6ceb5b
fix: set redis host from environment variables
thijsfranck Jul 19, 2024
28f19ac
refactor: improve error handling and logging
thijsfranck Jul 19, 2024
ee92d70
docs: describe configuration options
thijsfranck Jul 19, 2024
3963ce5
feat: add bot boilerplate
isaa-ctaylor Jul 19, 2024
c3808b6
fix: include application config in docker image (#15)
thijsfranck Jul 19, 2024
3b47542
docs: describe new config options
thijsfranck Jul 20, 2024
32ebf9e
ci: fix redis password config
thijsfranck Jul 20, 2024
f799dad
fix: improved error handling and settings validation
thijsfranck Jul 20, 2024
c25b36f
bump: version 0.0.6 → 0.1.0
thijsfranck Jul 20, 2024
493108a
refactor: improve type hints
thijsfranck Jul 20, 2024
19111cd
test: add unit tests for core app handlers
thijsfranck Jul 20, 2024
0e2af06
ci: make discord token available during testing
thijsfranck Jul 20, 2024
910796c
test: fix warning caused by test
thijsfranck Jul 20, 2024
d2f9265
test: fix warning caused by test
thijsfranck Jul 20, 2024
7491fb6
test: assert awaited rather than called
thijsfranck Jul 20, 2024
5602f15
test: simplify setup, add missing checks, update docstrings
thijsfranck Jul 20, 2024
dbb23d0
feat: download nltk resources on startup (#22)
thijsfranck Jul 20, 2024
fe67b13
feat: add api to store word frequency on redis (#23)
elfkuzco Jul 20, 2024
13ed85b
feat: add sentiment analysis (#24)
thijsfranck Jul 20, 2024
ed4efd2
fix: add logging and remove return section from docstring
thijsfranck Jul 20, 2024
001977c
refactor: update docstrings
thijsfranck Jul 20, 2024
d246157
docs: update NLTK_DATA description
thijsfranck Jul 20, 2024
dd874ec
ci: set environment variables
thijsfranck Jul 20, 2024
24715aa
feat: use pydantic to model Redis hashes (#25)
elfkuzco Jul 20, 2024
6b3a3ac
refactor: improve docs, types and fix some linter issues
thijsfranck Jul 21, 2024
dbfe606
fix: control max number of concurrent downloads
thijsfranck Jul 21, 2024
f242b60
fix: handle contractions in tokenizer (#26)
thijsfranck Jul 21, 2024
4186e2c
refactor: move startup logic into bot class (#27)
thijsfranck Jul 21, 2024
f4d70da
feat: setup transformer models (#28)
thijsfranck Jul 21, 2024
eed1ee5
bump: version 0.1.0 → 0.2.0
thijsfranck Jul 21, 2024
61ec725
docs: link changelog in navigation
thijsfranck Jul 21, 2024
5b1a4cb
refactor: remove throws clause from docstring
thijsfranck Jul 21, 2024
9cb6bff
fix: suppress warnings from libraries
thijsfranck Jul 21, 2024
32ce1e7
fix: ensure consistent log output (#29)
thijsfranck Jul 21, 2024
c8cc570
feat: return messages based on similarity score (#30)
elfkuzco Jul 21, 2024
c133fb7
test: move tests into separate folder and add integration test exampl…
thijsfranck Jul 22, 2024
f48649f
feat: add messages cog (#32)
thijsfranck Jul 22, 2024
c64406e
fix: save messages with message_id on redis (#33)
elfkuzco Jul 22, 2024
afde5e2
refactor: include save_message in Messages cog (#34)
isaa-ctaylor Jul 22, 2024
17c8410
refactor: remove hfvectorizer (#35)
elfkuzco Jul 22, 2024
0cfd27b
feat: replace sentence_transformers with transformers library (#36)
elfkuzco Jul 22, 2024
9493bf5
fix: fix sync command signature and internal logic (#38)
isaa-ctaylor Jul 22, 2024
c488b62
feat: set up message content preprocessing (#40)
thijsfranck Jul 22, 2024
44762af
feat: store sentiment analysis with message data (#39)
elfkuzco Jul 22, 2024
4e2e196
bump: version 0.2.0 → 0.3.0
thijsfranck Jul 22, 2024
b2a0f1f
feat: revert back to hash data type for storing messages (#41)
elfkuzco Jul 23, 2024
33bfc54
fix: preprocessing drops extra whitespace
thijsfranck Jul 23, 2024
2a2124a
fix: trucate uses correct length
thijsfranck Jul 23, 2024
be087b9
docs: describe preprocessing options
thijsfranck Jul 23, 2024
8c3ae33
fix: open app config in read mode
thijsfranck Jul 23, 2024
2f003a3
bump: version 0.3.0 → 0.4.0
thijsfranck Jul 23, 2024
cd2b416
feat: add docker compose and fix production dockerfile
thijsfranck Jul 23, 2024
4b0587c
bump: version 0.4.0 → 0.5.0
thijsfranck Jul 23, 2024
3dd7ca2
docs: fix broken link
thijsfranck Jul 23, 2024
b7fddda
docs: improve phrasing around discord token setup
thijsfranck Jul 23, 2024
936fa95
docs: simplify discord token setup description
thijsfranck Jul 23, 2024
866f1aa
docs: extend application.yaml docs
thijsfranck Jul 23, 2024
62627af
docs: simplify deployment checklist
thijsfranck Jul 23, 2024
0a50417
feat: store sentiment results along with message (#42)
elfkuzco Jul 23, 2024
cde7628
feat: limit queries to most recent messsages (#43)
elfkuzco Jul 24, 2024
3168e95
refactor: simplify function signatures and make it easier to build sc…
thijsfranck Jul 24, 2024
d7caa80
feat: store message tokens (#45)
elfkuzco Jul 24, 2024
90432ed
docs: add architecture and design page
thijsfranck Jul 24, 2024
c581c71
bump: version 0.5.0 → 0.6.0
thijsfranck Jul 24, 2024
55e412d
feat: add development mode (#46)
thijs-franck Jul 24, 2024
f92f4c9
feat: allow redis search filtering across multiple ids (#47)
elfkuzco Jul 24, 2024
aad9546
feat: calculate count of tokens across messages (#48)
elfkuzco Jul 24, 2024
0a858f3
feat: get message rate by duration (#49)
elfkuzco Jul 25, 2024
d714d67
fix: add __version__ and log version on startup
thijsfranck Jul 25, 2024
7c5ce5f
fix: handle PackageNotFoundError
thijsfranck Jul 25, 2024
cd04d60
Add user interactions (#51)
thijsfranck Jul 25, 2024
4aac780
feat: add drop_code_blocks processor
thijsfranck Jul 25, 2024
cdf1244
feat: add cog that returns information about the app (#50)
thijsfranck Jul 25, 2024
8b1e3f4
fix: remove reference to link from general bot description and add it…
thijsfranck Jul 26, 2024
9e529fc
feat: add sentiment chart (#52)
thijsfranck Jul 26, 2024
0238f65
feat: set up frequency cog (#53)
elfkuzco Jul 26, 2024
8533d73
feat: add user sentiment interaction (#54)
thijsfranck Jul 26, 2024
748f0c7
docs: describe data model and add product pitch on homepage (#55)
thijsfranck Jul 26, 2024
13ef047
bump: version 0.6.0 → 0.7.0
thijsfranck Jul 26, 2024
fb06d02
docs: move installation section up
thijsfranck Jul 26, 2024
e47a754
build: set matplotlib config directory in docker image
thijsfranck Jul 26, 2024
75ce9dc
feat: plot message frequency graph
elfkuzco Jul 26, 2024
fe18c2a
fix: remove unused context menu loader
isaa-ctaylor Jul 26, 2024
5e601a8
Add user interactions (#57)
isaa-ctaylor Jul 26, 2024
6aab1cb
fix: remove cog from erroneous merge conflict resolution (#58)
isaa-ctaylor Jul 27, 2024
4404a78
fix: silence KeyboardInterrupt on application shutdown (#59)
isaa-ctaylor Jul 27, 2024
a9f349b
fix: add exists check
thijsfranck Jul 27, 2024
d4d28b4
fix: restore user sentiment interaction
thijsfranck Jul 27, 2024
778d0d9
fix: handle missing sentiment data
thijsfranck Jul 27, 2024
c5c6571
fix: update app description and set embed footer
thijsfranck Jul 27, 2024
6d533e2
fix: reference current version in documentation
thijsfranck Jul 27, 2024
501cb28
bump: version 0.7.0 → 0.8.0
thijsfranck Jul 27, 2024
aafcde3
ci: exclude .sh files from docs build
thijsfranck Jul 27, 2024
ca9f3a3
feat: refactor cogs with ui components and complete existing interact…
thijsfranck Jul 27, 2024
7aa6e76
test: fix broken test
thijsfranck Jul 27, 2024
0ab3a8f
fix: avoid error when no sentiment data is available for a user
thijsfranck Jul 27, 2024
0f1805b
refactor: move message processing to a separate module
thijsfranck Jul 27, 2024
84e7a42
fix: show channel in search results
thijsfranck Jul 27, 2024
a535693
fix: increase search results max preview length
thijsfranck Jul 27, 2024
d8df2d8
feat: add details to frequency embed
thijsfranck Jul 27, 2024
d57edff
feat: harmonize sentiment embeds
thijsfranck Jul 27, 2024
83a9009
refactor: remove unused component
thijsfranck Jul 27, 2024
bdab551
style: add spacing between blocks of code
thijsfranck Jul 27, 2024
dd13726
feat: add praise interaction for user and message sentiment
thijsfranck Jul 27, 2024
48935f4
refactor: remove redundant code
thijsfranck Jul 27, 2024
10f5750
bump: version 0.8.0 → 0.9.0
thijsfranck Jul 28, 2024
d26c9b1
fix: improve logging for all interactions
thijsfranck Jul 28, 2024
dd9bd77
refactor: split up keywords and sentiment cogs, improve cog documenta…
thijsfranck Jul 28, 2024
0eca4c7
refactor: remove redundant decorator
thijsfranck Jul 28, 2024
4b2d39d
refactor: remove redundant error class
thijsfranck Jul 28, 2024
7eb7810
refactor: simplify messages cog
thijsfranck Jul 28, 2024
692a875
refactor: log database event as error
thijsfranck Jul 28, 2024
713bef0
refactor: log message processed as debug event
thijsfranck Jul 28, 2024
0505184
feat: add user keyword frequency (#60)
thijsfranck Jul 28, 2024
c4cd846
fix: ensure consistent styling on embed titles
thijsfranck Jul 28, 2024
8404385
fix: capitalize embed title
thijsfranck Jul 28, 2024
9747325
feat: add topics command that lists the most used keywords (#61)
thijsfranck Jul 28, 2024
7a5fd4d
feat: frequency time divisions (#62)
elfkuzco Jul 28, 2024
4619536
bump: version 0.9.0 → 0.10.0
thijsfranck Jul 28, 2024
8e1ec12
feat: lock dependencies for final version
thijsfranck Jul 28, 2024
7ab7ff6
bump: version 0.10.0 → 1.0.0
thijsfranck Jul 28, 2024
2e5637c
build: downgrade torch and lock to patch version
thijsfranck Jul 28, 2024
ce641cc
docs: extend technical documentation and start adding use cases
thijsfranck Jul 29, 2024
ddc1b4b
docs: fix page heading
thijsfranck Jul 29, 2024
260692b
docs: reword storage section (#63)
elfkuzco Jul 29, 2024
bbfa49a
ci: add prettier as default markdown formatter
thijsfranck Jul 29, 2024
0d0bd48
docs: add getting started guide and format markdown documents with pr…
thijsfranck Jul 29, 2024
4febb96
docs: improve phrasing
thijsfranck Jul 29, 2024
94596fe
docs: emphasize context menu features for search
thijsfranck Jul 29, 2024
87d3982
docs: remove space after query
thijsfranck Jul 29, 2024
c3483c8
docs: reorganize home page using cards
thijsfranck Jul 30, 2024
10ebc5e
docs: adjust introduction
thijsfranck Jul 30, 2024
4ef2229
docs: update user guide screenshots
thijsfranck Jul 30, 2024
22ad607
docs: extend configuration guide
thijsfranck Jul 30, 2024
668e62e
docs: extend design documentation
thijsfranck Jul 30, 2024
45da31f
docs: clarify choice for redis stack
thijsfranck Jul 30, 2024
47a6130
docs: improve phrasing
thijsfranck Jul 30, 2024
a4bd762
docs: capitalize headings
thijsfranck Jul 30, 2024
5582403
docs: reword redis data design decisions (#65)
elfkuzco Jul 30, 2024
a95fa54
docs: improve introduction of moderation features
thijsfranck Jul 31, 2024
b3cb07f
docs: add design notes for analysis steps
thijsfranck Jul 31, 2024
e005026
docs: break up sentiment analysis scores paragraph
thijsfranck Jul 31, 2024
91ad828
docs: clarify sentiment scoring method
thijsfranck Jul 31, 2024
86e4939
docs: reword vectorization operation (#66)
elfkuzco Jul 31, 2024
a567d6e
docs: fix typo
thijsfranck Jul 31, 2024
963da1c
Add 'courageous-comets/' from commit 'a567d6e78c6fc624fbbd79300191347…
janine9vn Aug 13, 2024
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
1 change: 1 addition & 0 deletions courageous-comets/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM mcr.microsoft.com/vscode/devcontainers/base:debian
85 changes: 85 additions & 0 deletions courageous-comets/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"containerEnv": {
"BOT_CONFIG_PATH": "${containerWorkspaceFolder}/application.yaml",
"ENVIRONMENT": "development",
"HF_HOME": "${containerWorkspaceFolder}/hf_data",
"NLTK_DATA": "${containerWorkspaceFolder}/nltk_data",
"POETRY_VIRTUALENVS_CREATE": "false",
"REDIS_HOST": "localhost",
"REDIS_PASSWORD": "redis",
"REDIS_PORT": "6379",
"SOPS_AGE_KEY_FILE": "${containerWorkspaceFolder}/secrets/keys.txt"
},
"customizations": {
"vscode": {
"extensions": [
"charliermarsh.ruff",
"DavidAnson.vscode-markdownlint",
"KnisterPeter.vscode-commitizen",
"tamasfe.even-better-toml",
"-ms-python.autopep8",
"esbenp.prettier-vscode"
],
"settings": {
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
},
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
"files.exclude": {
"**/.pytest_cache": true,
"**/.ruff_cache": true,
"**/__pycache__": true
},
"files.insertFinalNewline": true,
"python.analysis.typeCheckingMode": "basic",
"python.testing.pytestArgs": [
"."
],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false
}
}
},
"dockerComposeFile": "docker-compose.yaml",
"features": {
"ghcr.io/devcontainers-contrib/features/act:1": {},
"ghcr.io/devcontainers-contrib/features/apt-packages": {
"packages": "age"
},
"ghcr.io/devcontainers-contrib/features/poetry:2": {},
"ghcr.io/devcontainers-contrib/features/sops:1": {},
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
"ghcr.io/devcontainers/features/python:1": {
"installTools": false,
"version": "3.12"
}
},
"forwardPorts": [
6379,
8000,
8001
],
"name": "Courageous Comets \u2604\ufe0f",
"portsAttributes": {
"6379": {
"label": "Redis",
"onAutoForward": "silent"
},
"8000": {
"label": "MkDocs",
"onAutoForward": "notify"
},
"8001": {
"label": "RedisInsight",
"onAutoForward": "silent"
}
},
"postCreateCommand": "bash .devcontainer/postcreate.sh",
"service": "dev",
"updateContentCommand": "bash .devcontainer/updatecontent.sh",
"workspaceFolder": "/workspace"
}
24 changes: 24 additions & 0 deletions courageous-comets/.devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
services:

# This is the development container
dev:
build:
context: .
dockerfile: Dockerfile
cache_from:
- ghcr.io/thijsfranck/courageous-comets-devcontainer
volumes:
- ..:/workspace
command: 'sleep infinity'

redis-stack:
image: redis/redis-stack:7.2.0-v11
environment:
REDIS_ARGS: "--requirepass redis"
volumes:
- redis-stack-data:/data
network_mode: service:dev
restart: unless-stopped

volumes:
redis-stack-data:
15 changes: 15 additions & 0 deletions courageous-comets/.devcontainer/postcreate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Mark the git repository as safe
git config --global --add safe.directory $PWD

# Install pre-commit hooks
poetry run pre-commit install

# Generate a new secret key if one doesn't exist
if [ ! -f secrets/keys.txt ]; then
echo
echo "Generating a new secret key. Share the following public key with the team:"
age-keygen -o secrets/keys.txt
echo
fi
4 changes: 4 additions & 0 deletions courageous-comets/.devcontainer/updatecontent.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# Install or update dependencies
poetry install
11 changes: 11 additions & 0 deletions courageous-comets/.env.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
DISCORD_TOKEN=ENC[AES256_GCM,data:3tRB8k5Yv1VmwJAhG5Bkxv7/ylRBv1eqrXbouZ7jQNUJp+ztXrFBeNUIvI7xoyKCUBaIE/PcCkchbU/Osq9JeB5nI1RKRHC8,iv:jTQ6lPD6jjJ3MWOKKqdkiXXXnGH+CuaxogQ9MtxzOUg=,tag:C6oAqZ9Xgw8B5juWjBR42A==,type:str]
sops_age__list_0__map_enc=-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBCckZmcmVaMkFwZFB6TWtI\nVGw3YjI1d3FmNUlORFlvQ0tmQmpmanIrOHd3Ckw1dlNBZ25uQTczdm96UTM4VDRU\nYUFKMEl1citaVDZGbWhnUE9kaHByMG8KLS0tIDdyTmlJL0IzL3UvSHI0czNLZFpo\nT3JHT21oZmtvTzhyMFJlMXZML1FwY2cKRYz8DUTACEa+Kft3J1i/iN+wJXVCZrCJ\n1rtpDOx9Ys8GmK54bRQih8k5O2S6u7Eps2zLRWOmMTSQj4d2ZCkO1A==\n-----END AGE ENCRYPTED FILE-----\n
sops_age__list_0__map_recipient=age1sgv2yduaugas4travt8tjctmxe0jyge5p0w6ufcfard5umwaxvss2na2ff
sops_age__list_1__map_enc=-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA5ZGNFNUNjaTNTQ0l5ekNI\nSjJUN1ZLWjdJYkx1UHpQbmhZMHFiOW1qNFFNCnZ4MkhPdWVxcThHUWE5c3FtOGxy\nVTdoeUJoQmtFZEhNSDhudzZib3RpUTQKLS0tIHI3TzdmYmNEZGhnRDRYaFVrTk9P\nWkhKWEhjWHZRVVBjN2FOZzFVUGR5Q1UKh/wkyRmeo4DLKk0yqVA0f1DfhOJpAPCw\nnrkvJ8trH19147od9tDlSQaZo8ipKK0nmijowU6rnS52FjU0hAQm0g==\n-----END AGE ENCRYPTED FILE-----\n
sops_age__list_1__map_recipient=age1lhk7gg022hrfn6z85m2qdmudm8vql4vn90fuyaulvw99fqv8yctq4uh39k
sops_age__list_2__map_enc=-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBFVEJCQ2xDWE1Ed21icXJy\nMDBSY1E5aW50R01YeDEzcTV3Y1c1eFZpQ2dRCm5xNjhGWTVXR2tPcDBzNnd3bldE\nZXhPSDVGNXM5ZkEvaDFLVU1iUFEvR1EKLS0tIERKSEVJZit0cXhzcEJUNUJlV0h3\nS3B5QlB3SFZIVHJLQUlYNHErTGxuT0EKFCsTjivBASb4wnsTjZwEzzM+YDVWtClp\n/+rRuwHrPSKDwce1PaxyqhuG4/UH7StEk/mCkCLnsUqJyTachVzJGQ==\n-----END AGE ENCRYPTED FILE-----\n
sops_age__list_2__map_recipient=age1u9a2890jjzd3qak5k9xnjngt4qjjvttwag2yjm9sctf6vuawpu2skzekyn
sops_lastmodified=2024-07-18T20:35:27Z
sops_mac=ENC[AES256_GCM,data:Y8e/+o6z3iDosEydIbz2dbPR160I5SqHTgxcQNHEgQqxPTd9MNxsg8Iz4sygTNlB5ByAFOPm6/EbrFreQ9/ChairtoLWEnyRBuBanFSpB0ZU8a6hLC4Y/0ZQ2YN53/OvuZjBfYaHEsrQxvRTTbY9sp1+6HzbUqMvmMKu6WKz2F4=,iv:jhiy7F8NMtfmv7fqqXNQyewHl4CJzCzEc2sgdNf715c=,tag:/KyvJ5oKtBUZXLNUPxfZpg==,type:str]
sops_unencrypted_suffix=_unencrypted
sops_version=3.9.0
32 changes: 32 additions & 0 deletions courageous-comets/.github/workflows/build-devcontainer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build Devcontainer

on:
push:
branches:
- main
paths:
- .devcontainer/**/*
- .github/workflows/build-devcontainer.yaml

permissions: write-all

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Log in to the Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pre-build devcontainer image
uses: devcontainers/ci@v0.3
with:
imageName: ghcr.io/thijsfranck/courageous-comets-devcontainer
cacheFrom: ghcr.io/thijsfranck/courageous-comets-devcontainer
push: always
68 changes: 68 additions & 0 deletions courageous-comets/.github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
ci:
runs-on: ubuntu-latest

services:
redis:
image: redis/redis-stack:7.2.0-v11
ports:
- 6379:6379
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5

env:
BOT_CONFIG_PATH: ${{ github.workspace }}/application.yaml
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
NLTK_DATA: ${{ github.workspace }}/nltk_data
HF_HOME: ${{ github.workspace }}/hf_data

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up caching for NLTK_DATA
uses: actions/cache@v4
with:
path: ${{ env.NLTK_DATA }}
key: ${{ runner.os }}-nltk-data-${{ hashFiles(env.BOT_CONFIG_PATH) }}
restore-keys: |
${{ runner.os }}-nltk-data-

- name: Set up caching for HF_HOME
uses: actions/cache@v4
with:
path: ${{ env.HF_HOME }}
key: ${{ runner.os }}-hf-data-${{ hashFiles(env.BOT_CONFIG_PATH) }}
restore-keys: |
${{ runner.os }}-hf-data-

- name: Setup Python, Poetry and dependencies
uses: packetcoders/action-setup-cache-python-poetry@main
with:
python-version: 3.12
poetry-version: 1.8.3

- name: Update GITHUB_PATH
run: echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
shell: bash

- name: Run pre-commit hooks
uses: pre-commit/action@v3.0.1

- name: Run tests
run: poetry run pytest
shell: bash
52 changes: 52 additions & 0 deletions courageous-comets/.github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish

on:
push:
tags:
- v*.*.*

permissions: write-all

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Log in to the Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Python, Poetry and Dependencies
uses: packetcoders/action-setup-cache-python-poetry@main
with:
python-version: 3.12
poetry-version: 1.8.3

- name: Build the Application
run: poetry build -f wheel
shell: bash

- name: Build and Publish the Docker Image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ghcr.io/thijsfranck/courageous-comets:${{ github.ref_name }},ghcr.io/thijsfranck/courageous-comets:latest

- name: Set up Git user
uses: fregante/setup-git-user@v2.0.1

- name: Build documentation
run: bash docs/replace-token.sh "<APP_VERSION>" "${{ github.ref_name }}"

- name: Publish documentation
run: poetry run mike deploy -b public-docs --push --update-aliases ${{ github.ref_name }} latest
shell: bash
Loading