-
Notifications
You must be signed in to change notification settings - Fork 733
200 lines (194 loc) · 6.13 KB
/
build-docs.yml
File metadata and controls
200 lines (194 loc) · 6.13 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: Build docs
on:
push:
branches:
- docs-*
- github-actions-*
- rel-*
- release-*
- release/*
tags:
- dev-docs-publish
- docs-publish
- v*
paths:
- .github/workflows/build-docs.yml
- docs/**
- examples/**
- fiftyone/**
- "**.py"
- "**.md"
- "**.rst"
pull_request:
branches:
- develop
- feat/*
- main
- rel-*
- release-*
- release/*
paths:
- .github/workflows/build-docs.yml
- docs/**
- examples/**
- fiftyone/**
- requirements/**
- "**.py"
- "**.md"
- "**.rst"
jobs:
build:
runs-on: ubuntu-latest
env:
FIFTYONE_DO_NOT_TRACK: true
DOCSEARCH_API_KEY: ${{ secrets.DOCSEARCH_API_KEY }}
GITHUB_TOKEN: ${{ secrets.FIFTYONE_GITHUB_TOKEN }}
steps:
- name: Clone fiftyone for tag builds
if: github.ref_type == 'tag'
uses: actions/checkout@v6
with:
# Fetch full history for rev-parse to work
fetch-depth: 0
- name: Clone fiftyone for branch builds
if: github.ref_type == 'branch'
uses: actions/checkout@v6
- name: Get Branch Name
id: get_branch
run: |
if [[ "${{ github.ref_type }}" == "tag" ]]; then
TAG_SHA=$(git rev-parse ${{ github.ref }})
case "${{ github.ref_name }}" in
docs-publish|v*)
MAIN_SHA=$(git rev-parse origin/main)
if [[ "${MAIN_SHA}" == "${TAG_SHA}" ]]; then
echo "branch_name=main" >> "${GITHUB_OUTPUT}"
else
echo "docs-publish should only be performed on 'main'"
exit 1
fi
;;
dev-docs-publish)
DEVELOP_SHA=$(git rev-parse origin/develop)
if [[ "${DEVELOP_SHA}" == "${TAG_SHA}" ]]; then
echo "branch_name=develop" >> "${GITHUB_OUTPUT}"
else
echo "dev-docs-publish should only be performed on 'develop'"
exit 1
fi
;;
esac
else
case "${{ github.ref_name }}" in
main|develop)
echo "branch_name=${{ github.ref_name }}" >> "${GITHUB_OUTPUT}"
;;
*)
# use `main` because arbitrary branch names may not exist on `fiftyone-teams` or `eta`
echo "branch_name=main" >> "${GITHUB_OUTPUT}"
;;
esac
fi
- name: Checkout fiftyone-teams
uses: actions/checkout@v6
with:
repository: voxel51/fiftyone-teams
path: fiftyone-teams
token: ${{ secrets.RO_FOT_FG_PAT }}
ref: ${{ steps.get_branch.outputs.branch_name }}
- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Free Disk Space (Ubuntu) # standard runner's 14 GB available disk size isn't enough. Need at least 22 GB free.
uses: jlumbroso/[email protected]
with:
large-packages: false # e2e test failed when `true`
- name: Install pip dependencies
run: |
pip install --upgrade pip setuptools wheel build
- name: Install ETA from source
run: |
git clone https://github.com/voxel51/eta eta --depth 1 --branch "${{ steps.get_branch.outputs.branch_name }}"
cd eta
python -Im build
pip install ./dist/*.whl
- name: Install
run: |
echo "Installing system dependencies"
sudo apt-get install pandoc
echo "Installing docs requirements"
pip install -r requirements/docs.txt
echo "Installing fiftyone-brain and fiftyone-db"
pip install fiftyone-brain fiftyone-db
echo "Installing fiftyone"
pip install .
- name: Setup node 22
uses: actions/setup-node@v6
with:
node-version: 22
- name: Enable corepack
run: corepack enable
- name: Prepare yarn 4
run: corepack prepare [email protected] --activate
- name: Cache Node Modules
id: node-cache
uses: actions/cache@v5
with:
path: |
app/node_modules
app/.yarn/cache
key: node-modules-${{ hashFiles('app/yarn.lock') }}
- name: Install app
if: steps.node-cache.outputs.cache-hit != 'true'
run: cd app && yarn install
- name: Build docs
run: |
./docs/generate_docs.bash -t fiftyone-teams
- name: Upload docs
uses: actions/upload-artifact@v7
with:
name: docs
path: docs/build/html/
outputs:
branch_name: ${{ steps.get_branch.outputs.branch_name}}
publish:
needs: [build]
if: |
needs.build.outputs.branch_name == 'main' &&
(startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/tags/docs-publish')
runs-on: ubuntu-latest
steps:
- name: Download docs
uses: actions/download-artifact@v8
with:
name: docs
path: docs-download/
- name: Authorize gcloud
uses: google-github-actions/auth@v3
with:
credentials_json: "${{ secrets.DOCS_GCP_CREDENTIALS }}"
- name: Set up gcloud
uses: google-github-actions/setup-gcloud@v3
- name: publish
run: gsutil -m rsync -dR -x '^SBOMs/.*' docs-download gs://docs.voxel51.com
dev-publish:
needs: [build]
if: |
needs.build.outputs.branch_name == 'develop' &&
github.ref == 'refs/tags/dev-docs-publish'
runs-on: ubuntu-latest
steps:
- name: Download docs
uses: actions/download-artifact@v8
with:
name: docs
path: docs-download/
- name: Authorize gcloud
uses: google-github-actions/auth@v3
with:
credentials_json: "${{ secrets.DOCS_GCP_CREDENTIALS }}"
- name: Set up gcloud
uses: google-github-actions/setup-gcloud@v3
- name: publish
run: gsutil -m rsync -dR -x '^robots.txt' docs-download gs://docs.dev.voxel51.com