-
Notifications
You must be signed in to change notification settings - Fork 1.2k
179 lines (168 loc) · 6.48 KB
/
intelligence-docs.yml
File metadata and controls
179 lines (168 loc) · 6.48 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: Intelligence Docs
on:
push:
branches:
- main
paths:
- "intelligence/**/*"
- ".github/workflows/intelligence-*.yml"
pull_request:
branches:
- main
paths:
- "intelligence/**/*"
- ".github/workflows/intelligence-*.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
FLWR_TELEMETRY_ENABLED: 0
jobs:
check_format_docs:
runs-on: ubuntu-22.04
name: Check Docs Formatting
steps:
- uses: actions/checkout@v5
- name: Bootstrap
uses: ./.github/actions/bootstrap
with:
uv-skip: "false"
poetry-skip: "true"
- name: Install dependencies
run: |
cd dev
uv sync --frozen
- name: Check docs format
run: |
cd dev
uv run docstrfmt --check ../intelligence/docs/source
build_ts_docs:
runs-on: ubuntu-22.04
name: Build TypeScript Docs
steps:
- uses: actions/checkout@v5
- name: Bootstrap
uses: ./.github/actions/bootstrap
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "22.14.0"
- name: Install pnpm
run: |
npm install -g pnpm
- name: Install Flower Intelligence
run: |
cd intelligence/ts
pnpm i
- name: Build TS docs
run: |
cd intelligence/ts
pnpm build:docs --readme none --name "TypeScript API"
- name: Move TS docs
run: |
echo -e '\n```{toctree}\n:hidden:\n:maxdepth: 2\n:glob:\n\n*/*\n```' >> intelligence/docs/source/ts-api-ref/index.md
- name: Upload TS docs artifact
uses: actions/upload-artifact@v4
with:
name: ts-docs
path: intelligence/docs/source/ts-api-ref/
build_swift_docs:
if: false
runs-on: macos-14
name: Build Swift Docs
steps:
- uses: actions/checkout@v5
- name: Bootstrap
uses: ./.github/actions/bootstrap
with:
python-version: "3.10"
- uses: swift-actions/setup-swift@v2
with:
swift-version: "6.0.0"
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "16.2"
- name: Install SourceDocs
run: brew install sourcedocs
- name: Build Swift docs
run: |
(
mv FlowerIntelligenceExamples.xcodeproj FlowerIntelligenceExamples.xcodeproj.bak
trap 'mv FlowerIntelligenceExamples.xcodeproj.bak FlowerIntelligenceExamples.xcodeproj' EXIT
sourcedocs generate --module-name FlowerIntelligence -- -scheme flower -destination 'platform=macOS'
)
mkdir -p intelligence/docs/source/swift-api-ref
cp -r Documentation/Reference/* intelligence/docs/source/swift-api-ref/
mv intelligence/docs/source/swift-api-ref/README.md intelligence/docs/source/swift-api-ref/index.md
sed -i.bak '1 s/^# .*/# Swift API/' intelligence/docs/source/swift-api-ref/index.md
sed -i.bak '/^This file was generated by/d' intelligence/docs/source/swift-api-ref/index.md
rm -f intelligence/docs/source/swift-api-ref/index.md.bak
echo -e '\n```{toctree}\n:hidden:\n:maxdepth: 2\n:glob:\n\n*/*\n```' >> intelligence/docs/source/swift-api-ref/index.md
- name: Upload Swift docs artifact
uses: actions/upload-artifact@v4
with:
name: swift-docs
path: intelligence/docs/source/swift-api-ref/
build_kt_docs:
runs-on: ubuntu-22.04
name: Build Kotlin Docs
steps:
- uses: actions/checkout@v5
- name: Bootstrap
uses: ./.github/actions/bootstrap
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
- name: Build Kotlin docs
run: |
./intelligence/dev/build-kt-docs.sh
- name: Upload Kotlin docs artifact
uses: actions/upload-artifact@v4
with:
name: kt-docs
path: intelligence/docs/source/kt-api-ref/
build_and_deploy:
runs-on: ubuntu-22.04
needs: [build_ts_docs, build_kt_docs]
name: Deploy Docs
steps:
- uses: actions/checkout@v5
if: ${{ github.ref == 'refs/heads/main' && github.repository == 'flwrlabs/flower' && !github.event.pull_request.head.repo.fork }}
- name: Bootstrap
if: ${{ github.ref == 'refs/heads/main' && github.repository == 'flwrlabs/flower' && !github.event.pull_request.head.repo.fork }}
uses: ./.github/actions/bootstrap
- name: Install pandoc
if: ${{ github.ref == 'refs/heads/main' && github.repository == 'flwrlabs/flower' && !github.event.pull_request.head.repo.fork }}
run: sudo apt install pandoc
- name: Install Flower dependencies (mandatory only)
if: ${{ github.ref == 'refs/heads/main' && github.repository == 'flwrlabs/flower' && !github.event.pull_request.head.repo.fork }}
run: |
cd framework
python -m poetry install --extras "simulation"
- name: Download TS docs
if: ${{ github.ref == 'refs/heads/main' && github.repository == 'flwrlabs/flower' && !github.event.pull_request.head.repo.fork }}
uses: actions/download-artifact@v4
with:
name: ts-docs
path: intelligence/docs/source/ts-api-ref/
- name: Download Kotlin docs
if: ${{ github.ref == 'refs/heads/main' && github.repository == 'flwrlabs/flower' && !github.event.pull_request.head.repo.fork }}
uses: actions/download-artifact@v4
with:
name: kt-docs
path: intelligence/docs/source/kt-api-ref/
- name: Build final docs
if: ${{ github.ref == 'refs/heads/main' && github.repository == 'flwrlabs/flower' && !github.event.pull_request.head.repo.fork }}
run: |
cd intelligence/docs
make html
- name: Deploy docs
if: ${{ github.ref == 'refs/heads/main' && github.repository == 'flwrlabs/flower' && !github.event.pull_request.head.repo.fork }}
env:
AWS_DEFAULT_REGION: ${{ secrets.DOCS_AWS_DEFAULT_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_AWS_SECRET_KEY_ID }}
run: |
aws s3 sync --delete --exclude ".*" --exclude "v/*" --cache-control "no-cache" ./intelligence/docs/build/html/ s3://${{ secrets.DOCS_AWS_BUCKET_NAME }}/docs/intelligence