-
Notifications
You must be signed in to change notification settings - Fork 0
212 lines (179 loc) · 7.33 KB
/
Copy pathvr-foraging-cicd.yml
File metadata and controls
212 lines (179 loc) · 7.33 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
201
202
203
204
205
206
207
208
209
210
211
212
name: VrForaging test suite
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- dev*
- release*
release:
types: [published]
jobs:
# ╔──────────────────────────╗
# │ _____ _ │
# │ |_ _|__ ___| |_ ___ │
# │ | |/ _ \/ __| __/ __| │
# │ | | __/\__ \ |_\__ \ │
# │ |_|\___||___/\__|___/ │
# │ │
# ╚──────────────────────────╝
tests:
runs-on: windows-latest
name: VrForaging unit tests
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install python dependencies
run: uv sync
- name: Run ruff format
run: uv run ruff format
- name: Run ruff check
run: uv run ruff check
- name: Run codespell
run: uv run codespell
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Restore dotnet tools
run: dotnet tool restore
- name: Setup Bonsai environment
working-directory: ./bonsai
run: ./setup.ps1
- name: Run python unit tests
run: uv run python -m unittest
- name: Regenerate schemas
run: uv run vr-foraging regenerate
- name: Check for uncommitted changes
run: |
git config --global core.safecrlf false
git diff --exit-code || (echo "Untracked changes found" && exit 1)
# ╔───────────────────────────────────────────────────────────╗
# │ ____ ___ ____ ____ ____ _ │
# │ / ___|_ _/ ___| _ \ | _ \ ___| | ___ __ _ ___ ___ │
# │ | | | | | | | | | | |_) / _ \ |/ _ \/ _` / __|/ _ \ │
# │ | |___ | | |___| |_| | | _ < __/ | __/ (_| \__ \ __/ │
# │ \____|___\____|____/ |_| \_\___|_|\___|\__,_|___/\___| │
# │ │
# ╚───────────────────────────────────────────────────────────╝
github-rc-release:
needs: tests
runs-on: ubuntu-latest
if: >
github.ref == 'refs/heads/main' &&
github.event_name == 'push' &&
github.event.head_commit.author.email != 'github-actions[bot]@users.noreply.github.com'
name: Create GitHub pre-release
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
ref: main
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Bump pre-release by default
shell: bash
run: |
if uv version --bump rc --dry-run; then
uv version --bump rc
else
uv version --bump rc --bump patch
fi
- name: Regenerate schemas
run: uv run vr-foraging regenerate
- name: Commit version and schema changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Bump version and regenerate schemas [skip ci]" || echo "No changes to commit"
git push origin main
- name: Get version
id: get_version
run: |
version=$(uv version --output-format json | jq -r '.version')
echo "version=$version" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.version }}
name: v${{ steps.get_version.outputs.version }}
generate_release_notes: true
prerelease: true
body: |
Automated pre-release v${{ steps.get_version.outputs.version }}
# ╔─────────────────────────────────────────────────────────────────╗
# │ ____ _ _ _ ____ _ │
# │ | _ \ _ _| |__ | (_) ___ | _ \ ___| | ___ __ _ ___ ___ │
# │ | |_) | | | | '_ \| | |/ __| | |_) / _ \ |/ _ \/ _` / __|/ _ \ │
# │ | __/| |_| | |_) | | | (__ | _ < __/ | __/ (_| \__ \ __/ │
# │ |_| \__,_|_.__/|_|_|\___| |_| \_\___|_|\___|\__,_|___/\___| │
# │ │
# ╚─────────────────────────────────────────────────────────────────╝
github-public-release:
runs-on: ubuntu-latest
name: Create GitHub public release
needs: tests
if: github.event_name == 'release' &&
github.event.action == 'published' &&
!github.event.release.prerelease
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
ref: main
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Get release version from tag
id: get_version
run: echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
- name: Validate version tag format
run: uv version ${{ steps.get_version.outputs.version }} --dry-run
- name: Update package version
run: uv version ${{ steps.get_version.outputs.version }}
- name: Regenerate schemas
run: uv run vr-foraging regenerate
- name: Commit version and schema changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Set version and regenerate schemas" || echo "No changes to commit"
git push origin main
# ╔─────────────────────────╗
# │ ____ │
# │ | _ \ ___ ___ ___ │
# │ | | | |/ _ \ / __/ __| │
# │ | |_| | (_) | (__\__ \ │
# │ |____/ \___/ \___|___/ │
# │ │
# ╚─────────────────────────╝
build-docs:
name: Build and deploy documentation to GitHub Pages
runs-on: ubuntu-latest
needs: github-rc-release
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v2
- name: Install docs group of dependencies
run: uv sync --group docs
- name: Build Sphinx documentation
run: uv run sphinx-build -b html docs/ _build/html
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/html
force_orphan: true