Skip to content

Commit bc42268

Browse files
committed
Centralize actions into a single one
1 parent 5f3a0e2 commit bc42268

File tree

4 files changed

+214
-145
lines changed

4 files changed

+214
-145
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

.github/workflows/docs.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/workflows/tag_and_publish.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
name: VrForaging test suite
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches: ['*']
8+
release:
9+
types: [ published ]
10+
11+
jobs:
12+
13+
# ╔──────────────────────────╗
14+
# │ _____ _ │
15+
# │ |_ _|__ ___| |_ ___ │
16+
# │ | |/ _ \/ __| __/ __| │
17+
# │ | | __/\__ \ |_\__ \ │
18+
# │ |_|\___||___/\__|___/ │
19+
# │ │
20+
# ╚──────────────────────────╝
21+
tests:
22+
runs-on: windows-latest
23+
name: VrForaging unit tests
24+
steps:
25+
- uses: actions/checkout@v5
26+
27+
- uses: astral-sh/setup-uv@v6
28+
with:
29+
enable-cache: true
30+
31+
- name: Set up Python
32+
run: uv python install
33+
34+
- name: Install python dependencies
35+
run: uv sync
36+
37+
- name: Run ruff format
38+
run: uv run ruff format
39+
40+
- name: Run ruff check
41+
run: uv run ruff check
42+
43+
- name: Run codespell
44+
run: uv run codespell
45+
46+
- name: Setup .NET Core SDK
47+
uses: actions/setup-dotnet@v4
48+
with:
49+
dotnet-version: 8.x
50+
51+
- name: Restore dotnet tools
52+
run: dotnet tool restore
53+
54+
- name: Setup Bonsai environment
55+
working-directory: ./bonsai
56+
run: ./setup.ps1
57+
58+
- name: Run python unit tests
59+
run: uv run python -m unittest
60+
61+
- name: Regenerate schemas
62+
run: uv run vr-foraging regenerate
63+
64+
- name: Check for uncommitted changes
65+
run: |
66+
git config --global core.safecrlf false
67+
git diff --exit-code || (echo "Untracked changes found" && exit 1)
68+
69+
70+
# ╔───────────────────────────────────────────────────────────╗
71+
# │ ____ ___ ____ ____ ____ _ │
72+
# │ / ___|_ _/ ___| _ \ | _ \ ___| | ___ __ _ ___ ___ │
73+
# │ | | | | | | | | | | |_) / _ \ |/ _ \/ _` / __|/ _ \ │
74+
# │ | |___ | | |___| |_| | | _ < __/ | __/ (_| \__ \ __/ │
75+
# │ \____|___\____|____/ |_| \_\___|_|\___|\__,_|___/\___| │
76+
# │ │
77+
# ╚───────────────────────────────────────────────────────────╝
78+
github-rc-release:
79+
needs: tests
80+
runs-on: ubuntu-latest
81+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
82+
name: Create GitHub pre-release
83+
steps:
84+
- uses: actions/checkout@v5
85+
with:
86+
fetch-depth: 0
87+
ref: ${{ env.DEFAULT_BRANCH }}
88+
89+
- uses: astral-sh/setup-uv@v6
90+
with:
91+
enable-cache: true
92+
93+
- name: Set up Python
94+
run: uv python install
95+
96+
- name: Bump pre-release by default
97+
run: uv version --bump rc
98+
99+
- name: Regenerate schemas
100+
run: uv run vr-foraging regenerate
101+
102+
- name: Commit version and schema changes
103+
run: |
104+
git config --global user.name "github-actions[bot]"
105+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
106+
git add .
107+
git commit -m "Bump version and regenerate schemas" || echo "No changes to commit"
108+
git push origin ${{ env.DEFAULT_BRANCH }}
109+
110+
- name: Get version
111+
id: get_version
112+
run: |
113+
version=$(uv version --output-format json | jq -r '.version')
114+
echo "version=$version" >> $GITHUB_OUTPUT
115+
116+
- name: Create GitHub Release
117+
uses: softprops/action-gh-release@v2
118+
env:
119+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
120+
with:
121+
tag_name: v${{ steps.get_version.outputs.version }}
122+
name: v${{ steps.get_version.outputs.version }}
123+
generate_release_notes: true
124+
prerelease: true
125+
body: |
126+
Automated pre-release v${{ steps.get_version.outputs.version }}
127+
128+
# ╔─────────────────────────────────────────────────────────────────╗
129+
# │ ____ _ _ _ ____ _ │
130+
# │ | _ \ _ _| |__ | (_) ___ | _ \ ___| | ___ __ _ ___ ___ │
131+
# │ | |_) | | | | '_ \| | |/ __| | |_) / _ \ |/ _ \/ _` / __|/ _ \ │
132+
# │ | __/| |_| | |_) | | | (__ | _ < __/ | __/ (_| \__ \ __/ │
133+
# │ |_| \__,_|_.__/|_|_|\___| |_| \_\___|_|\___|\__,_|___/\___| │
134+
# │ │
135+
# ╚─────────────────────────────────────────────────────────────────╝
136+
137+
github-public-release:
138+
runs-on: ubuntu-latest
139+
name: Create GitHub public release
140+
needs: tests
141+
if: github.event_name == 'release' &&
142+
github.event.action == 'published' &&
143+
!github.event.release.prerelease
144+
steps:
145+
- uses: actions/checkout@v5
146+
with:
147+
fetch-depth: 0
148+
ref: ${{ env.DEFAULT_BRANCH }}
149+
150+
- uses: astral-sh/setup-uv@v6
151+
with:
152+
enable-cache: true
153+
- name: Set up Python
154+
run: uv python install
155+
156+
- name: Get release version from tag
157+
id: get_version
158+
run: echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
159+
160+
- name: Validate version tag format
161+
run: uv version ${{ steps.get_version.outputs.version }} --dry-run
162+
163+
- name: Update package version
164+
run: uv version ${{ steps.get_version.outputs.version }}
165+
166+
- name: Regenerate schemas
167+
run: uv run vr-foraging regenerate
168+
169+
- name: Commit version and schema changes
170+
run: |
171+
git config --global user.name "github-actions[bot]"
172+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
173+
git add .
174+
git commit -m "Set version and regenerate schemas" || echo "No changes to commit"
175+
git push origin ${{ env.DEFAULT_BRANCH }}
176+
177+
178+
# ╔─────────────────────────╗
179+
# │ ____ │
180+
# │ | _ \ ___ ___ ___ │
181+
# │ | | | |/ _ \ / __/ __| │
182+
# │ | |_| | (_) | (__\__ \ │
183+
# │ |____/ \___/ \___|___/ │
184+
# │ │
185+
# ╚─────────────────────────╝
186+
build-docs:
187+
runs-on: ubuntu-latest
188+
needs: github-rc-release
189+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
190+
steps:
191+
- name: Checkout repository
192+
uses: actions/checkout@v5
193+
194+
- name: Set up Python
195+
run: uv python install
196+
197+
- name: Install uv
198+
uses: astral-sh/setup-uv@v3
199+
200+
- name: Setup Graphviz
201+
uses: ts-graphviz/setup-graphviz@v2
202+
203+
- name: Install docs group of dependencies
204+
run: uv sync --group docs
205+
206+
- name: Build Sphinx documentation
207+
run: uv run sphinx-build -b html docs/ _build/html
208+
209+
- name: Deploy to GitHub Pages
210+
uses: peaceiris/actions-gh-pages@v4
211+
with:
212+
github_token: ${{ secrets.GITHUB_TOKEN }}
213+
publish_dir: _build/html
214+
force_orphan: true

0 commit comments

Comments
 (0)