Skip to content

Commit

Permalink
fix: add secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-ang committed Jan 9, 2025
1 parent f10e131 commit d0dc8e5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application
name: Service Test

on:
push:
Expand Down Expand Up @@ -36,25 +33,21 @@ jobs:
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Build Docker image
run: docker compose build

- name: Run service stability test
- name: Build and Test Service
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
TEST_TELEGRAM_TOKEN: ${{ secrets.TEST_TELEGRAM_TOKEN }}
FEEDBACK_CHANNEL_ID: ${{ secrets.FEEDBACK_CHANNEL_ID }}
MONGO_URL: ${{ secrets.MONGO_URL }}
GITHUB_URL: ${{ secrets.GITHUB_URL }}
REPO_URL: ${{ vars.REPO_URL }}
run: |
# Start service
docker compose build
docker compose up -d
# Monitor for 1 minute
START_TIME=$(date +%s)
END_TIME=$((START_TIME + 60))
while [ $(date +%s) -lt $END_TIME ]; do
# Check if container is still running
if ! docker ps | grep -q terrier-alert; then
echo "Service crashed!"
docker compose logs
Expand All @@ -63,6 +56,5 @@ jobs:
sleep 5
done
# If we get here, service ran for 1 minute successfully
echo "Service ran stable for 1 minute"
docker compose down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ services:
- TEST_TELEGRAM_TOKEN=${TEST_TELEGRAM_TOKEN}
- FEEDBACK_CHANNEL_ID=${FEEDBACK_CHANNEL_ID}
- MONGO_URL=${MONGO_URL}
- GITHUB_URL=${GITHUB_URL}
- REPO_URL=${REPO_URL}
4 changes: 2 additions & 2 deletions utils/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

load_dotenv()

GITHUB_URL = os.getenv("GITHUB_URL")
REPO_URL = os.getenv("REPO_URL")
WELCOME_TEXT = (
f"Welcome to Terrier Alert {Course.get_sem_year()}!\n"
"Use the Menu button to get started."
Expand Down Expand Up @@ -43,7 +43,7 @@
ABOUT_MD = (
"Terrier Alert is built with "
"*python\-telegram\-bot*, *PyMongo*, and is hosted on *Render*\. "
f"Check out the code [here]({GITHUB_URL})\."
f"Check out the code [here]({REPO_URL})\."
)
UNKNOWN_CMD_TEXT = (
"Sorry, I didn't understand that command. If you are currently in a subscription conversation, "
Expand Down

0 comments on commit d0dc8e5

Please sign in to comment.