name: Build and Test Flask App on: push: branches: [ main, master ] pull_request: branches: [ main, master ] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python via apt run: | apt update apt install -y python3 python3-pip python3-venv python3-dev python3-full - name: Create and activate virtual environment run: | python3 -m venv venv . venv/bin/activate pip install --upgrade pip echo "VIRTUAL_ENV=$PWD/venv" >> $GITHUB_ENV echo "$PWD/venv/bin" >> $GITHUB_PATH - name: Install dependencies run: | if [ -f dependencies.txt ]; then pip install --no-cache-dir -r dependencies.txt else echo "dependencies.txt not found, installing Flask only" pip install flask fi pip list - name: Debug build - check imports run: | export FLASK_APP=app.py export FLASK_ENV=development flask run --host 0.0.0.0 --debug & - name: Install release dependencies run: | pip install gunicorn - name: Release build (simulated) run: | gunicorn --check-config app:app