Skip to content

Merge pull request #13 from Unity-Lab-AI/codex/fix-payment-requiremen… #4

Merge pull request #13 from Unity-Lab-AI/codex/fix-payment-requiremen…

Merge pull request #13 from Unity-Lab-AI/codex/fix-payment-requiremen… #4

Workflow file for this run

name: Main Branch Delivery
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
name: Build and Upload Artifacts
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build static site bundle
run: |
python - <<'PY'
import json
import shutil
import time
from pathlib import Path
start = time.perf_counter()
root = Path('.')
dist = Path('dist')
if dist.exists():
shutil.rmtree(dist)
dist.mkdir(parents=True, exist_ok=True)
for asset in ['index.html', 'style.css', 'app.js', 'ai-instruct.txt']:
shutil.copy2(root / asset, dist / asset)
duration = time.perf_counter() - start
report_dir = Path('ci_reports')
report_dir.mkdir(parents=True, exist_ok=True)
(report_dir / 'build_status.json').write_text(
json.dumps(
{
'status': 'succeeded',
'artifact': 'github-pages',
'duration': duration,
},
indent=2,
)
)
PY
- name: Upload static artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist
- name: Upload build report
if: always()
uses: actions/upload-artifact@v4
with:
name: build-status-report
path: ci_reports/build_status.json
if-no-files-found: warn
report-build:
name: Report Build Status
runs-on: ubuntu-latest
needs: build
if: ${{ always() && needs.build.result != 'cancelled' }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Download build report
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: build-status-report
path: ci_reports
- name: Render build summary
run: python scripts/report_build.py
run-tests:
name: Run Tests
runs-on: ubuntu-latest
needs: build
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Tests
run: python tests/run_tests.py
- name: Upload test report
if: always()
uses: actions/upload-artifact@v4
with:
name: main-test-report
path: ci_reports/test_results.json
if-no-files-found: warn
report-tests:
name: Report Tests Statuses
runs-on: ubuntu-latest
needs: run-tests
if: ${{ always() && needs.run-tests.result != 'cancelled' }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Download test report
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: main-test-report
path: ci_reports
- name: Render summary
run: python scripts/report_tests.py
deploy:
name: Deploy to Pages
runs-on: ubuntu-latest
needs: build
if: ${{ needs.build.result == 'success' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@v4