Skip to content

Initial setup workflow updated #3

Initial setup workflow updated

Initial setup workflow updated #3

name: Test Initial Setup with Full Logging
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
initial_setup:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- name: Check out repository
uses: actions/checkout@v2
# Step 2: Set up Python
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
# Step 3: Create and activate virtual environment
- name: Create and activate virtual environment
run: |
set -e
set -x
python -m venv venv
source venv/bin/activate
echo "Virtual environment activated."
# Step 4: Install Python dependencies
- name: Install Python dependencies
run: |
set -e
set -x
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
# Step 5: Set up environment variables
- name: Set up .env file
run: |
set -e
set -x
cp .env.template .env
PROJECT_ROOT=$(pwd)
sed -i "s|/path/to/your/project/root|$PROJECT_ROOT|g" .env
# Step 6: Configure database in config.yaml
- name: Configure database to use BASE database
run: |
set -e
set -x
sed -i 's|path: "data/NBA_AI_2023_2024.sqlite"|path: "data/NBA_AI_BASE.sqlite"|g' config.yaml
# Step 7: Start the application and log output to a file
- name: Start the application and capture output
run: |
set -e
set -x
source venv/bin/activate
# Start the app and redirect both stdout and stderr to app.log
python start_app.py > app.log 2>&1 &
APP_PID=$!
sleep 5 # Allow some time for the app to initialize
# Step 8: Access the web page to trigger data loading and log output
- name: Trigger data loading
run: |
set -e
set -x
# Access the main page to trigger data loading and logging
curl --fail http://127.0.0.1:5000
# Step 9: Display the captured application log to see full output
- name: Show application log output
run: |
echo "Displaying application log output:"
cat app.log
# Step 10: Stop the application
- name: Stop the application
run: kill $APP_PID