-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor code to improve performance and readability
- Loading branch information
0 parents
commit f0ae87b
Showing
7,408 changed files
with
2,078,183 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ENVIRONMENT=development |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "AI Platform Development", | ||
"containerEnv": { | ||
"DOCKER_USERNAME": "${localEnv:DOCKER_USERNAME}", | ||
"DOCKER_PASSWORD": "${localEnv:DOCKER_PASSWORD}", | ||
"OPENAI_API_KEY": "${localEnv:OPENAI_API_KEY}", | ||
"TRANSFORMERS_API_KEY": "${localEnv:TRANSFORMERS_API_KEY}", | ||
"ENVIRONMENT": "development" | ||
}, | ||
"remoteEnv": { | ||
"PATH": "${containerEnv:PATH}:/usr/local/bin", | ||
"GRAFANA_ADMIN_PASSWORD": "${localEnv:GRAFANA_ADMIN_PASSWORD}", | ||
"AZURE_STORAGE_ACCOUNT": "${localEnv:AZURE_STORAGE_ACCOUNT}", | ||
"AZURE_STORAGE_CONTAINER": "${localEnv:AZURE_STORAGE_CONTAINER}" | ||
}, | ||
"settings": { | ||
"terminal.integrated.inheritEnv": true | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "npm" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
assignees: | ||
- "your-username" | ||
reviewers: | ||
- "reviewer-username" | ||
ignore: | ||
- dependency-name: "some-library" | ||
versions: ["1.x"] | ||
commit-message: | ||
prefix: "deps" | ||
include: scope | ||
- package-ecosystem: "pip" | ||
directory: "/path/to/python/project" | ||
schedule: | ||
interval: "weekly" | ||
open-pull-requests-limit: 5 | ||
labels: | ||
- "dependencies" | ||
- "python" | ||
- package-ecosystem: "docker" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
rebase-strategy: "auto" | ||
commit-message: | ||
include: dependency-name |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
name: Continuous Optimization Loop | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: '0 0 * * 1' # Runs weekly on Monday at midnight UTC | ||
|
||
jobs: | ||
initialize: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
# Add caching for dependencies | ||
- name: Cache Node.js modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- name: Cache Cargo registry | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cargo/registry | ||
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-cargo-registry- | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
|
||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
|
||
deploy-dev: | ||
runs-on: ubuntu-latest | ||
needs: initialize | ||
steps: | ||
- name: Deploy to Development Environment | ||
run: | | ||
echo "Deploying to development..." | ||
# Add your deployment scripts here | ||
security-audit: | ||
runs-on: ubuntu-latest | ||
needs: deploy-dev | ||
steps: | ||
- name: Advanced Security Scan | ||
run: | | ||
npm audit --audit-level=moderate | ||
cargo audit | ||
snyk test --severity-threshold=medium | ||
snyk monitor --org=${{ vars.SNYK_ORG }} | ||
env: | ||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | ||
|
||
deploy-prod: | ||
runs-on: ubuntu-latest | ||
needs: security-audit | ||
if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' | ||
steps: | ||
# Enhanced deployment with monitoring and rollback | ||
- name: Deploy to AWS ECS with Rollback | ||
run: | | ||
# Deploy with rollback on failure | ||
if ! aws ecs update-service --cluster your-cluster --service your-service --force-new-deployment; then | ||
echo "Deployment failed, initiating rollback" | ||
aws ecs update-service --cluster your-cluster --service your-service --task-definition $PREVIOUS_TASK_DEF | ||
exit 1 | ||
fi | ||
- name: Monitor Deployment | ||
run: | | ||
# Monitor deployment health | ||
attempts=0 | ||
until aws ecs describe-services --cluster your-cluster --services your-service --query 'services[0].status' | grep "ACTIVE" | ||
do | ||
if [ $attempts -eq 5 ]; then | ||
echo "Deployment health check failed" | ||
exit 1 | ||
fi | ||
attempts=$((attempts+1)) | ||
sleep 30 | ||
done | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
|
||
reporting: | ||
runs-on: ubuntu-latest | ||
needs: deploy-prod | ||
steps: | ||
- name: Generate Detailed Report | ||
run: | | ||
{ | ||
echo "## Deployment Summary $(date)" | ||
echo "### Status Overview" | ||
echo "- Environment: Production" | ||
echo "- Build ID: ${{ github.run_id }}" | ||
echo "- Commit: ${{ github.sha }}" | ||
echo "### Health Checks" | ||
echo "- Security Scans: ✅" | ||
echo "- Performance Tests: ✅" | ||
echo "- Deployment Status: ✅" | ||
} > deployment-report.md | ||
- name: Send Enhanced Notifications | ||
if: always() | ||
run: | | ||
# Send detailed Slack notification | ||
curl -X POST -H 'Content-type: application/json' \ | ||
--data "{ | ||
\"text\": \"Deployment Status: ${{ job.status }}\nEnvironment: Production\nBuild: ${{ github.run_number }}\nDetails: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\" | ||
}" ${{ secrets.SLACK_WEBHOOK }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
name: "Enhanced CodeQL Advanced Security Scan with Automated Fixes" | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
schedule: | ||
- cron: '18 6 * * 4' # Weekly scan on Thursday at 6:18 UTC | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze (${{ matrix.language }}) | ||
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} | ||
permissions: | ||
security-events: write | ||
packages: read | ||
actions: read | ||
contents: read | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- language: python | ||
build-mode: none | ||
- language: javascript-typescript | ||
build-mode: none | ||
- language: c-cpp | ||
build-mode: manual | ||
|
||
steps: | ||
# Step 1: Checkout the code | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Step 2: Initialize CodeQL with enhanced queries | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v3 | ||
with: | ||
languages: ${{ matrix.language }} | ||
build-mode: ${{ matrix.build-mode }} | ||
queries: +security-extended,performance-extended | ||
|
||
# Step 3: Build for languages needing compilation (e.g., C/C++) | ||
- if: matrix.build-mode == 'manual' | ||
name: Build Project (Manual Build Mode) | ||
run: | | ||
echo "Building project for ${matrix.language}..." | ||
cmake . | ||
make | ||
# Step 4: Perform CodeQL analysis | ||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v3 | ||
with: | ||
category: "/language:${{matrix.language}}" | ||
|
||
# Step 5: Automated Fixes for Minor Issues | ||
- name: Apply Automated Fixes for Python | ||
if: matrix.language == 'python' | ||
run: | | ||
pip install black | ||
black . # Automatically format Python code | ||
- name: Apply Automated Fixes for JavaScript/TypeScript | ||
if: matrix.language == 'javascript-typescript' | ||
run: | | ||
npm install --save-dev eslint prettier | ||
npx eslint . --fix # Automatically fix JavaScript/TypeScript linting issues | ||
npx prettier --write . # Format code with Prettier | ||
- name: Apply Automated Fixes for Rust | ||
if: matrix.language == 'c-cpp' | ||
run: | | ||
rustup component add rustfmt | ||
cargo fmt # Automatically format Rust code | ||
# Step 6: Dependency Fixes | ||
- name: Fix Node.js Dependency Vulnerabilities | ||
if: matrix.language == 'javascript-typescript' | ||
run: npm audit fix || true # Automatically fix npm vulnerabilities | ||
|
||
- name: Fix Rust Dependency Vulnerabilities | ||
if: matrix.language == 'c-cpp' | ||
run: | | ||
cargo install cargo-audit | ||
cargo audit fix || true # Automatically fix Rust dependencies where possible | ||
# Step 7: Commit and Push Automated Fixes | ||
- name: Commit and Push Fixes | ||
if: github.ref == 'refs/heads/main' | ||
run: | | ||
git config --local user.name "github-actions" | ||
git config --local user.email "[email protected]" | ||
git add . | ||
git commit -m "Automated code and dependency fixes [CI]" || echo "No changes to commit" | ||
git push origin main || echo "No changes to push" | ||
# Step 8: Upload CodeQL SARIF results for report review | ||
- name: Upload CodeQL SARIF Results | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: CodeQL-SARIF-${{ matrix.language }} | ||
path: *.sarif | ||
|
||
# Notification Job | ||
notify: | ||
runs-on: ubuntu-latest | ||
needs: analyze | ||
if: always() | ||
steps: | ||
- name: Check if CodeQL found any issues | ||
id: check_sarif | ||
run: | | ||
grep -q '"severity":' *.sarif && echo "issues_found=true" || echo "issues_found=false" | ||
# Slack Notification on Analysis Completion | ||
- name: Notify Slack | ||
if: steps.check_sarif.outputs.issues_found == 'true' | ||
run: | | ||
curl -X POST -H 'Content-type: application/json' --data '{"text":":warning: CodeQL scan completed with issues. Please review the report."}' ${{ secrets.SLACK_WEBHOOK }} | ||
- name: Notify Slack No Issues | ||
if: steps.check_sarif.outputs.issues_found == 'false' | ||
run: | | ||
curl -X POST -H 'Content-type: application/json' --data '{"text":"CodeQL scan completed with no issues found."}' ${{ secrets.SLACK_WEBHOOK }} | ||
# Generate and Upload Report Artifact | ||
reporting: | ||
runs-on: ubuntu-latest | ||
needs: notify | ||
steps: | ||
- name: Generate Report Summary | ||
run: | | ||
echo "## CodeQL Security Report" > report.md | ||
echo "### Code Quality and Security Checks" >> report.md | ||
echo "- Code analysis and vulnerability scan completed." >> report.md | ||
echo "- SARIF results available for download if issues were detected." >> report.md | ||
echo "### Results Summary" >> report.md | ||
if [[ ${{needs.notify.outputs.issues_found}} == 'true' ]]; then | ||
echo "- :warning: Issues detected. Please review the SARIF files." >> report.md | ||
else | ||
echo "- No issues detected." >> report.md | ||
fi | ||
- name: Upload Report Artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: CodeQL-Report | ||
path: report.md |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Step 1: Inspect and Execute `ai_platform_setup.sh` | ||
# Navigate to the ai_platform_setup directory and make the setup script executable, then run it. | ||
cd ai_platform_setup | ||
chmod +x ai_platform_setup.sh | ||
./ai_platform_setup.sh | ||
|
||
# Step 2: Run Docker Compose | ||
# Check if Docker Compose is set up to manage the platform services, then bring up services using docker-compose.yml. | ||
# This command assumes Docker is installed and running on the host system. | ||
docker-compose up -d | ||
|
||
# Step 3: Execute `automated_deploy.sh` | ||
# Run the automated deployment script, which may deploy services to a Kubernetes cluster or other orchestration platforms. | ||
chmod +x automated_deploy.sh | ||
./automated_deploy.sh | ||
|
||
# Step 4: Review Logs and Status | ||
# Check the status of Docker containers and deployment output to confirm successful setup. | ||
docker ps |
Oops, something went wrong.