-
Notifications
You must be signed in to change notification settings - Fork 18
133 lines (114 loc) · 4.2 KB
/
ci.yml
File metadata and controls
133 lines (114 loc) · 4.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
pages: write
id-token: write
jobs:
validate:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
node-version: ["20"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Python Setup
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
test -f requirements.txt && pip install -r requirements.txt || true
pip install pytest ruff mypy
# Node.js Setup
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Install Node.js dependencies
run: |
test -f package.json && npm install || true
# Python Linting
- name: Run ruff linter
run: ruff check . --line-length=100 --ignore=E501,F401 --statistics || true
- name: Run mypy type checking
run: mypy . --ignore-missing-imports --follow-imports=skip || true
# Python Tests
- name: Run pytest suite
run: python -m pytest tests/ -v --tb=short || true
# TDD Validator
- name: Run TDD validator
run: |
if [ -d "tdd-docs" ]; then
echo "Running TDD validation..."
python -m pytest tdd-docs/ -v --tb=short 2>/dev/null || true
else
echo "No tdd-docs/ directory found, skipping TDD validation"
fi
# LaTeX Validation
- name: Check LaTeX availability
id: latex-check
run: |
if command -v pdflatex &> /dev/null; then
echo "latex_available=true" >> $GITHUB_OUTPUT
else
echo "latex_available=false" >> $GITHUB_OUTPUT
echo "pdflatex not found"
fi
- name: Install TeX Live (if needed)
if: steps.latex-check.outputs.latex_available == 'false'
run: |
sudo apt-get update
sudo apt-get install -y texlive-latex-base texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended texlive-lang-portuguese
- name: Validate LaTeX compilation
run: |
latex_files=$(find . -maxdepth 2 -name "*.tex" -type f)
if [ -n "$latex_files" ]; then
echo "Found LaTeX files to validate"
for file in $latex_files; do
dir=$(dirname "$file")
name=$(basename "$file" .tex)
echo "Compiling: $file"
cd "$dir"
pdflatex -interaction=nonstopmode -halt-on-error "${name}.tex" 2>&1 || true
cd "$GITHUB_WORKSPACE"
done
else
echo "No LaTeX files found in repository root (depth 2)"
fi
# Repository Structure Validation
- name: Validate repository structure
run: |
for dir in agents skills opencode.json; do
if [ ! -e "$dir" ]; then
echo "Missing: $dir"
fi
done
echo "Repository structure validated"
# Generate PDF Artifacts
- name: Generate PDF artifacts
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
mkdir -p artifacts
find . -maxdepth 3 -name "*.pdf" -type f -not -path "./artifacts/*" -exec cp {} artifacts/ \;
echo "OpenCode Ecosystem - Health Summary" > artifacts/health-summary.txt
echo "Generated: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> artifacts/health-summary.txt
echo "Python: ${{ matrix.python-version }}" >> artifacts/health-summary.txt
echo "Node.js: ${{ matrix.node-version }}" >> artifacts/health-summary.txt
- name: Upload PDF artifacts
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: opencode-artifacts-${{ github.sha }}
path: artifacts/
retention-days: 7