[SECURITY] Production security logging with correlation IDs and audit trail - closes #55 #68
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Code Release & Distribution | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| types: [closed] | |
| branches: [ main ] | |
| workflow_dispatch: # Allow manual triggering for testing | |
| inputs: | |
| version: | |
| description: 'Version to release' | |
| required: false | |
| default: 'auto' | |
| env: | |
| PYTHON_VERSION: '3.11' | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| create-release-artifact: | |
| name: Build Release Artifact | |
| runs-on: ubuntu-latest | |
| if: github.event.pull_request.merged == true || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Full history for proper versioning | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine setuptools wheel | |
| # Install project dependencies | |
| if [ -f app/requirements.txt ]; then | |
| pip install -r app/requirements.txt | |
| elif [ -f requirements.txt ]; then | |
| pip install -r requirements.txt | |
| fi | |
| - name: Generate version number | |
| id: version | |
| run: | | |
| # Get current date for version | |
| DATE=$(date +'%Y%m%d') | |
| # Get commit short hash | |
| COMMIT=$(git rev-parse --short HEAD) | |
| # Generate version | |
| if [[ $GITHUB_REF == refs/tags/* ]]; then | |
| VERSION=${GITHUB_REF#refs/tags/} | |
| PYTHON_VERSION=${VERSION#v} # Remove 'v' prefix for Python packaging | |
| else | |
| VERSION="v$(date +'%Y.%m.%d')-${COMMIT}" | |
| # Create PEP 440 compatible version for Python packaging | |
| PYTHON_VERSION="$(date +'%Y.%m.%d')+${COMMIT}" | |
| fi | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| echo "PYTHON_VERSION=$PYTHON_VERSION" >> $GITHUB_OUTPUT | |
| echo "DATE=$DATE" >> $GITHUB_OUTPUT | |
| echo "COMMIT=$COMMIT" >> $GITHUB_OUTPUT | |
| echo "Generated version: $VERSION" | |
| echo "Python version: $PYTHON_VERSION" | |
| - name: Create release directory structure | |
| run: | | |
| mkdir -p release-build/PowerTrader_AI_Desktop | |
| # Copy application files | |
| cp -r app/* release-build/PowerTrader_AI_Desktop/ | |
| # Copy essential project files | |
| cp README.md release-build/PowerTrader_AI_Desktop/ | |
| cp LICENSE release-build/PowerTrader_AI_Desktop/ | |
| # Copy documentation | |
| mkdir -p release-build/PowerTrader_AI_Desktop/docs | |
| cp -r docs/* release-build/PowerTrader_AI_Desktop/docs/ | |
| # Create installation script for Windows | |
| cat > release-build/PowerTrader_AI_Desktop/install.bat << 'EOF' | |
| @echo off | |
| echo PowerTraderAI+ Desktop Installation | |
| echo ==================================== | |
| echo. | |
| echo Installing Python dependencies... | |
| pip install -r requirements.txt | |
| echo. | |
| echo Installation complete! | |
| echo. | |
| echo To run PowerTraderAI+: | |
| echo python pt_desktop_app.py | |
| echo. | |
| pause | |
| EOF | |
| # Create installation script for Linux/Mac | |
| cat > release-build/PowerTrader_AI_Desktop/install.sh << 'EOF' | |
| #!/bin/bash | |
| echo "PowerTraderAI+ Desktop Installation" | |
| echo "====================================" | |
| echo "" | |
| echo "Installing Python dependencies..." | |
| pip install -r requirements.txt | |
| echo "" | |
| echo "Installation complete!" | |
| echo "" | |
| echo "To run PowerTraderAI+:" | |
| echo " python pt_desktop_app.py" | |
| EOF | |
| chmod +x release-build/PowerTrader_AI_Desktop/install.sh | |
| # Create startup script | |
| cat > release-build/PowerTrader_AI_Desktop/start.py << 'EOF' | |
| #!/usr/bin/env python3 | |
| """ | |
| PowerTraderAI+ Desktop Startup Script | |
| Simple launcher for the PowerTraderAI+ application | |
| """ | |
| import sys | |
| import os | |
| try: | |
| # Import and run the desktop application | |
| import pt_desktop_app | |
| print("PowerTraderAI+ started successfully") | |
| except ImportError as e: | |
| print(f"Error importing PowerTraderAI+: {e}") | |
| print("Please run the installation script first:") | |
| print(" Windows: install.bat") | |
| print(" Linux/Mac: ./install.sh") | |
| sys.exit(1) | |
| except Exception as e: | |
| print(f"Error starting PowerTraderAI+: {e}") | |
| sys.exit(1) | |
| EOF | |
| - name: Create release documentation | |
| run: | | |
| # Create release notes | |
| cat > release-build/PowerTrader_AI_Desktop/RELEASE_NOTES.md << EOF | |
| # PowerTraderAI+ Desktop - Release ${{ steps.version.outputs.VERSION }} | |
| **Release Date:** $(date +'%B %d, %Y') | |
| **Build:** ${{ steps.version.outputs.COMMIT }} | |
| **Python Version:** ${{ env.PYTHON_VERSION }}+ | |
| ## Installation Instructions | |
| ### Windows | |
| 1. Extract the ZIP file | |
| 2. Run \`install.bat\` to install dependencies | |
| 3. Run \`python start.py\` to launch the application | |
| ### Linux/macOS | |
| 1. Extract the ZIP file | |
| 2. Run \`./install.sh\` to install dependencies | |
| 3. Run \`python start.py\` to launch the application | |
| ### Manual Installation | |
| \`\`\`bash | |
| pip install -r requirements.txt | |
| python pt_desktop_app.py | |
| \`\`\` | |
| ## What's New | |
| This release includes all features from development phases 1-6 plus major advanced analytics: | |
| ### 🚀 New Advanced Features (Items 26-28) | |
| - **Portfolio Optimization Engine** - Modern Portfolio Theory with Sharpe ratio maximization | |
| - **Backtesting Framework** - Comprehensive strategy testing with Monte Carlo simulation | |
| - **Performance Attribution Engine** - Brinson attribution and factor analysis | |
| ### 🎯 Core Features | |
| - Advanced neural network trading algorithms | |
| - Professional-grade GUI interface with 12 integrated tabs | |
| - Real-time market data integration | |
| - Risk management and paper trading | |
| - Desktop application integration | |
| - Improved project structure and organization | |
| - Production deployment capabilities | |
| ## System Requirements | |
| - Python 3.8 or higher | |
| - 4GB RAM minimum (8GB recommended) | |
| - Internet connection for market data | |
| - Windows 10/11, macOS 10.15+, or Linux | |
| ## Support | |
| For issues and support: | |
| - GitHub Issues: [Repository Issues] | |
| - Documentation: See \`docs/\` directory | |
| - Email: [Support Email] | |
| --- | |
| *PowerTraderAI+ Development Team* | |
| *Simon Jackson (@sjackson0109)* | |
| EOF | |
| # Create quick start guide | |
| cat > release-build/PowerTrader_AI_Desktop/QUICK_START.md << EOF | |
| # Quick Start Guide | |
| ## 1. Installation | |
| - **Windows**: Double-click \`install.bat\` | |
| - **Linux/macOS**: Run \`./install.sh\` | |
| ## 2. Launch Application | |
| \`\`\`bash | |
| python start.py | |
| \`\`\` | |
| ## 3. First Time Setup | |
| 1. Configure your exchange API keys in the settings | |
| 2. Set up your trading preferences | |
| 3. Enable paper trading mode for safe testing | |
| 4. Review risk management settings | |
| ## 4. Getting Help | |
| - Check the \`docs/\` folder for complete documentation | |
| - See \`RELEASE_NOTES.md\` for detailed information | |
| - Visit the troubleshooting guide in \`docs/troubleshooting/\` | |
| Happy Trading! 🚀 | |
| EOF | |
| - name: Create release ZIP | |
| run: | | |
| cd release-build | |
| zip -r "PowerTrader_AI_Desktop_${{ steps.version.outputs.VERSION }}.zip" PowerTrader_AI_Desktop/ | |
| # Create checksums | |
| sha256sum "PowerTrader_AI_Desktop_${{ steps.version.outputs.VERSION }}.zip" > "PowerTrader_AI_Desktop_${{ steps.version.outputs.VERSION }}.zip.sha256" | |
| ls -la *.zip* | |
| - name: Create Python package | |
| run: | | |
| # Create setup.py for PyPI distribution | |
| cat > setup.py << EOF | |
| from setuptools import setup, find_packages | |
| import os | |
| # Read requirements | |
| def read_requirements(): | |
| req_path = os.path.join('app', 'requirements.txt') | |
| if os.path.exists(req_path): | |
| with open(req_path, 'r') as f: | |
| return [line.strip() for line in f if line.strip() and not line.startswith('#')] | |
| return [] | |
| # Read README | |
| def read_readme(): | |
| if os.path.exists('README.md'): | |
| with open('README.md', 'r', encoding='utf-8') as f: | |
| return f.read() | |
| return "" | |
| setup( | |
| name="PowerTraderAI", | |
| version="${{ steps.version.outputs.PYTHON_VERSION }}", | |
| author="Simon Jackson", | |
| author_email="simon@jacksonfamily.me", | |
| description="PowerTraderAI+ - Advanced Cryptocurrency Trading Bot", | |
| long_description=read_readme(), | |
| long_description_content_type="text/markdown", | |
| url="https://github.com/sjackson0109/PowerTraderAI", | |
| packages=find_packages(), | |
| package_dir={"powertrader": "app"}, | |
| package_data={ | |
| "powertrader": [ | |
| "config/*", | |
| "*.py", | |
| "requirements.txt" | |
| ] | |
| }, | |
| classifiers=[ | |
| "Development Status :: 4 - Beta", | |
| "Intended Audience :: Financial and Insurance Industry", | |
| "License :: OSI Approved :: MIT License", | |
| "Operating System :: OS Independent", | |
| "Programming Language :: Python :: 3", | |
| "Programming Language :: Python :: 3.8", | |
| "Programming Language :: Python :: 3.9", | |
| "Programming Language :: Python :: 3.10", | |
| "Programming Language :: Python :: 3.11", | |
| "Topic :: Office/Business :: Financial :: Investment", | |
| "Topic :: Scientific/Engineering :: Artificial Intelligence", | |
| ], | |
| python_requires=">=3.8", | |
| install_requires=read_requirements(), | |
| entry_points={ | |
| "console_scripts": [ | |
| "powertrader=powertrader.pt_desktop_app:main", | |
| ], | |
| }, | |
| include_package_data=True, | |
| zip_safe=False, | |
| ) | |
| EOF | |
| # Build Python package | |
| python setup.py sdist bdist_wheel | |
| ls -la dist/ | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: powertrader-ai-release-${{ steps.version.outputs.VERSION }} | |
| path: | | |
| release-build/*.zip | |
| release-build/*.sha256 | |
| dist/*.whl | |
| dist/*.tar.gz | |
| retention-days: 90 | |
| - name: Publish to PyPI | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
| run: | | |
| # Upload to PyPI | |
| twine upload dist/* --verbose | |
| continue-on-error: true | |
| - name: Publish to GitHub Packages | |
| if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | |
| TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/ | |
| run: | | |
| # Configure for GitHub Packages | |
| echo "Publishing to GitHub Packages..." | |
| pip install twine | |
| # Create .pypirc for GitHub Packages | |
| cat > ~/.pypirc << EOF | |
| [distutils] | |
| index-servers = github | |
| [github] | |
| repository = https://upload.pypi.org/legacy/ | |
| username = __token__ | |
| password = ${{ secrets.GITHUB_TOKEN }} | |
| EOF | |
| # Upload to GitHub Packages (if configured) | |
| # twine upload --repository github dist/* | |
| echo "GitHub Packages upload configured (requires GITHUB_TOKEN)" | |
| continue-on-error: true | |
| - name: Publish to Artifact Repository | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| env: | |
| ARTIFACTORY_URL: ${{ secrets.ARTIFACTORY_URL }} | |
| ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} | |
| ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} | |
| run: | | |
| if [ -n "$ARTIFACTORY_URL" ]; then | |
| echo "Publishing to Artifactory..." | |
| # Upload ZIP artifact | |
| curl -u "$ARTIFACTORY_USERNAME:$ARTIFACTORY_PASSWORD" \ | |
| -X PUT "$ARTIFACTORY_URL/powertrader-releases/PowerTrader_AI_Desktop_${{ steps.version.outputs.VERSION }}.zip" \ | |
| -T "release-build/PowerTrader_AI_Desktop_${{ steps.version.outputs.VERSION }}.zip" | |
| # Upload Python wheels | |
| for wheel in dist/*.whl; do | |
| if [ -f "$wheel" ]; then | |
| filename=$(basename "$wheel") | |
| curl -u "$ARTIFACTORY_USERNAME:$ARTIFACTORY_PASSWORD" \ | |
| -X PUT "$ARTIFACTORY_URL/python-packages/$filename" \ | |
| -T "$wheel" | |
| fi | |
| done | |
| echo "Artifacts uploaded to Artifactory" | |
| else | |
| echo "Artifactory not configured (set ARTIFACTORY_* secrets)" | |
| fi | |
| continue-on-error: true | |
| - name: Publish to AWS CodeArtifact | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| env: | |
| AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| CODEARTIFACT_DOMAIN: ${{ secrets.CODEARTIFACT_DOMAIN }} | |
| CODEARTIFACT_REPOSITORY: ${{ secrets.CODEARTIFACT_REPOSITORY }} | |
| run: | | |
| if [ -n "$AWS_ACCESS_KEY_ID" ] && [ -n "$CODEARTIFACT_DOMAIN" ]; then | |
| echo "Publishing to AWS CodeArtifact..." | |
| # Install AWS CLI | |
| pip install awscli | |
| # Get CodeArtifact authorization token | |
| export TWINE_USERNAME=aws | |
| export TWINE_PASSWORD=$(aws codeartifact get-authorization-token \ | |
| --domain $CODEARTIFACT_DOMAIN \ | |
| --query authorizationToken \ | |
| --output text) | |
| export TWINE_REPOSITORY_URL=$(aws codeartifact get-repository-endpoint \ | |
| --domain $CODEARTIFACT_DOMAIN \ | |
| --repository $CODEARTIFACT_REPOSITORY \ | |
| --format pypi \ | |
| --query repositoryEndpoint \ | |
| --output text) | |
| # Upload to CodeArtifact | |
| twine upload dist/* --verbose | |
| echo "Artifacts uploaded to AWS CodeArtifact" | |
| else | |
| echo "AWS CodeArtifact not configured (set AWS_* and CODEARTIFACT_* secrets)" | |
| fi | |
| continue-on-error: true | |
| - name: Create GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.version.outputs.VERSION }} | |
| release_name: PowerTraderAI+ Desktop ${{ steps.version.outputs.VERSION }} | |
| body: | | |
| ## PowerTraderAI+ Desktop Release ${{ steps.version.outputs.VERSION }} | |
| **Release Date:** $(date +'%B %d, %Y') | |
| **Build Commit:** ${{ steps.version.outputs.COMMIT }} | |
| ### Installation | |
| 1. Download the ZIP file below | |
| 2. Extract and run the installation script | |
| 3. Follow the Quick Start Guide | |
| ### What's Included | |
| - Complete PowerTraderAI+ desktop application | |
| - All documentation and guides | |
| - Installation scripts for all platforms | |
| - Latest neural network models and configurations | |
| - Advanced analytics features (Portfolio Optimization, Backtesting, Performance Attribution) | |
| ### System Requirements | |
| - Python 3.8+ | |
| - 4GB+ RAM | |
| - Internet connection | |
| See RELEASE_NOTES.md in the download for complete details. | |
| draft: false | |
| prerelease: ${{ contains(steps.version.outputs.VERSION, 'dev') || contains(steps.version.outputs.VERSION, 'beta') }} | |
| - name: Create GitHub Release and Upload Assets | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: PowerTrader AI Desktop ${{ steps.version.outputs.VERSION }} | |
| body: | | |
| ## PowerTraderAI+ Desktop - Release ${{ steps.version.outputs.VERSION }} | |
| **Release Date:** $(date +'%B %d, %Y') | |
| **Build:** ${{ steps.version.outputs.COMMIT }} | |
| ### 🚀 New Advanced Features | |
| - **Portfolio Optimization Engine** - Modern Portfolio Theory implementation with efficient frontier | |
| - **Backtesting Framework** - Comprehensive strategy testing with Monte Carlo simulation | |
| - **Performance Attribution Engine** - Advanced attribution analysis and risk decomposition | |
| ### 📊 What's Included | |
| - Complete PowerTraderAI+ desktop application | |
| - All documentation and advanced features guides | |
| - Installation scripts for all platforms | |
| - Latest neural network models and configurations | |
| ### 💻 System Requirements | |
| - Python 3.8+ | |
| - 4GB+ RAM | |
| - Internet connection | |
| See RELEASE_NOTES.md in the download for complete details. | |
| files: | | |
| release-build/PowerTrader_AI_Desktop_${{ steps.version.outputs.VERSION }}.zip | |
| draft: false | |
| prerelease: ${{ contains(steps.version.outputs.VERSION, 'dev') || contains(steps.version.outputs.VERSION, 'beta') }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Summary | |
| run: | | |
| echo "## Release Build Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Version:** ${{ steps.version.outputs.VERSION }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**Build Date:** $(date)" >> $GITHUB_STEP_SUMMARY | |
| echo "**Commit:** ${{ steps.version.outputs.COMMIT }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Artifacts Created" >> $GITHUB_STEP_SUMMARY | |
| echo "- PowerTrader_AI_Desktop_${{ steps.version.outputs.VERSION }}.zip" >> $GITHUB_STEP_SUMMARY | |
| echo "- Python wheel and source distribution" >> $GITHUB_STEP_SUMMARY | |
| echo "- SHA256 checksum file" >> $GITHUB_STEP_SUMMARY | |
| echo "- Installation scripts (Windows & Unix)" >> $GITHUB_STEP_SUMMARY | |
| echo "- Complete documentation package" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Distribution Channels" >> $GITHUB_STEP_SUMMARY | |
| echo "- GitHub Releases (ZIP download)" >> $GITHUB_STEP_SUMMARY | |
| echo "- PyPI (pip install powertrader-ai)" >> $GITHUB_STEP_SUMMARY | |
| echo "- GitHub Packages" >> $GITHUB_STEP_SUMMARY | |
| echo "- Artifactory (if configured)" >> $GITHUB_STEP_SUMMARY | |
| echo "- AWS CodeArtifact (if configured)" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "The release has been distributed across all configured artifact repositories." >> $GITHUB_STEP_SUMMARY | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| with: | |
| tag_name: ${{ github.ref }} | |
| name: PowerTrader AI Release ${{ steps.version.outputs.VERSION }} | |
| body: | | |
| ## PowerTrader AI Desktop Application | |
| A comprehensive trading platform with advanced analytics capabilities. | |
| ### Quick Start | |
| 1. Download the ZIP file below | |
| 2. Extract to your desired location | |
| 3. Run the appropriate installation script: | |
| - Windows: `install.bat` | |
| - Linux/Mac: `./install.sh` | |
| ### Manual Installation | |
| \`\`\`bash | |
| pip install -r requirements.txt | |
| python pt_desktop_app.py | |
| \`\`\` | |
| ## What's New | |
| This release includes all features from development phases 1-6 plus major advanced analytics: | |
| ### 🚀 New Advanced Features (Items 26-28) | |
| - **Portfolio Optimization Engine** - Modern Portfolio Theory with Sharpe ratio maximization | |
| - **Backtesting Framework** - Comprehensive strategy testing with Monte Carlo simulation | |
| - **Performance Attribution Engine** - Brinson attribution and factor analysis | |
| ### 🎯 Core Features | |
| - Advanced neural network trading algorithms | |
| - Professional-grade GUI interface with 12 integrated tabs | |
| - Real-time market data integration | |
| - Risk management and paper trading | |
| - Desktop application integration | |
| - Improved project structure and organization | |
| - Production deployment capabilities | |
| ## System Requirements | |
| - Python 3.8 or higher | |
| - 4GB RAM minimum (8GB recommended) | |
| ## Security Note | |
| This release includes SHA256 checksums for verification. Always verify the integrity of downloaded files. | |
| **Version:** ${{ steps.version.outputs.VERSION }} | |
| **Build Date:** ${{ steps.version.outputs.DATE }} | |
| **Commit:** ${{ steps.version.outputs.COMMIT }} | |
| files: | | |
| PowerTrader_AI_Desktop_${{ steps.version.outputs.VERSION }}.zip | |
| dist/*.whl | |
| dist/*.tar.gz | |
| SHA256SUMS.txt | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |