Workspace Integration #140
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: Workspace Integration | |
| on: | |
| pull_request: | |
| branches: [main] | |
| schedule: | |
| # 08:00 UTC nightly | |
| - cron: "0 8 * * *" | |
| workflow_dispatch: | |
| inputs: | |
| override_repo: | |
| description: "Sibling repo name to pin to a specific sha (optional)" | |
| required: false | |
| override_sha: | |
| description: "Commit sha for the override_repo (optional)" | |
| required: false | |
| repository_dispatch: | |
| types: [sibling-updated] | |
| concurrency: | |
| group: integration-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| gitlink-freshness: | |
| # Gate: every tracked gitlink must be at the tip of its sibling repo's | |
| # default branch, so the workspace pointers can't silently drift behind | |
| # merged work. Uses ls-remote (no sibling checkout needed). | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check gitlinks are at their default-branch tips | |
| env: | |
| GH_TOKEN: ${{ secrets.SIBLING_CHECKOUT_TOKEN || secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config --global url."https://x-access-token:${GH_TOKEN}@github.com/personalrobotics/".insteadOf "https://github.com/personalrobotics/" | |
| ./scripts/check_gitlink_freshness.sh | |
| integration: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11", "3.12"] | |
| steps: | |
| - name: Checkout robot-code | |
| uses: actions/checkout@v4 | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install system dependencies | |
| run: sudo apt-get update && sudo apt-get install -y libeigen3-dev | |
| - name: Bootstrap siblings | |
| env: | |
| # While any sibling repo is still private, setup.sh needs auth to clone. | |
| # Once all repos are public, GH_TOKEN can be removed. | |
| GH_TOKEN: ${{ secrets.SIBLING_CHECKOUT_TOKEN || secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Configure git to use the token for personalrobotics clones. | |
| git config --global url."https://x-access-token:${GH_TOKEN}@github.com/personalrobotics/".insteadOf "https://github.com/personalrobotics/" | |
| ./setup.sh | |
| - name: Override sibling at specific sha (dispatch) | |
| if: github.event_name == 'repository_dispatch' | |
| working-directory: ${{ github.event.client_payload.repo }} | |
| run: | | |
| git fetch origin "${{ github.event.client_payload.sha }}" | |
| git checkout "${{ github.event.client_payload.sha }}" | |
| - name: Override sibling at specific sha (manual) | |
| if: github.event_name == 'workflow_dispatch' && inputs.override_repo != '' | |
| working-directory: ${{ inputs.override_repo }} | |
| run: | | |
| git fetch origin "${{ inputs.override_sha }}" | |
| git checkout "${{ inputs.override_sha }}" | |
| - name: Re-sync after override | |
| if: github.event_name == 'repository_dispatch' || (github.event_name == 'workflow_dispatch' && inputs.override_repo != '') | |
| run: uv sync | |
| - name: Per-sibling unit tests | |
| run: | | |
| set +e | |
| fail=0 | |
| for d in ada_assets ada_mj asset_manager geodude geodude_assets mj_environment mj_manipulator mj_viser prl_assets pycbirrt tsr; do | |
| if [ -d "$d/tests" ]; then | |
| echo "::group::$d tests" | |
| (cd "$d" && uv run pytest tests/ -q) || fail=1 | |
| echo "::endgroup::" | |
| fi | |
| done | |
| exit $fail | |
| - name: Cross-repo integration tests | |
| run: uv run pytest tests/integration -v | |
| - name: Import smoke check | |
| run: | | |
| uv run python -c "import ada_assets, ada_mj, asset_manager, geodude, geodude_assets, mj_environment, mj_manipulator, mj_viser, prl_assets, pycbirrt, tsr; print('all imports OK')" | |
| notify-on-nightly-failure: | |
| needs: [integration, gitlink-freshness] | |
| if: failure() && github.event_name == 'schedule' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| steps: | |
| - uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; | |
| await github.rest.issues.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: `Nightly integration failed (run ${context.runId})`, | |
| body: `Nightly workspace-integration run failed.\n\nSee: ${runUrl}`, | |
| labels: ["ci", "nightly-fail"], | |
| }); |