-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (104 loc) · 3.99 KB
/
docs.yml
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
name: Docs
on:
push:
branches:
- main
- 'version-*'
permissions:
contents: read
jobs:
build_push_docs:
runs-on: ubuntu-latest
env:
DATABASE_URI: postgresql+psycopg://vix_user:vix_password@localhost:5432/vix_db
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: vix_user
POSTGRES_PASSWORD: vix_password
POSTGRES_DB: vix_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Docs dependencies
run: python3 -m pip install -r requirements.txt
- name: Download Swagger UI
run: |
wget https://github.com/swagger-api/swagger-ui/archive/refs/tags/v5.17.14.zip
unzip v5.17.14.zip -d swagger-ui
mv swagger-ui/swagger-ui-5.17.14/dist/ docs/swagger-ui
rm -rf v5.17.14.zip
- name: Checkout Visionatrix
uses: actions/checkout@v4
with:
path: src_visionatrix
repository: Visionatrix/Visionatrix
- name: Install Visionatrix
run: |
python3 -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
python3 -m pip install "src_visionatrix/.[pgsql]"
python3 -m visionatrix install
- name: Install all flows and generate OpenAPI specs
run: |
VIX_MODE=SERVER VIX_SERVER_FULL_MODELS=0 python3 -m visionatrix install-flow --file=./flows
mkdir -p openapi
openapi_file="openapi/openapi-flows.json"
VIX_MODE=SERVER VIX_SERVER_FULL_MODELS=0 python3 -m visionatrix openapi --flows="*" --exclude-base --file="$openapi_file"
- name: Build flows for each version
run: |
set -e
mkdir flows_publish
for branch in $(git branch -r | grep -E 'origin/version-'); do
local_branch=$(echo "$branch" | sed -E 's/origin\///')
if git show-ref --verify --quiet "refs/heads/$local_branch"; then
git checkout "$local_branch"
else
git checkout --track "$branch"
fi
version=$(echo "$branch" | sed -E 's/origin\/version-([0-9\.]+)/\1/')
# Create versioned flows ZIP
zip -r "flows_publish/flows-$version.zip" flows
# Create versioned models_catalog.json
cp models_catalog.json "flows_publish/models_catalog-$version.json"
done
git checkout main
zip -r flows_publish/flows.zip flows
cp models_catalog.json "flows_publish/models_catalog.json"
- name: Build and push Docs
run: |
export CHANGES_DATE=`date -d"@$(git log -1 --pretty=%ct)" --iso-8601=seconds`
python3 scripts/benchmarks/generate_hardware_results.py
mkdocs build
git config --global user.name bigcat88
git config --global user.email "bigcat88@users.noreply.github.com"
docroot=`mktemp -d`
rsync -av "site/" "${docroot}/"
rsync -av "flows_publish/" "${docroot}/"
rsync -av "models_catalog.json" "${docroot}/"
rsync -av "docs/swagger-ui/" "${docroot}/swagger-ui/"
rsync -av "docs/swagger.html" "${docroot}/swagger.html"
rsync -av "openapi/" "${docroot}/openapi/"
pushd "${docroot}"
git init
git remote add deploy "https://token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git checkout -b gh-pages
touch .nojekyll
git add .
msg="Docs: commit ${GITHUB_SHA} made on ${CHANGES_DATE} from ${GITHUB_REF} by ${GITHUB_ACTOR}"
git commit -am "${msg}"
git push deploy gh-pages --force
popd
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_DOCS }}