v1.1.1rc2 #406
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: VrForaging test suite | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| - dev* | |
| - release* | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| # ╔──────────────────────────╗ | |
| # │ _____ _ │ | |
| # │ |_ _|__ ___| |_ ___ │ | |
| # │ | |/ _ \/ __| __/ __| │ | |
| # │ | | __/\__ \ |_\__ \ │ | |
| # │ |_|\___||___/\__|___/ │ | |
| # │ │ | |
| # ╚──────────────────────────╝ | |
| tests: | |
| runs-on: windows-latest | |
| name: VrForaging unit tests | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v8.1.0 | |
| with: | |
| enable-cache: true | |
| - name: Install python dependencies | |
| run: uv sync --all-packages | |
| - name: Run ruff format | |
| run: uv run ruff format --check | |
| - 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@v5 | |
| 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 .NET extension tests | |
| run: dotnet test ./tests/Extensions.Tests/Extensions.Tests.csproj | |
| - name: Run python unit tests | |
| run: uv run pytest | |
| - name: Regenerate all schemas | |
| run: uv run scripts/regenerate.py | |
| - name: Build all packages | |
| run: uv build --all-packages | |
| - name: Check for uncommitted changes | |
| shell: bash | |
| run: | | |
| git config --global core.safecrlf false | |
| git diff --exit-code || (echo "Untracked changes found" && exit 1) | |
| # ╔─────────────────────────────────────────────────────────────────╗ | |
| # │ ____ _ _ _ ____ _ │ | |
| # │ | _ \ _ _| |__ | (_) ___ | _ \ ___| | ___ __ _ ___ ___ │ | |
| # │ | |_) | | | | '_ \| | |/ __| | |_) / _ \ |/ _ \/ _` / __|/ _ \ │ | |
| # │ | __/| |_| | |_) | | | (__ | _ < __/ | __/ (_| \__ \ __/ │ | |
| # │ |_| \__,_|_.__/|_|_|\___| |_| \_\___|_|\___|\__,_|___/\___| │ | |
| # │ │ | |
| # ╚─────────────────────────────────────────────────────────────────╝ | |
| prepare-release: | |
| runs-on: ubuntu-latest | |
| name: Set version and regenerate schemas | |
| needs: tests | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| outputs: | |
| version: ${{ steps.get_version.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| ref: main | |
| # PAT from an admin account so the version-bump commit and tag | |
| # push below can bypass the branch ruleset protecting `main`. | |
| token: ${{ secrets.RELEASE_PAT }} | |
| - uses: astral-sh/setup-uv@v8.1.0 | |
| with: | |
| enable-cache: true | |
| - name: Extract version from tag | |
| id: get_version | |
| shell: bash | |
| run: | | |
| version=$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//') | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| echo "Setting version to: $version" | |
| - name: Validate version for all packages | |
| shell: bash | |
| run: | | |
| for pkg in aind-behavior-vr-foraging aind-behavior-vr-foraging-curricula; do | |
| uv version ${{ steps.get_version.outputs.version }} --package $pkg --dry-run | |
| done | |
| - name: Set version for all packages | |
| shell: bash | |
| run: | | |
| for pkg in aind-behavior-vr-foraging aind-behavior-vr-foraging-curricula; do | |
| uv version ${{ steps.get_version.outputs.version }} --package $pkg | |
| done | |
| - name: Regenerate all schemas | |
| run: uv run scripts/regenerate.py | |
| - name: Build all packages | |
| run: uv build --all-packages | |
| - name: Upload wheels as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| retention-days: 1 | |
| - name: Commit version and schema changes | |
| shell: bash | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git diff --cached --quiet && echo "No changes to commit" && exit 0 | |
| git commit -m "Set version ${{ steps.get_version.outputs.version }} and regenerate schemas [skip ci]" | |
| git push origin main | |
| # Move the release tag to point to this new commit | |
| git tag -fa "${{ github.event.release.tag_name }}" -m "${{ github.event.release.tag_name }}" | |
| git push origin "${{ github.event.release.tag_name }}" --force | |
| # ╔────────────────────────────────────────╗ | |
| # │ ____ _ _ _ _ │ | |
| # │ | _ \ _ _| |__ | (_)___| |__ │ | |
| # │ | |_) | | | | '_ \| | / __| '_ \ │ | |
| # │ | __/| |_| | |_) | | \__ \ | | | │ | |
| # │ |_| \__,_|_.__/|_|_|___/_| |_| │ | |
| # │ │ | |
| # ╚────────────────────────────────────────╝ | |
| publish-to-pypi: | |
| runs-on: ubuntu-latest | |
| name: Publish to PyPI | |
| needs: prepare-release | |
| steps: | |
| - name: Download wheels artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - uses: astral-sh/setup-uv@v8.1.0 | |
| with: | |
| enable-cache: true | |
| - name: Publish to PyPI | |
| run: uv publish --token ${{ secrets.AIND_PYPI_TOKEN }} | |
| - name: Upload wheels to GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/* | |
| # ╔─────────────────────────╗ | |
| # │ ____ │ | |
| # │ | _ \ ___ ___ ___ │ | |
| # │ | | | |/ _ \ / __/ __| │ | |
| # │ | |_| | (_) | (__\__ \ │ | |
| # │ |____/ \___/ \___|___/ │ | |
| # │ │ | |
| # ╚─────────────────────────╝ | |
| build-docs: | |
| name: Build and deploy documentation to GitHub Pages | |
| runs-on: ubuntu-latest | |
| needs: [tests, prepare-release] | |
| if: | | |
| always() | |
| && needs.tests.result == 'success' | |
| && (needs.prepare-release.result == 'success' || needs.prepare-release.result == 'skipped') | |
| && ( | |
| (github.event_name == 'release' && !github.event.release.prerelease) | |
| || github.event_name == 'workflow_dispatch' | |
| ) | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: main | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| with: | |
| enable-cache: true | |
| - name: Setup Graphviz | |
| uses: ts-graphviz/setup-graphviz@v2 | |
| - name: Install docs group of dependencies | |
| run: uv sync --group docs | |
| - name: Build MkDocs documentation | |
| run: uv run mkdocs build --strict | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: site | |
| force_orphan: true |