diff --git a/.github/workflows/python-app.yml b/.github/workflows/service-test.yml similarity index 71% rename from .github/workflows/python-app.yml rename to .github/workflows/service-test.yml index a80fc87..607afe6 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/service-test.yml @@ -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: @@ -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 @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index cc47923..f73f05a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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} diff --git a/utils/conv.py b/utils/conv.py index 3e445a0..f838196 100644 --- a/utils/conv.py +++ b/utils/conv.py @@ -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." @@ -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, "